Page 1 of 1
check_snmp remove leading 'SNMP' from alert
Posted: Mon Jul 10, 2017 4:18 pm
by snapon_admin
This may seem minor, but is there an easy way to remove the leading SNMP from check_snmp alerts. Currently an alert will look like this:
I'd like to remove the SNMP part of that as it's unnecessary for us so that it just says:
Re: check_snmp remove leading 'SNMP' from alert
Posted: Tue Jul 11, 2017 8:42 am
by mcapra
I think you'd have to change this line, then recompile the plugin:
https://github.com/nagios-plugins/nagio ... nmp.c#L225
Code: Select all
[root@nagios ~]# /usr/local/nagios/libexec/check_snmp -H 127.0.0.1 -P 2c -C 209ijvfwer0df92jd -o 1.3.6.1.2.1.25.3.3.1
SNMP OK - No Such Object available on this agent at this OID |
Then after changing the line and recompiling:
Code: Select all
# check_snmp.c #L225
label = strdup ("");
...
[root@nagios ~]# /usr/local/nagios/libexec/check_snmp -H 127.0.0.1 -P 2c -C 209ijvfwer0df92jd -o 1.3.6.1.2.1.25.3.3.1
OK - No Such Object available on this agent at this OID |
Those changes *might* not persist through regular updates to Nagios XI, though. You could also write a wrapper script to
sed
or
awk away the "SNMP", though it'd be a bit more work and you need to be mindful of preserving the Unix exit code when doing that.
Re: check_snmp remove leading 'SNMP' from alert
Posted: Tue Jul 11, 2017 9:27 am
by tgriep
Thanks
@mcapra for the help.
@snapon_admin, it you have any other questions, let us know.