GUI CSS: Deployed view styles for layouts (CMK-1171)
[check_mk.git] / checks / sansymphony_alerts
blobfefa3a939958da596e74c0648e12ed870eacefa2
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
10 # | copyright mathias kettner 2013 mk@mathias-kettner.de |
11 # +------------------------------------------------------------------+
13 # this file is part of check_mk.
14 # the official homepage is at http://mathias-kettner.de/check_mk.
16 # check_mk is free software; you can redistribute it and/or modify it
17 # under the terms of the gnu general public license as published by
18 # the free software foundation in version 2. check_mk is distributed
19 # in the hope that it will be useful, but without any warranty; with-
20 # out even the implied warranty of merchantability or fitness for a
21 # particular purpose. see the gnu general public license for more de-
22 # ails. you should have received a copy of the gnu general public
23 # license along with gnu make; see the file copying. if not, write
24 # to the free software foundation, inc., 51 franklin st, fifth floor,
25 # boston, ma 02110-1301 usa.
27 sansymphony_alerts_default_values = (1, 2)
30 def inventory_sansymphony_alerts(info):
31 return [(None, "sansymphony_alerts_default_values")]
34 def check_sansymphony_alerts(_no_item, params, info):
35 warn, crit = params
36 nr_of_alerts = int(info[0][0])
37 perfdata = [("alerts", nr_of_alerts, warn, crit)]
38 infotxt = "Unacknowlegded alerts: %d" % nr_of_alerts
39 levels = " (warn/crit at %d/%d)" % (warn, crit)
41 state = 0
42 if nr_of_alerts >= crit:
43 state = 2
44 infotxt += levels
45 elif nr_of_alerts >= warn:
46 state = 1
47 infotxt += levels
48 return state, infotxt, perfdata
51 check_info["sansymphony_alerts"] = {
52 "check_function": check_sansymphony_alerts,
53 "inventory_function": inventory_sansymphony_alerts,
54 "service_description": "sansymphony Alerts",
55 "has_perfdata": True,
56 "group": "sansymphony_alerts",