-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathzammad
More file actions
executable file
·33 lines (28 loc) · 669 Bytes
/
zammad
File metadata and controls
executable file
·33 lines (28 loc) · 669 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env python3
# fmt: off
#%# family=auto
#%# capabilities=autoconf
# fmt: on
import json
import os
import sys
from urllib.request import urlopen
try:
CMD = sys.argv[1]
except IndexError:
CMD = "fetch"
with urlopen(os.environ["MONITOR_URL"]) as handle:
payload = json.loads(handle.read())
if CMD == "config":
print()
print("graph_title Zammad issues")
print("graph_args --base 1000")
print("graph_scale no")
print("graph_category zammad")
print()
print("issues.label Issues")
print("issues.critical 0:0")
elif CMD == "autoconf":
print("yes")
else:
print("issues.value {}".format(len(payload["issues"])))