Skip to content

Commit 685ba1a

Browse files
authored
Merge pull request #2 from OpensourceICTSolutions/improve-security
Improve security
2 parents a20f45c + fe0e6ee commit 685ba1a

File tree

5 files changed

+235
-9
lines changed

5 files changed

+235
-9
lines changed

litterrobot_get_activity.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@
1212
import json
1313
import time
1414
import re
15+
import sys
1516
from datetime import datetime
1617

1718
from pylitterbot import Account
1819

1920
# Set email and password for initial authentication.
20-
username = "EMAIL HERE"
21-
password = "PASSWORD HERE"
21+
username = sys.argv[1]
22+
password = sys.argv[2]
2223

2324
# Declare search variable
2425
date = datetime.today().strftime('%Y-%m-%d')

litterrobot_get_insights.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@
88
#date: 25-12-2022
99
#
1010
import asyncio
11+
import sys
1112

1213
from pylitterbot import Account
1314

1415
# Set email and password for initial authentication.
15-
username = "EMAIL HERE"
16-
password = "PASSWORD HERE"
16+
username = sys.argv[1]
17+
password = sys.argv[2]
1718

1819
async def main():
1920
# Create an account.

litterrobot_get_robots.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
from pylitterbot import Account
1414

1515
# Set email and password for initial authentication.
16-
username = "EMAIL HERE"
17-
password = "PASSWORD HERE"
16+
username = sys.argv[1]
17+
password = sys.argv[2]
1818

1919
async def main():
2020
# Create an account.

litterrobot_userparams.conf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
UserParameter=get.robots,/usr/share/zabbix/litterrobot/litterrobot_get_robots.py
2-
UserParameter=get.insights,/usr/share/zabbix/litterrobot/litterrobot_get_insights.py
3-
UserParameter=get.activity,/usr/share/zabbix/litterrobot/litterrobot_get_activity.py
1+
UserParameter=get.robots[*],/usr/share/zabbix/litterrobot/litterrobot_get_robots.py "$1" "$2"
2+
UserParameter=get.insights[*],/usr/share/zabbix/litterrobot/litterrobot_get_insights.py "$1" "$2"
3+
UserParameter=get.activity[*],/usr/share/zabbix/litterrobot/litterrobot_get_activity.py "$1" "$2"
Lines changed: 224 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,224 @@
1+
zabbix_export:
2+
version: '6.2'
3+
date: '2022-12-24T23:36:49Z'
4+
template_groups:
5+
-
6+
uuid: fb2cb3f577c841709b16db20ff669757
7+
name: Templates/Home
8+
templates:
9+
-
10+
uuid: 6f76003ccb5e42da963210dbecd89f0a
11+
template: 'Litterrobot API by HTTP'
12+
name: 'Litterrobot API by HTTP'
13+
groups:
14+
-
15+
name: Templates/Home
16+
items:
17+
-
18+
uuid: d08454426e744cedb6589f5c6c86eb3e
19+
name: 'Cycles: Completed today'
20+
type: DEPENDENT
21+
key: clean.cycle.complete
22+
delay: '0'
23+
preprocessing:
24+
-
25+
type: JSONPATH
26+
parameters:
27+
- '$.data[0].CCC'
28+
master_item:
29+
key: 'get.activity[{$ROBOT.USERNAME},{$ROBOT.PASSWORD}]'
30+
tags:
31+
-
32+
tag: component
33+
value: 'clean cycle'
34+
triggers:
35+
-
36+
uuid: 50536a1852594ce1a3778b7a94b6aca4
37+
expression: 'last(/Litterrobot API by HTTP/clean.cycle.complete)>={$CLEAN.CYCLE.HIGH}'
38+
name: 'More than {$CLEAN.CYCLE.HIGH} cycles completed today'
39+
priority: HIGH
40+
tags:
41+
-
42+
tag: scope
43+
value: notice
44+
-
45+
uuid: 07a1d786feff4640ab368e0a4375f4e7
46+
expression: 'last(/Litterrobot API by HTTP/clean.cycle.complete)>={$CLEAN.CYCLE.WARNING}'
47+
name: 'More than {$CLEAN.CYCLE.WARNING} cycles completed today'
48+
priority: WARNING
49+
tags:
50+
-
51+
tag: scope
52+
value: notice
53+
-
54+
uuid: 1e5905a6c2ab490bb3e35befdfb8b46f
55+
name: 'Drawer: Full messages today'
56+
type: DEPENDENT
57+
key: drawer.full.messages
58+
delay: '0'
59+
preprocessing:
60+
-
61+
type: JSONPATH
62+
parameters:
63+
- '$.data[0].DF'
64+
master_item:
65+
key: 'get.activity[{$ROBOT.USERNAME},{$ROBOT.PASSWORD}]'
66+
tags:
67+
-
68+
tag: component
69+
value: drawer
70+
triggers:
71+
-
72+
uuid: b49a0bbdf3104eef8a3639fcf583681a
73+
expression: 'last(/Litterrobot API by HTTP/drawer.full.messages)>0'
74+
name: 'Drawer is full'
75+
priority: INFO
76+
tags:
77+
-
78+
tag: scope
79+
value: notice
80+
-
81+
uuid: 01b173d5a16045afa02fabf8a6b16e6a
82+
name: 'Get robot activity'
83+
key: 'get.activity[{$ROBOT.USERNAME},{$ROBOT.PASSWORD}]'
84+
delay: 5m
85+
history: '0'
86+
trends: '0'
87+
value_type: TEXT
88+
tags:
89+
-
90+
tag: component
91+
value: raw
92+
-
93+
uuid: 0697b4432eb444db8c8633583eff1a4a
94+
name: 'Get robot insights'
95+
key: 'get.insights[{$ROBOT.USERNAME},{$ROBOT.PASSWORD}]'
96+
delay: 1h
97+
history: '0'
98+
trends: '0'
99+
value_type: TEXT
100+
tags:
101+
-
102+
tag: component
103+
value: raw
104+
-
105+
uuid: 9cd2dafbc2bc4499838d311263204f50
106+
name: 'Get robot info'
107+
key: 'get.robots[{$ROBOT.USERNAME},{$ROBOT.PASSWORD}]'
108+
delay: 15m
109+
history: '0'
110+
trends: '0'
111+
value_type: TEXT
112+
tags:
113+
-
114+
tag: component
115+
value: raw
116+
-
117+
uuid: fd1fe15190874546a3dd5e0f1b07a6a3
118+
name: 'Cycles: Average number in 30 days'
119+
type: DEPENDENT
120+
key: robot.average.cycles
121+
delay: '0'
122+
value_type: FLOAT
123+
preprocessing:
124+
-
125+
type: REGEX
126+
parameters:
127+
- 'averaging\s([0-9.]+)\scycles'
128+
- \1
129+
master_item:
130+
key: 'get.insights[{$ROBOT.USERNAME},{$ROBOT.PASSWORD}]'
131+
tags:
132+
-
133+
tag: component
134+
value: 'clean cycle'
135+
-
136+
uuid: 4039288296e44f40892949c4d772576b
137+
name: 'System: ID'
138+
type: DEPENDENT
139+
key: robot.id
140+
delay: '0'
141+
trends: '0'
142+
value_type: CHAR
143+
preprocessing:
144+
-
145+
type: REGEX
146+
parameters:
147+
- 'id:\s([A-Za-z-.0-9]+)'
148+
- \1
149+
master_item:
150+
key: 'get.robots[{$ROBOT.USERNAME},{$ROBOT.PASSWORD}]'
151+
tags:
152+
-
153+
tag: component
154+
value: system
155+
-
156+
uuid: e756f34ff83c49568fb21a84d4977758
157+
name: 'System: Name'
158+
type: DEPENDENT
159+
key: robot.name
160+
delay: '0'
161+
trends: '0'
162+
value_type: CHAR
163+
inventory_link: NAME
164+
preprocessing:
165+
-
166+
type: REGEX
167+
parameters:
168+
- 'Name:\s([A-Za-z-.]+)'
169+
- \1
170+
master_item:
171+
key: 'get.robots[{$ROBOT.USERNAME},{$ROBOT.PASSWORD}]'
172+
tags:
173+
-
174+
tag: component
175+
value: system
176+
-
177+
uuid: 2e1a955070d746249a7139067b56613b
178+
name: 'System: Serial Number'
179+
type: DEPENDENT
180+
key: robot.serial
181+
delay: '0'
182+
trends: '0'
183+
value_type: CHAR
184+
preprocessing:
185+
-
186+
type: REGEX
187+
parameters:
188+
- 'Serial:\s([A-Za-z-.0-9]+)'
189+
- \1
190+
master_item:
191+
key: 'get.robots[{$ROBOT.USERNAME},{$ROBOT.PASSWORD}]'
192+
tags:
193+
-
194+
tag: component
195+
value: system
196+
-
197+
uuid: b4f67d8d0cdb4ce485fd54fb3f191bf9
198+
name: 'Cycles: Total number in 30 days'
199+
type: DEPENDENT
200+
key: robot.total.cycles
201+
delay: '0'
202+
preprocessing:
203+
-
204+
type: REGEX
205+
parameters:
206+
- 'Completed\s([0-9]+)\scycles'
207+
- \1
208+
master_item:
209+
key: 'get.insights[{$ROBOT.USERNAME},{$ROBOT.PASSWORD}]'
210+
tags:
211+
-
212+
tag: component
213+
value: 'clean cycle'
214+
macros:
215+
-
216+
macro: '{$CLEAN.CYCLE.HIGH}'
217+
value: '15'
218+
-
219+
macro: '{$CLEAN.CYCLE.WARNING}'
220+
value: '13'
221+
-
222+
macro: '{$ROBOT.PASSWORD}'
223+
-
224+
macro: '{$ROBOT.USERNAME}'

0 commit comments

Comments
 (0)