Check_connections
-
ednaldojta
- Posts: 103
- Joined: Tue Apr 07, 2015 7:52 am
Check_connections
Friends,
They've helped me a lot in the Post concerning check_by_ssh, however now I need a way to monitor the number of connections per port on servers.
And I need it with some plugin because the SSH is a bit complicated for commercial reasons. The servers to be monitored are from another company, and so I can not create an account to access via SSH, for security reasons.
For this need, through a plugin to bring number of connections per port.
I saw check_connections.sh the Nagios Exchange, but did not know how to set up the syntax in commands.cfg file Nagios.
What can help me thank you.
They've helped me a lot in the Post concerning check_by_ssh, however now I need a way to monitor the number of connections per port on servers.
And I need it with some plugin because the SSH is a bit complicated for commercial reasons. The servers to be monitored are from another company, and so I can not create an account to access via SSH, for security reasons.
For this need, through a plugin to bring number of connections per port.
I saw check_connections.sh the Nagios Exchange, but did not know how to set up the syntax in commands.cfg file Nagios.
What can help me thank you.
Re: Check_connections
Your previous thread about the check_netstat_conn (https://support.nagios.com/forum/viewto ... 67#p177367) should work fine for this, if you don't want to use the SSH route, you can always take a look at executing the script through NRPE.
Former Nagios Employee
-
ednaldojta
- Posts: 103
- Joined: Tue Apr 07, 2015 7:52 am
Re: Check_connections
configuring check_netstat_conn
because you need a syntax in commmands.cfg file.
because you need a syntax in commmands.cfg file.
-
ednaldojta
- Posts: 103
- Joined: Tue Apr 07, 2015 7:52 am
Re: Check_connections
So I can install a plugin, I must first configure commands.cfg, correct file?
Yeah, I installed the plugin, however when I run the plugin appears that critique.
Yeah, I installed the plugin, however when I run the plugin appears that critique.
You do not have the required permissions to view the files attached to this post.
Re: Check_connections
I haven't used this plugin, but it seems to me that it could be only used locally, for example:
I don't believe you will be able to check a remote server, unless you run it locally (on the remote server), and call it from XI via check_nrpe.
Code: Select all
/usr/local/nagios/libexec/check_netstat_conn -p <port>Be sure to check out our Knowledgebase for helpful articles and solutions!
-
ednaldojta
- Posts: 103
- Joined: Tue Apr 07, 2015 7:52 am
Re: Check_connections
there was a critical implementation.
You do not have the required permissions to view the files attached to this post.
-
ednaldojta
- Posts: 103
- Joined: Tue Apr 07, 2015 7:52 am
Re: Check_connections
is the Nagios Plugin itself that is on the Nagios Exchange page.
Code: Select all
#!/bin/sh
#
# check_netstat_conn - Check listening ports using netstat utility
#
# Author: Aaron Eidt ([email protected])
#
STATE_OK=0
STATE_WARNING=1
STATE_CRITICAL=2
STATE_UNKNOWN=3
STATE_DEPENDENT=4
PROGRAM="check_netstat_conn"
usage () {
printf "\n%s - Check port using netstat utility\n" $0
printf "$Id: $PROGRAM 1 2013-07-08 $"
printf "\nUsage: %s: -p\n\n" $0
}
port=
while getopts p: o
do
case $o in
p)
port="$OPTARG"
;;
?)
usage
exit ${STATE_UNKNOWN}
;;
esac
done
if [ x$port = x ]; then
usage
exit ${STATE_UNKNOWN}
fi
$ENV{PATH}=$ENV{PATH}:/usr/local/nagios/libexec/
NETSTAT=`which netstat`
if [ ! -e $NETSTAT ]; then
echo "CANNOT FIND NETSTAT!"
exit ${STATE_UNKNOWN}
fi
result=`$NETSTAT -an | grep :$port`
num_conn=`echo $result | wc -l`
if [ `echo $result | egrep -c 'LISTEN|ESTABLISHED'` -gt 1 ]; then
echo "OK: There are $num_conn established or listening connections on port $port"
exit ${STATE_OK}
fi
echo "CRITICAL: There are NO established or listening connections on port $port"
exit ${STATE_CRITICAL}
Last edited by tmcdonald on Thu Mar 31, 2016 1:29 pm, edited 1 time in total.
Reason: Please use [code][/code] tags around long output
Reason: Please use [code][/code] tags around long output
Re: Check_connections
Try changing line 43 from
$ENV{PATH}=$ENV{PATH}:/usr/local/nagios/libexec/
to
PATH=$PATH:/usr/local/nagios/libexec/
then re-run it.
$ENV{PATH}=$ENV{PATH}:/usr/local/nagios/libexec/
to
PATH=$PATH:/usr/local/nagios/libexec/
then re-run it.
Former Nagios employee