Commit ed63fa91403589be54ae0c0ab8cb874abb4f5441
1 parent
cca2113d
Added check_multiple_host_addresses as I stil had that laying around somewhere
Showing
2 changed files
with
65 additions
and
3 deletions
README.md
... | ... | @@ -26,14 +26,48 @@ is indifferent of which version of procps (to date) is used. No other changes |
26 | 26 | were made to the script. |
27 | 27 | |
28 | 28 | |
29 | +plugins/plugins/check_multiple_host_addresses | |
30 | +--------------------------------------------- | |
31 | +This script is a first attempt to monitor multi-home and dual-stack (i.e. ipv4 | |
32 | +and ipv6) servers. In my setup a server should only considered availble if it is | |
33 | +available on all of its primary addresses (i.e. both ipv4 and ipv6). It uses the | |
34 | +excellent check_multi script to perform multiple a ping check to see if a host | |
35 | +is available and reports the consolidated status. Using check_multi has the | |
36 | +advantage that pnp4nagios and other scripting graphing solutions will support | |
37 | +this solution as well. | |
38 | + | |
39 | +Installation is straightforward, after installing the script on your server, add | |
40 | +the following to your `commands.cmd` configuration file to make it available: | |
41 | +~~~ | |
42 | + # 'check-host-alive' command definition for multi-homed/dual-stack servers | |
43 | + define command{ | |
44 | + command_name check-addresses-alive | |
45 | + command_line [install_path]/plugins/check_multiplehost_addresses '$HOSTADDRESS$' '$_HOSTADDRESS6$' | |
46 | + } | |
47 | +~~~ | |
48 | +The example above assumes that the IPv6 address of the host is provided as part | |
49 | +of the host configuration, i.e.: | |
50 | +~~~ | |
51 | + define host { | |
52 | + ... | |
53 | + address 192.168.0.1 | |
54 | + _address6 fdf8:f340:ab9d:c213::1 | |
55 | + ... | |
56 | + } | |
57 | +~~~ | |
58 | +To use the script either add ` check_command check-addresses-alive` | |
59 | +to the specific hosts that should use the check or to the generic host used as | |
60 | +template. | |
61 | + | |
62 | + | |
29 | 63 | cgi-bin/nagiosstatus.sh |
30 | 64 | ----------------------- |
31 | 65 | Very simplistic CGI-BIN script that checkes whether nagios is still running and |
32 | 66 | still updating its status. It wil always return an HTTP Status 200 (OK) and a |
33 | 67 | simple text page with one of the following texts: |
34 | - - STOPPED - in case the nagios process is not running | |
35 | - - STALLED - in case the nagios status file has not been updated for 5 minutes | |
36 | - - OK - when Nagios is running and updated its status file < 5 minutes ago | |
68 | + - `STOPPED` - in case the nagios process is not running | |
69 | + - `STALLED` - in case the nagios status file has not been updated for 5 minutes | |
70 | + - `OK` - when Nagios is running and updated its status file < 5 minutes ago | |
37 | 71 | |
38 | 72 | I wrote this script to be used with an external monitoring system, I use it with |
39 | 73 | the free subscription from [Pingdom](http://www.pingdom.com) to get alerts when |
... | ... |
plugins/check_multiple_host_addresses
0 → 100755
1 | +#!/bin/bash | |
2 | + | |
3 | +# check_multiple_host_addresses - first attempt to implement a host check for | |
4 | +# multi-homed/dual-stack servers | |
5 | +# | |
6 | +# Version 1.0, latest version, documentation and bugtracker available at: | |
7 | +# https://gitlab.lindenaar.net/scripts/nagios-plugins | |
8 | +# | |
9 | +# Copyright (c) 2015 Frederik Lindenaar | |
10 | +# | |
11 | +# This script is free software: you can redistribute and/or modify it under the | |
12 | +# terms of version 3 of the GNU General Public License as published by the Free | |
13 | +# Software Foundation, or (at your option) any later version of the license. | |
14 | +# | |
15 | +# This script is distributed in the hope that it will be useful but WITHOUT ANY | |
16 | +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |
17 | +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |
18 | +# | |
19 | +# You should have received a copy of the GNU General Public License along with | |
20 | +# this program. If not, visit <http://www.gnu.org/licenses/> to download it. | |
21 | + | |
22 | +# Usage: check_host_addresses addr1 addr2 addr3 | |
23 | + | |
24 | +(for addr in $* | |
25 | +do | |
26 | + echo command[$addr]=/usr/lib/nagios/plugins/check_ping -H $addr -w 5000,100% -c 5000,100% -p 1 | |
27 | +done ) | /usr/lib/nagios/plugins/check_multi -f - -n check_ping | |
28 | + | |
... | ... |