-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsidekiq
41 lines (34 loc) · 1.28 KB
/
sidekiq
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
34
35
36
37
38
39
40
41
sidekiq_qlen_default_values = (25, 75)
sidekiq_workers_default_values = (14, 15)
# the inventory function (dummy)
def inventory_sidekiq(info):
#print info
inventory = []
for line in info:
q = line[0]
value = line[1]
if q == "lowq":
inventory.append( (q, "", "sidekiq_qlen_default_values") )
if q == "critq":
inventory.append( (q, "", "sidekiq_qlen_default_values") )
if q == "defq":
inventory.append( (q, "", "sidekiq_qlen_default_values") )
if q == "workers":
inventory.append( (q, "", "sidekiq_workers_default_values") )
return inventory
# the check function (dummy)
def check_sidekiq(item, params, info):
warn, crit = params
for line in info:
queue = line[0]
qlength = int(line[1])
if qlength > crit:
return (2, "CRITICAL - Sidekiq Queue Length is %d" % qlength, [ ( "queue_length", qlength)])
elif qlength > warn:
return (1, "WARNING - Sidekiq Queue Length is %d" % qlength, [ ( "queue_length", qlength)])
else:
return (0, "OK - Sidekiq Queue Length is %d" % qlength, [ ( "queue_length", qlength)])
return (3, "UNKNOWN - No Output from agent ")
# declare the check to Check_MK
check_info['sidekiq.qlen'] = \
(check_sidekiq, "Sidekiq Queue", 1, inventory_sidekiq)