Good morning friends!
I'm working on Nagios XI now! I'm new to the platform. I wanted to know how to implement the command syntax "check_netstat_conn" file "commands.cfg" the NagiosXI.
I need to check the number of connections in a HAproxy webservice per port. It's possible?
If another plugin, accept ideas from colleagues!
Thanks for listening!
Here's a quick script to accomplish your check. You'll need to execute it remotely using SSH or a remote agent client. You will need to modify this to your needs -
#!/bin/bash
#this plugin will check netstat (netstat -an|grep :80|wc -l) for a number and alert accordingly
#to the if statements below.
#OK is <80
#WARNING is 80-90
#CRITICAL is >90
#define file
count=$(/bin/netstat -an | grep :80 | wc -l)
#check $count value
if [ $count -lt 80 ]
then
state="OK"
elif [ $count -ge 80 ] && [ $count -lt 90 ]
then
state="WARNING"
elif [ $count -ge 90 ]
then
state="CRITICAL"
else
state="UNKNOWN"
fi
echo "$state: $count|count=$count"
rkennedy!
Thanks for the answer. But I need to know how to implement iso. I need to insert some syntax in commands.cgf file? Or can Execultar this script with SSH Proxy Service NagiosXI own?
Please find attached the image of the service provided by Nagios XI.
You do not have the required permissions to view the files attached to this post.
Then, create a bash script of the contents I wrote for you above, and in the wizard have it execute that script.
To help demonstrate how this will work -
XI will SSH on to your HA Proxy machine and run check_netstat_conn.sh for example, and then the output will be sent back to Nagios XI for your service check.
Rkennedy,
Good Morning,
realized step-by-step instructions that you gave me, I managed to connect to the remote server through the NagiosXI with nagios User. But when I check through command nagios, it's me the following message.
Also I had problem when the copy of the key with the command:
It looks like you still need to enter your password to SSH (which is what we want to eliminate). Can you check the permissions of the file that you copied over? It should be fine to copy it over using SCP.