Plugin Error 13: check_snmp_generic

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
wneville
Posts: 113
Joined: Wed Mar 31, 2021 3:35 pm

Plugin Error 13: check_snmp_generic

Post by wneville »

Hello,

I am getting an error ("Return code of 13 for service [servicename] on host [remotehost] was out of bounds" when trying to measure remote host TCP segment stats (error,sent,etc). Following other forum posts I made sure permissions were correct on the plugin.

From what I've read it seems like this is due to the fact that I originally ran the plugin at the command line to see if it would work, which created a tmp file under the user root instead of under the user nagios (user nagios needs to be able to edit the tmp file for the plugin to work?)

Is this as easy as deleting the tmp file and then running the command from the UI to create the tmp file under the user nagios? If so, where can I find this tmp file in order to remove it? I am looking all over for tmp files owned by root but can't find anything that seems related to my issue.

Thanks in advance!
gsmith
Posts: 1253
Joined: Tue Mar 02, 2021 11:15 am

Re: Plugin Error 13: check_snmp_generic

Post by gsmith »

HiI am trying to replicate this.

What is the command you ran from the command line as root?
If you can't remember run 'history'


Thanks
wneville
Posts: 113
Joined: Wed Mar 31, 2021 3:35 pm

Re: Plugin Error 13: check_snmp_generic

Post by wneville »

Here is the command:

./check_snmp_generic.pl -d "TCP segment error (in):" -l tcpcon -w 200 -c 250 -e 1.3.6.1.2.1.6.14.0 -H [HostAddress] -N "-c [string] -v 2c"

I was trying to follow the format from ./check_snmp_generic.pl --help

The command still seems to be working from the command line (as of this morning)

edit: added .pl to the plugin
gsmith
Posts: 1253
Joined: Tue Mar 02, 2021 11:15 am

Re: Plugin Error 13: check_snmp_generic

Post by gsmith »

Hi

I am not seeing a tmp file when I run the command as root or nagios.

If you are seeing one please send me a copy, and then go ahead and delete it and
try running the command from the command line again.

Also try running the command with the verbose option (-v):

Code: Select all

/usr/local/nagios/libexec/check_snmp_generic.pl -v -d "TCP segment error (in):" -l tcpcon -w 200 -c 250 -e 1.3.6.1.2.1.6.14.0 -H 192.168.23.82 -N "-c public -v 2c"

Thanks
wneville
Posts: 113
Joined: Wed Mar 31, 2021 3:35 pm

Re: Plugin Error 13: check_snmp_generic

Post by wneville »

Hmmm okay. Is Return Code 13 a permissions issue? Maybe I've been led astray by some other forum posts.

Here is the output from the command with verbose mode (I redacted the host name)

Code: Select all

Executing: snmpget -OqvU -c WinDowSR -v 2c -t2 -r0 [HostAddress] 1.3.6.1.2.1.6.14.0 2>&1
Got following Values:
288



$VAL_100/$CURRENT_REAL: 288/0
got param key/value: SNMP_[HostAddress]_TCP_segment_error_in__tcpcon_ 288
got tmp value: SNMP_[HostAddress]_TCP_segment_error_in__tcpcon_;280;1627497401
got tmp value: SNMP_[HostAddress]_TCP_segment_error_in__tcpcon_;288;1627561748
got tmp value: SNMP_127_0_0_1_TCP_segment_error_in__tcpcon_;230;1627497262
got tmp value: SNMP_[HostAddress]_SNMP_Errors_out__snmperrors_;0;1627066327
got tmp value: SNMP_[HostAddress]_TCP_segment_sent__tcpcon_;268198488;1627497542
diff_value/diff_sec: 0/89927
saving new value: SNMP_[HostAddress]_TCP_segment_error_in__tcpcon_;288;1627651675
OK - TCP segment error (in): 0 | tcpcon=0;200;250;;
I am still erroring from the UI.
gsmith
Posts: 1253
Joined: Tue Mar 02, 2021 11:15 am

Re: Plugin Error 13: check_snmp_generic

Post by gsmith »

Hi

As root user:

Code: Select all

cd /usr/local/nagios
chown -R apache:nagios libexec
chmod -R 755 libexec
Now test from the gui please.

Thanks
wneville
Posts: 113
Joined: Wed Mar 31, 2021 3:35 pm

Re: Plugin Error 13: check_snmp_generic

Post by wneville »

No luck with those changes. They did actually change the behavior of the Ping service, which is now giving this output:

"Warning: This plugin must be either run as root or setuid root."

Was the default owner:group combo for libexec root root?
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Plugin Error 13: check_snmp_generic

Post by ssax »

Please run these commands as root to fix the ping checks (check_dhcp would fail too):

Code: Select all

chown root.nagios /usr/local/nagios/libexec/check_dhcp
chmod 4775 /usr/local/nagios/libexec/check_dhcp
chown root.nagios /usr/local/nagios/libexec/check_icmp
chmod 4775 /usr/local/nagios/libexec/check_icmp
EDIT: I think you are right about permissions.

Try this:

Code: Select all

chown nagios.nagios /tmp/SNMP_MONITORING_VALUES_TMP.txt
chmod 664 /tmp/SNMP_MONITORING_VALUES_TMP.txt
Then run the check again.
wneville
Posts: 113
Joined: Wed Mar 31, 2021 3:35 pm

Re: Plugin Error 13: check_snmp_generic

Post by wneville »

Both the ping checks and the TCP checks are working at this point. Thanks so much for your help!
Locked