Give executable permission and disable the firewall & SElinux temporary In our case we select port 80 as we need to monitor web service on target Linux machine. Now modify "Port" as per your process requirement. Suppose we made a file httpd.sh so its like /var/prtg/scripts/httpd.sh. Copy the script mentioned in first response under below linkĪnd paste in to a file with your preferred name. On target machines where you want to monitor the Linux script. I am able to use this script to monitor Redhat Linux process. OpenPorts=$($NETSTAT -tulpn | grep -vE '^Active|Proto' | grep 'LISTEN' | awk '' | sed '/^$/d' | sort -u)Įcho "0:200:$service is running." # returncode 0 = put sensor in OK statusĮcho "1:404:$service is not running." # returncode 1 = put sensor in WARNING status #!/bin/bashĮcho "4:500:You have to be root to run $0." # returncode 4 = put sensor in DOWN statusĮcho "2:500:id not found." # returncode = 2 = put sensor in DOWN status This example script will run on the target host and check if a service on a specific port is running. Protocol Error (for example a web server returns a 404)Ĭontent Error (for example a web page does not contain a required word) System Error (for example a network/socket error) The SSH script's "returncode" has to be one of the following values: Value Value must be a 64-bit integer or float and will be used as the resulting value for this sensor (for example bytes, milliseconds, etc.), message can be any string and will be stored in the database. The returned data for standard SSH Script sensors must be in the following format: The expected return format for the scripts used with the SSH Script sensor is documented in the PRTG Manual: Application Programming Interface (API) Definition. This article applies as of PRTG 22 SSH Script sensor
0 Comments
Leave a Reply. |