SNMP GET ISSUE

Aoutir, Nabil nabil.aoutir at dxc.com
Wed May 22 18:43:42 CEST 2019


Dear team,

I have two machines A and B, the A is snmp manager with centreon installed on it.

The B machine is the client machine that I need to monitor. In the client machine, i have a script that calculate the number of files on a specific directory ( the output of the script is a number). The path of this script has been added to the snmpd configuration file ( etc/snmp/snmpd.conf) on the client machine and generated an OID for this script.

what happens is that every 5 minutes, this script is requested remotly by centreon machine via snmp with this  command launched each 5 minutes from Centreon machine :
/usr/lib/nagios/plugins/check_snmp -H client_IP_Adress -C All -P 2c -o .1.3.6.1.4.1.8072.1.3.2.3.1.2.22.99.104.101.99.107.95.98.108.111.99.107.101.100.95.102.105.108.101.115.95.112.112 -w 1 -c 2

where -w is for warning if 1 files found  and -c for critical if 2  or mores files are found

This has been working really fine until now. The problem is that the script that counts the files takes sometimes more than 5 seconds because there is a lot of files to count, and what happens is that if the script doesn't give a result within 5 seconds, the command above get a timeout error.

I don't know where to change the timeout, so what i did is modifying the script that counts files, this modifications intend to stop the the command that counts files (inside the script)  if it takes more than 4 seconds

This is the previous version :
#!/bin/bash

if [[ "$1" = "PROD" ]]; then
        received="/mnt/sftpdata/vpod/repository/received/PROD"
else
        received="/mnt/sftpdata/vpodpp/repository/received/PRE"
fi
echo $(find $received \( -path /mnt/sftpdata/vpod/repository/received/$1/FHU2/v1app2omniaboprd \) -prune -o -type f -mmin +45 -print 2>&1 | wc -l)

And this the modified new version :

#! /bin/bash

if [[ "$1" = "PROD" ]]; then
        received="/mnt/sftpdata/vpod/repository/received/PROD"
else
        received="/mnt/sftpdata/vpodpp/repository/received/PRE"
fi

f=$(timeout 4 bash -c "find $received \( -path /mnt/sftpdata/vpod/repository/received/$1/FHU2/v1app2omniaboprd \) -prune -o -type f -mmin +45 -print 2>&1 | wc -l")

if [[ "${#f}" -eq 0 ]]
then
        echo '3'
else
        echo $f
fi


With the new version, normaly when i execute the check snmp command from centreon machine (/usr/lib/nagios/plugins/check_snmp -H client_IP_Adress -C All -P 2c -o .1.3.6.1.4.1.8072.1.3.2.3.1.2.22.99.104.101.99.107.95.98.108.111.99.107.101.100.95.102.105.108.101.115.95.112.112 -w 1 -c 2), i should have the number 3 as a resulat from the external script if the find doesn't answer within 4 seconds, but this is not the case, instead of having 3, i have this message : external command error timeout. and the snmp deamon is killed automaticaly oh the client machine ( inactive (dead)).

Can you please help me with this issue, im really blocked :/


DXC Technology Company -- This message is transmitted to you by or on behalf of DXC Technology Company or one of its affiliates. It is intended exclusively for the addressee. The substance of this message, along with any attachments, may contain proprietary, confidential or privileged information or information that is otherwise legally exempt from disclosure. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient of this message, you are not authorized to read, print, retain, copy or disseminate any part of this message. If you have received this message in error, please destroy and delete all copies and notify the sender by return e-mail. Regardless of content, this e-mail shall not operate to bind DXC Technology Company or any of its affiliates to any order or other contract unless pursuant to explicit written agreement or government initiative expressly permitting the use of e-mail for such purpose. --.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-plugins.org/archive/help/attachments/20190522/48bf4aac/attachment.html>


More information about the Help mailing list