Wed May 22 19:21:54 CEST 2019

check_snmp has wealth of options, including a timeout option.
You can explore them by taking a look at the output from "check_snmp -help."

Andrew Ford
Information Security Engineer - Network Security Solutions & Design
Tel: 314-348-4937 | Email: at< at>

From: Help < at> On Behalf Of Aoutir, Nabil
Sent: Wednesday, May 22, 2019 11:44 AM
To: help at

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 . -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 :

if [[ "$1" = "PROD" ]]; then
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

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 ]]
        echo '3'
        echo $f

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 . -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: <>

More information about the Help mailing list