Module: check_mk
Branch: master
Commit: 6f5f2e6d2c368fd5b39a23ae80a2a51d95c013a7
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6f5f2e6d2c368f…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Mon Apr 1 11:50:11 2019 +0200
7356 FIX fireeye_mail: Fixed wrong scaling of total, infected and analyzed mail rate
Change-Id: Ib2f14330e5d6d5967a23fdead6b96b18d54efa65
---
.werks/7356 | 11 +++++++++++
checks/fireeye.include | 11 ++++++-----
checks/fireeye_mail | 11 +++++------
3 files changed, 22 insertions(+), 11 deletions(-)
diff --git a/.werks/7356 b/.werks/7356
new file mode 100644
index 0000000..023b3e6
--- /dev/null
+++ b/.werks/7356
@@ -0,0 +1,11 @@
+Title: fireeye_mail: Fixed wrong scaling of total, infected and analyzed mail rates
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1554103411
+
+
diff --git a/checks/fireeye.include b/checks/fireeye.include
index f10cdd0..509ebf3 100644
--- a/checks/fireeye.include
+++ b/checks/fireeye.include
@@ -67,8 +67,9 @@ def check_fireeye_states(states):
def fireeye_check_generic(infotext, counter, value, warn=None, crit=None):
perfdata = [(counter, value, warn, crit)]
- if crit and value >= crit:
- return (2, infotext + ' (warn/crit at %d/%d)' % (warn, crit), perfdata)
- elif warn and value >= warn:
- return (1, infotext + ' (warn/crit at %d/%d)' % (warn, crit), perfdata)
- return (0, infotext, perfdata)
+ if crit is not None and value >= crit:
+ return (2, infotext + ' (warn/crit at %d/%d)' % (warn,crit), perfdata)
+ elif warn is not None and value >= warn:
+ return (1, infotext + ' (warn/crit at %d/%d)' % (warn,crit), perfdata)
+ else:
+ return (0, infotext, perfdata)
diff --git a/checks/fireeye_mail b/checks/fireeye_mail
index 8f713e5..bef7295 100644
--- a/checks/fireeye_mail
+++ b/checks/fireeye_mail
@@ -31,7 +31,7 @@ def fireeye_counter_generic(value, what, average):
# (e.g. 'Infected URL')
# For the counter variable name, we remove all spaces
# (e.g. 'fireeye.infected.url')
- counter = 'fireeye.%s' % what.replace(' ', '.').lower()
+ counter = 'fireeye_mail.%s' % what.replace(' ', '.').lower()
rate = get_rate(counter, this_time, value)
state = 0
if what == 'Bypass' and rate > 0:
@@ -41,9 +41,9 @@ def fireeye_counter_generic(value, what, average):
perfdata = [('%s_rate' % what.split(' ')[0].lower(), rate)]
if average:
avg = get_average(' %s avg' % counter, this_time, rate, average)
- return (state, '%s rate: %.2f mails per %d second' % \
+ return (state, '%s: %.2f mails/%d seconds' % \
(what, avg * average, average), perfdata)
- return (state, '%s rate: %.2f mails per second' % (what, rate), perfdata)
+ return (state, '%s: %.2f mails/s' % (what, rate ), perfdata)
# .--mail----------------------------------------------------------------.
@@ -71,8 +71,8 @@ def fireeye_counter_generic(value, what, average):
def check_fireeye_mail(_no_item, params, info):
mail_info = info[0][0:3]
average = params.get('interval', 0)
- for index, mail_type in enumerate(['Total Email', 'Infected Email',
'Analyzed Email']):
- yield fireeye_counter_generic(int(mail_info[index]) * 60, mail_type, average)
+ for index, mail_type in enumerate(['Total', 'Infected',
'Analyzed']):
+ yield fireeye_counter_generic(int(mail_info[index]), mail_type, average)
check_info['fireeye_mail'] = {
@@ -261,6 +261,5 @@ check_info['fireeye_mail.received'] = {
'check_function': check_fireeye_mail_received,
'service_description': 'Mails Received',
'default_levels_variable': 'received_levels',
- 'group': 'fireeye_mail_received',
'has_perfdata': True,
}