What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

SSH Script Sensor ignores value and status change

Votes:

0

Hi,

I have the following Script in /var/prtg/scripts/mysqld_openfiles.sh to monitor the open files from the mysqld process.

#!/bin/bash


num_proc="$(lsof -p $(pidof mysqld) | wc -l)"

ret=0
retstring="mysqld open_files normal"

if (("$num_proc" > 300)); then
        ret=1
        retstring="Warning! mysqld open_files critical! $num_proc"
fi

if (("$num_proc" > 4000)); then
        ret=2
        retstring="Error! mysqld open_files too high! $num_proc"
fi


echo "$ret:$num_proc:$retstring"

which currently gives me the following output

# /var/prtg/scripts/mysqld_openfiles.sh 1:742:Warning! mysqld open_files critical! 742

However in PRTG the status is shown as green with message "mysqld open_files normal" and always value of 5. I already refreshed the script several times and also waited for 15 minutes to trigger a normal recheck but the status did not change.

Am I missing something?

By this KB question the Status should switch to yellow and value should be the 742.

Thanks for your help.

mysql openfiles ssh-script value

Created on Aug 22, 2016 8:24:41 AM



2 Replies

Accepted Answer

Votes:

0

Hi

found the problem. The script runs as a different user in our PRTG setup. This user needs the ability to start lsof with password less sudo.

Changed num_proc="$(lsof -p $(pidof mysqld) | wc -l)" to num_proc="$(sudo /usr/bin/lsof -p $(pidof mysqld) | wc -l)" and added the following line to etc/sudoers prtguser ALL= NOPASSWD: /usr/bin/lsof

Created on Aug 22, 2016 9:41:11 AM



Votes:

0

Thanks for sharing the solution, glad you found it out :)

Created on Aug 22, 2016 11:53:55 AM by  Stephan Linke [Paessler Support]




Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.