Module: check_mk
Branch: master
Commit: 582ffc0ab828d2e3f6896ac2998a6b919f2333ad
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=582ffc0ab828d2…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Dec 6 09:33:56 2010 +0100
Added bug description for WATO snapin
---
LIESMICH.zutun | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/LIESMICH.zutun b/LIESMICH.zutun
index 15b8fa6..f07c2af 100644
--- a/LIESMICH.zutun
+++ b/LIESMICH.zutun
@@ -15,6 +15,11 @@ Inventurcheck: retry_interval evt. anders (kuerzer) einstellbar machen.
--------------------------------------------------------------------------------
BUGS beheben ab 1.1.9i1
--------------------------------------------------------------------------------
+WATO Snapin: ajax-Code zum Ausgeben der Links stimmt nicht. Er nimmt
+einfach die Site-ID als URL-Prefix. Das ist aber nicht immer korrekt.
+Man kann in sites eine site "local" nennen, aber der URL-Prefix ist
+z.B. /wato/.
+
ich bin mir nicht sicher ob das nun ein Thruk Problem oder ein Livestatus Problem ist. Vermutlich beides :-)
Wenn ich im Thruk im Suchfenster einfach Enter drücke, kommt folgende Query bei raus:
GET services
@@ -519,3 +524,5 @@ Snapins: die letzten 10 Notifikationen, die letzten 10 Alerts
(evtl. umschaltbar per Tabs)
Acknowledgements: Ankreuzung, ob persistent oder nicht
+
+
Module: check_mk
Branch: master
Commit: 21b0f44040467f2f2301dc035e87e32c2f78db78
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=21b0f44040467f…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Dec 6 10:21:55 2010 +0100
Added reschedule bug
---
LIESMICH.zutun | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/LIESMICH.zutun b/LIESMICH.zutun
index f07c2af..568a9d2 100644
--- a/LIESMICH.zutun
+++ b/LIESMICH.zutun
@@ -20,6 +20,13 @@ einfach die Site-ID als URL-Prefix. Das ist aber nicht immer korrekt.
Man kann in sites eine site "local" nennen, aber der URL-Prefix ist
z.B. /wato/.
+WATO: Wenn ein Agent einen rauswird (leer Ausgabe), kommt im
+WATO bei der Inventur keine sinnvolle Fehlermeldung.
+
+Reschedule icon: Auch hier ist scheinbar im Link der Sitename als
+URL-Prefix angenommen. Das ist aber nicht unbedingt als gleich
+anzunehmen - vor allem außerhalb von OMD.
+
ich bin mir nicht sicher ob das nun ein Thruk Problem oder ein Livestatus Problem ist. Vermutlich beides :-)
Wenn ich im Thruk im Suchfenster einfach Enter drücke, kommt folgende Query bei raus:
GET services
Module: check_mk
Branch: master
Commit: 04a3dd971218faaa0c8a6a03c1a34ddfffc79a8a
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=04a3dd971218fa…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Dec 6 11:52:03 2010 +0100
new check check_mk.only_from: check IP access configuration
---
ChangeLog | 4 +-
agents/check_mk_agent.linux | 10 ++++
agents/windows/check_mk_agent.cc | 17 +++++++
agents/windows/check_mk_agent.exe | Bin 94720 -> 95232 bytes
checkman/check_mk.only_from | 35 ++++++++++++++
checks/check_mk | 95 +++++++++++++++++++++++++++++++++++++
multisite.mk | 11 ++--
7 files changed, 166 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index f59d391..3f4bee3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -92,7 +92,9 @@
* printer_supply: In case of OKI c5900 devices the name of the supply units ins not
unique. The color of the supply unit is reported in a dedicated OID and added to the
check item name to have a unique name now.
- * prnter_supply: Added simple pnp template to have better graph formating for the check results
+ * printer_supply: Added simple pnp template to have better graph formating for the check results
+ * check_mk.only_from: new check for monitoring the IP address access restriction of the
+ agent. The current Linux and Windows agents provide this information.
Multisite:
* The custom open/close states of custom links are now stored for each
diff --git a/agents/check_mk_agent.linux b/agents/check_mk_agent.linux
index ebcf520..1837e7d 100755
--- a/agents/check_mk_agent.linux
+++ b/agents/check_mk_agent.linux
@@ -55,6 +55,16 @@ fi
echo '<<<check_mk>>>'
echo Version: 1.1.9i1
echo AgentOS: linux
+echo PluginsDirectory: $PLUGINSDIR
+echo LocalDirectory: $LOCALDIR
+echo AgentDirectory: $MK_CONFDIR
+
+# If we are called via xinetd, try to find only_from configuration
+if [ -n "$REMOTE_HOST" ]
+then
+ echo -n 'OnlyFrom: '
+ sed -n '/^service[[:space:]]*check_mk/,/}/s/^[[:space:]]*only_from[[:space:]]*=[[:space:]]*\(.*\)/\1/p' /etc/xinetd.d/* | head -n1
+fi
# Partitionen (-P verhindert Zeilenumbruch bei langen Mountpunkten)
# Achtung: NFS-Mounts werden grundsaetzlich ausgeblendet, um
diff --git a/agents/windows/check_mk_agent.cc b/agents/windows/check_mk_agent.cc
index a4f6ff3..143f962 100755
--- a/agents/windows/check_mk_agent.cc
+++ b/agents/windows/check_mk_agent.cc
@@ -94,6 +94,7 @@ char g_config_file[256];
struct ipspec {
uint32_t address;
uint32_t netmask;
+ int bits;
};
#define MAX_ONLY_FROM 32
@@ -1050,6 +1051,21 @@ void section_check_mk(SOCKET &out)
output(out, "AgentDirectory: %s\n", g_agent_directory);
output(out, "PluginsDirectory: %s\n", g_plugins_dir);
output(out, "LocalDirectory: %s\n", g_local_dir);
+ output(out, "OnlyFrom:");
+ if (g_num_only_from == 0)
+ output(out, " 0.0.0.0/0\n");
+ else {
+ for (unsigned i=0; i < g_num_only_from; i++) {
+ ipspec *is = &g_only_from[i];
+ output(out, " %d.%d.%d.%d/%d",
+ is->address & 0xff,
+ is->address >> 8 & 0xff,
+ is->address >> 16 & 0xff,
+ is->address >> 24 & 0xff,
+ is->bits);
+ }
+ output(out, "\n");
+ }
}
void output_data(SOCKET &out)
@@ -1460,6 +1476,7 @@ void add_only_from(char *value)
t[0] = s[3];
g_only_from[g_num_only_from].address = ip;
g_only_from[g_num_only_from].netmask = mask;
+ g_only_from[g_num_only_from].bits = bits;
if ((ip & mask) != ip) {
fprintf(stderr, "Invalid only_hosts entry: host part not 0: %s/%u",
diff --git a/agents/windows/check_mk_agent.exe b/agents/windows/check_mk_agent.exe
index 4f02124..be9b18a 100755
Binary files a/agents/windows/check_mk_agent.exe and b/agents/windows/check_mk_agent.exe differ
diff --git a/checkman/check_mk.only_from b/checkman/check_mk.only_from
new file mode 100644
index 0000000..f7bad0c
--- /dev/null
+++ b/checkman/check_mk.only_from
@@ -0,0 +1,35 @@
+title: Check IP restriction of Check_MK agent
+agents: linux, windows
+author: Mathias Kettner <mk(a)mathias-kettner.de>
+license: GPL
+distribution: check_mk
+description:
+ This checks makes sure that the Check_MK agent on the target system
+ has configured certain IP address based access restrictions. The check
+ needs the agent to be configured with those restrictions. The windows
+ agent is configured via an {.ini}-file. The Linux agent is configured
+ via {/etc/xinetd.d/check_mk}.
+
+examples:
+ # Expect agent to accecpt only localhost and one specific network
+ check_mk_only_from_default = [ "192.168.56.0/30", "127.0.0.1" ]
+
+ # Hosts with the tag 'dmz' should have an different configuration
+ check_parameters += [
+ ( [ "10.0.0.0/8" ], [ "dmz" ], ALL_HOSTS, [ "Check_MK Agent Access" ] ),
+ ]
+
+inventory:
+ One check is created per host, if {check_mk_only_from_default} is explicitely
+ set in {main.mk} and the agent provides an {OnlyFrom:} header in the section
+ {<<<check_mk>>>}.
+
+[parameters]
+target_networks (list(string)): A python list of the allowed networks and IP addresses the
+ agent should be configured for. The order of the entries is not relevant. To host addresses
+ a {/32} will be appended automatically.
+
+[configuration]
+check_mk_only_from_default (list(string)): Default IP access configuration expected from agents.
+ This variable must be set in order for the inventory to create checks, even if you configure more
+ more specific parameters via {check_parameters}.
diff --git a/checks/check_mk b/checks/check_mk
new file mode 100644
index 0000000..86dd884
--- /dev/null
+++ b/checks/check_mk
@@ -0,0 +1,95 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2010 mk(a)mathias-kettner.de |
+# +------------------------------------------------------------------+
+#
+# This file is part of Check_MK.
+# The official homepage is at http://mathias-kettner.de/check_mk.
+#
+# check_mk is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation in version 2. check_mk is distributed
+# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
+# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU General Public License for more de-
+# ails. You should have received a copy of the GNU General Public
+# License along with GNU Make; see the file COPYING. If not, write
+# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+# Boston, MA 02110-1301 USA.
+# Target
+
+
+# Target value for agent's IP access configuration. Only if this
+# is not None, the inventory will create services
+check_mk_only_from_default = None
+
+def inventory_only_from(checkname, info):
+ if check_mk_only_from_default != None:
+ for line in info:
+ if line[0] == "OnlyFrom:":
+ return [(None, 'check_mk_only_from_default')]
+
+def check_mk_factorize_curly(n):
+ # factorize 10.0.0.{1,2,3}
+ if '{' in n:
+ result = []
+ iprange = n[n.find('{') + 1:n.find('}')].split(',')
+ prefix = n[:n.find('{')]
+ for suffix in iprange:
+ result.append(prefix + suffix)
+ return result
+ else:
+ return [n]
+
+def check_mk_normalize_network(n):
+ if '/' in n:
+ return n
+ else:
+ return n + "/32"
+
+
+def check_only_from(item, param, info):
+ if param == None:
+ return (1, "WARN - IP access restriction not monitored for this host")
+ for line in info:
+ if line[0] == "OnlyFrom:":
+ an = []
+ for n in line[1:]:
+ an += check_mk_factorize_curly(n)
+
+ allowed_nets = map(check_mk_normalize_network, an)
+ should_nets = map(check_mk_normalize_network, param)
+
+ too_much = []
+ too_few = []
+
+ for net in allowed_nets:
+ if net not in should_nets:
+ too_much.append(net)
+ for net in should_nets:
+ if net not in allowed_nets:
+ too_few.append(net)
+ status = 0
+ infotexts = []
+ if len(too_much) > 0:
+ status = 1
+ infotexts.append("agent allows extra: %s" % (" ".join(too_much)))
+ if len(too_few) > 0:
+ status = 1
+ infotexts.append("agent blocks: %s" % (" ".join(too_few)))
+ if status == 1:
+ return (1, "WARN - invalid access configuration: %s" % (", ".join(infotexts)))
+ else:
+ return (0, "OK - allowed IP ranges: %s" % (" ".join(allowed_nets)))
+ return (3, "UNKNOWN - Agent does not send OnlyFrom: header")
+
+
+check_info['check_mk.only_from'] = (check_only_from, "Check_MK Agent Access", 0, inventory_only_from)
+
diff --git a/multisite.mk b/multisite.mk
index 38780ba..52d4733 100644
--- a/multisite.mk
+++ b/multisite.mk
@@ -18,11 +18,12 @@ admin_users = [ "nagiosadmin" ]
# Sites to connect to. If this variable is unset, a single
# connection to the local host is done.
-#sites = {
-# # connect to local Nagios
-# "local" : {
-# "alias" : "Munich"
-# },
+sites = {
+ # connect to local Nagios
+ "wato" : {
+ "alias" : "Munich"
+ },
+}
#
# # connect to remote site (e.g. local OMD site 'paris')
# "paris": {
Module: check_mk
Branch: master
Commit: 7d5bce7b882b645985672131bc0a6bc6b35aebfd
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7d5bce7b882b64…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Dec 6 13:45:08 2010 +0100
fc_brocade_port_detailed: configure states for port states
---
ChangeLog | 2 ++
checkman/fc_brocade_port_detailed | 37 ++++++++++++++++++++++++++++++-------
checks/fc_brocade_port_detailed | 27 +++++++++++++++++++++------
3 files changed, 53 insertions(+), 13 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 3f4bee3..2360c70 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -53,6 +53,8 @@
per-host configuration
Checks & Agents:
+ * fc_brocade_port_detailed: allow to specify port state combinations not
+ to be critical
* megaraid_pdisks: Using the real enclosure number as check item now
* if/if64: Added expected interface speed to warning output
* if/if64: Allow to ignore speed setting (set target speed to None)
diff --git a/checkman/fc_brocade_port_detailed b/checkman/fc_brocade_port_detailed
index bc75a8b..c7a63ad 100644
--- a/checkman/fc_brocade_port_detailed
+++ b/checkman/fc_brocade_port_detailed
@@ -17,14 +17,26 @@ item:
examples:
# set levels for errors, not for in/out
fc_brocade_port_detailed_default_levels = (
- ( 1, 500 ), # warn at 1, crit at 500 CRC errors per check intervall
- ( 0.1, 10.0 ), # warn/crit if encout is more then 0.1 or 10% of packets
+ ( 1, 500 ), # warn at 1, crit at 500 CRC errors per check intervall
+ ( 0.1, 10.0 ), # warn/crit if encout is more then 0.1 or 10% of packets
( 101.0, 101.0 ) ) # do never alert C3 discards
# Same, but warning if traffic more than 160MB/s on in or out,
# no level for critical and assumed link baudrate of 2GBit/s
fc_brocade_port_detailed_default_levels = (
- (1, 500), (0.1, 10.0), (101.0, 101.0), (2, 160, None))
+ ( 1, 500),
+ ( 0.1, 10.0 ),
+ ( 101.0, 101.0 ),
+ ( 2, 160, None ) )
+
+ # Some, but additionally specify certain state-combinations to be
+ # only warning / not critical
+ fc_brocade_port_detailed_default_levels = (
+ ( 1, 500),
+ ( 0.1, 10.0 ),
+ ( 101.0, 101.0 ),
+ ( 2, 160, None, [(1,6,2), (1,4,2)]) )
+
perfdata:
Five variables: the number of bytes received and transmitted, and the number
@@ -43,15 +55,26 @@ crcerrors (number, number): A pair of levels for the CRC errors. If the level is
to the total number of packets received in the last check cycle.
encout (number, number): A pair of levels for the ENC out counter.
c3discards (number, number): A pair of levels for the C3 discards.
-inoutlevels (number, number, number): An optional triple used for
- checking in- and outgoing traffic. The first argument is the assumed link speed
- in GBit/sec. For inter switch links (ISL) the brocade MIB contains an
+inoutlevels (number, number, number, list): An optional quadruple used for
+ checking in- and outgoing traffic and the possible port states.
+ The first argument is the assumed link speed
+ in GBit/sec. For inter-switch links (ISL) the brocade MIB contains an
entry for the current speed - which is being used. If that is different
from the assumed link speed, then the levels are adapted accordingly.
If you set the assumed link speed to 2, the level to 160 and the detected
- link speed is 4GBit/s, then the level is being raised to 320. The other
+ link speed is 4GBit/s, then the level is being raised to 320. The next
two arguments are the levels for warning and critical in MB/s. Each of those may
be set to {None} in order to disable that level.
+ The forth argument is optional and is a list of triples. This list
+ makes selected port states not result in a critical but in a user
+ defined state. Each triple is consists of ({exitcode}, {physical state},
+ {opstate}). The possible exitcodes are {0} for OK, {1} for WARNING, {2} for
+ CRITICAL and {3} for UNKNOWN. The possible physical states are: {noCard(1)},
+ {noTransceiver(2)}, {laserFault(3)}, {noLight(4)}, {noSync(5)}, {inSync(6)},
+ {portFault(7)}, {diagFault(8)}, {lockRef(9)} The possible opstates are:
+ {online(1)}, {offline(2)}, {testing(3)}, {faulty(4)}. So if you want
+ {noLight/offline} to be OK and {inSync/testing} to be WARN, set the list to
+ {[(0,4,2),(1,6,3)]}.
[configuration]
fc_brocade_port_detailed_default_levels ( pair, pair, pair, triple ):
diff --git a/checks/fc_brocade_port_detailed b/checks/fc_brocade_port_detailed
index 5d38dad..dbbcb24 100644
--- a/checks/fc_brocade_port_detailed
+++ b/checks/fc_brocade_port_detailed
@@ -27,10 +27,12 @@
# targetstate is 1 (used) or 0 (unused)
# info columns: INDEX PHYSTATE OPSTATE TXWORDS RXWORDS
-brocade_pystate_names = ['', 'noCard', 'noTransceiver', 'laserFault', 'noLight', 'noSync', 'inSync', 'portFault', 'diagFault', 'lockRef']
-brocade_opstate_names = [ 'unknown', 'online', 'offline', 'testing', 'faulty']
+# 0 1 2 3 4 5 6 7 8 9
+brocade_phystate_names = [ '', 'noCard', 'noTransceiver', 'laserFault', 'noLight', 'noSync', 'inSync', 'portFault', 'diagFault', 'lockRef' ]
+# 0 1 2 3 4
+brocade_opstate_names = [ 'unknown', 'online', 'offline', 'testing', 'faulty' ]
-fc_brocade_port_detailed_default_levels = ( (1, 0.1), (1, 0.1), (1, 0.1), (2, 160, None) )
+fc_brocade_port_detailed_default_levels = ( (1, 0.1), (1, 0.1), (1, 0.1), (2, 160, None, []) )
def inventory_brocade_port(checkname, info):
porttable, isltable = info
@@ -62,6 +64,7 @@ def check_brocade_port(portno, params, info):
portinfo = [ line[1:] for line in porttable if int(line[0]) == int(portno) + 1 ]
if len(portinfo) < 1:
return (3, "UNKNOWN - No port number %d present" % int(portno))
+
phystate, opstate, txwords, rxwords, txframes, rxframes, crcerrors, encout, c3discards = map(int, portinfo[0])
baudrate = None
baudinfo = ""
@@ -75,8 +78,11 @@ def check_brocade_port(portno, params, info):
baudrate = 1.0 * (float(brmult) / 16)
baudinfo = ", ISL with baudrate: %gGBit/s" % (baudrate, )
+ special_states = []
if len(params) >= 4:
- assumed_baudrate, io_warn, io_crit = params[3]
+ assumed_baudrate, io_warn, io_crit = params[3][0:3]
+ if len(params[3]) >= 4:
+ special_states = params[3][3]
if not baudinfo:
baudinfo = ", assumed baudrate: %gGBit/s" % assumed_baudrate
@@ -101,9 +107,18 @@ def check_brocade_port(portno, params, info):
]
# First check if port has physical and logical link
- state = phystate,opstate
+ state = phystate, opstate
if state != (6,1):
- return (2, "CRIT - physical state %s, opstate %s" % (brocade_pystate_names[phystate], brocade_opstate_names[opstate]), perfdata)
+ # If port is in one of the states that are especially configured in the parameters,
+ # the exit could is set by the admin
+ nagioscode = 2
+ for ncode, phy, op in special_states:
+ if (phy,op) == (phystate, opstate):
+ nagioscode = ncode
+ break
+ return (nagioscode, "%s - physical state %s(%d), opstate %s(%d)" % (
+ nagios_state_names[nagioscode], brocade_phystate_names[phystate],
+ phystate, brocade_opstate_names[opstate], opstate), perfdata)
# Now check rates of various error counters
this_time = time.time()
Module: check_mk
Branch: master
Commit: 430f82564cb879b0cf259890d29b8c98bd07bb97
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=430f82564cb879…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Dec 6 15:50:53 2010 +0100
Updated changelog
---
ChangeLog | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 8b5309a..9afc410 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -93,7 +93,8 @@
* printer_supply: In case of OKI c5900 devices the name of the supply units ins not
unique. The color of the supply unit is reported in a dedicated OID and added to the
check item name to have a unique name now.
- * prnter_supply: Added simple pnp template to have better graph formating for the check results
+ * printer_supply: Added simple pnp template to have better graph formating for the check results
+ * snmp_info check: Recoded not to use snmp_info_single anymore
Multisite:
* The custom open/close states of custom links are now stored for each