I’d like to monitor for low bandwidth on my router, rather than the default high bandwidth.
Anyone know how I can change the check_local_mrtgtraf command so it alerts when the bandwidth falls below a given average please?
Thanks,
I’d like to monitor for low bandwidth on my router, rather than the default high bandwidth.
Anyone know how I can change the check_local_mrtgtraf command so it alerts when the bandwidth falls below a given average please?
Thanks,
You could try using ‘negate’…
[blockquote][root@localhost libexec]# ./negate --help
negate v1859 (nagios-plugins 1.4.11)
Copyright (c) 2002-2007 Nagios Plugin Development Team
[email protected]
Negates the status of a plugin (returns OK for CRITICAL and vice-versa).
Additional switches can be used to control which state becomes what.
Usage:negate -t timeout] -owcu STATE]
Options:
-h, --help
Print detailed help screen
-V, --version
Print version information
-t, --timeout=INTEGER
Seconds before connection times out (default: 9)
Keep timeout longer than the plugin timeout to retain CRITICAL status.
-o,–ok=STATUS
-w,–warning=STATUS
-c,–critical=STATUS
-u,–unknown=STATUS
STATUS can be ‘OK’, ‘WARNING’, ‘CRITICAL’ or ‘UNKNOWN’ without single
quotes. Numeric values are accepted. If nothing is specified, permutes
OK and CRITICAL.
Examples:
negate /usr/local/nagios/libexec/check_ping -H host
Run check_ping and invert result. Must use full path to plugin
negate -w OK -c UNKNOWN /usr/local/nagios/libexec/check_procs -a ‘vi negate.c’
This will return OK instead of WARNING and UNKNOWN instead of CRITICAL
Notes:
This plugin is a wrapper to take the output of another plugin and invert it.
The full path of the plugin must be provided.
If the wrapped plugin returns OK, the wrapper will return CRITICAL.
If the wrapped plugin returns CRITICAL, the wrapper will return OK.
Otherwise, the output state of the wrapped plugin is unchanged.
Send email to [email protected] if you have questions
regarding use of this software. To submit patches or suggest improvements,
send email to [email protected]
[root@localhost libexec]# [/blockquote]
hmm tried that but I seem to get the same output (ie negate isn’t negating). eg…
root@localhost:/usr/local/nagios/libexec# /usr/local/nagios/libexec/check_mrtgtraf -F /var/www/mrtg/192.168.1.1_3.log -a MAX -w 1000000,1000000 -c 10000000,10000000 -e 10
Traffic OK - Max. In = 3.5 KB/s, Max. Out = 3.3 KB/s|in=3.516602KB/s;1000000.000000;10000000.000000;0.000000 in=3.298828KB/s;1000000.000000;10000000.000000;0.000000
root@localhost:/usr/local/nagios/libexec# ./negate /usr/local/nagios/libexec/check_mrtgtraf -F /var/www/mrtg/192.168.1.1_3.log -a MAX -w 1000000,1000000 -c 10000000,10000000 -e 10
Traffic OK - Max. In = 3.5 KB/s, Max. Out = 3.3 KB/s|in=3.516602KB/s;1000000.000000;10000000.000000;0.000000 in=3.298828KB/s;1000000.000000;10000000.000000;0.000000
Can u see anything wrong with the command I’m trying to use please?
forget that - think I should be looking to do this in the commands file anyway. Let me try putting it in there
root@localhost:/usr/local/nagios/libexec# ./negate -s /usr/local/nagios/libexec/check_mrtgtraf -F /var/www/mrtg/192.168.1.1_3.log -a MAX -w 1000000,1000000 -c 10000000,10000000 -e 10
you need to specify the plugin to ‘negate’ with the -s flag
so yeah…
[blockquote]
[root@localhost libexec]# ./negate -s /bin/echo whatever
./negate: invalid option – s[/blockquote]
Regardless, negate won’t overwrite your plugin output, just invert the exit codes from 0 (OK) to 2 (Critical) and vice versa. You can see the exit code by executing echo $? after running the command… So it’ll never output Traffic Critical instead of Traffic OK …
[root@localhost libexec]# /bin/echo some_text
some_text
[root@localhost libexec]# echo $?
0
[root@localhost libexec]# ./negate /bin/echo some_text
some_text
[root@localhost libexec]# echo $?
2
[root@localhost libexec]#
Yep got it working exactly as I’d like, so thanks very much for the help.