Page 1 of 3
UDP port for monitor
Posted: Tue Sep 25, 2018 10:02 am
by Vigneshwar.A
Hello Team,
I need to monitor UDP port 1162 in nagios, so for that am using the below script,
https://exchange.nagios.org/directory/P ... rt/details
when i tried in nagios server putty session its giving an output stating that its working fine but when i configured the same in GUI its giving critical, so kindly help us to resolve the issue. PFA info
Putty Output:
[root@xxxxx libexec]# /usr/local/nagios/libexec/check_udp_port -H xxxxx -p 1162 -s "health-trap"
OK: health-trap listening on port 1162: 1162/udp open|filtered health-trap
Nagios Command:
$USER1$/check_udp_port -H $HOSTADDRESS$ -p $ARG1$ -s $ARG2$
Nagios Version: 5.4.12
OS: Red Hat Enterprise Linux Server release 7.3
Re: UDP port for monitor
Posted: Tue Sep 25, 2018 2:21 pm
by npolovenko
Hello,
@Vigneshwar.A. You need to add the following line to the /etc/sudoers:
NAGIOSXI ALL = NOPASSWD:/usr/local/nagios/libexec/check_udp_port *
And the command definition should be:
sudo $USER1$/check_udp_port -H $HOSTNAME$ -p $ARG1$ -s $ARG2$
Re: UDP port for monitor
Posted: Wed Sep 26, 2018 1:24 pm
by Vigneshwar.A
Hello,
As per your concern i have made entries in /etc/sudoers file and command has been created.
When we checked in nagios CCM back-end the UDP Port service by giving run check command its working but in front end its still showing critical alert. PFB SS
Re: UDP port for monitor
Posted: Wed Sep 26, 2018 2:10 pm
by npolovenko
@Vigneshwar.A, What are the permissions on the plugin?
ls -l /usr/local/nagios/libexec/check_udp_port
Please sign in to the console as the nagios user, run the plugin and show me the output.
su - nagios
/usr/local/nagios/etc/libexec/check_udp_port -H replace_with_ip_address -p 1162 -s "health-trap"
Re: UDP port for monitor
Posted: Thu Sep 27, 2018 5:44 am
by Vigneshwar.A
Hi Npolovenko,
check_udp_port plugin has 777 permission to execute. PFB output
[root@xxxxxxxxx libexec]# ls -ltr|grep -i check_udp_port
-rwxrwxrwx. 1 root nagios 1615 Sep 25 12:27 check_udp_port
---------------------
Nagios user output:
[nagios@xxxxxxxx ~]$ ls -ltr /usr/local/nagios/libexec/check_udp_port
-rwxrwxrwx. 1 root nagios 1615 Sep 25 12:27 /usr/local/nagios/libexec/check_udp_port
[nagios@xxxxxxxx libexec]$ ./check_udp_port -H xxxxxxxxxxx -p 1162 -s "health-trap"
You requested a scan type which requires root privileges.
QUITTING!
CRITICAL:
[nagios@xxxxxxx libexec]$
Re: UDP port for monitor
Posted: Thu Sep 27, 2018 10:49 am
by npolovenko
@Vigneshwar.A, What about running the command with sudo as the nagios user?
[nagios@xxxxxxxx libexec]$ sudo /usr/local/nagios/check_udp_port -H xxxxxxxxxxx -p 1162 -s "health-trap"
Re: UDP port for monitor
Posted: Thu Sep 27, 2018 11:27 am
by Vigneshwar.A
Hi,
PFB output for the command.
[nagios@XXXXX ~]$ sudo /usr/local/nagios/libexec/check_udp_port -H XXXXXX -p 1162 -s "health-trap"
OK: health-trap listening on port 1162: 1162/udp open|filtered health-trap
[nagios@XXXXX ~]$
Re: UDP port for monitor
Posted: Thu Sep 27, 2018 12:08 pm
by lmiltchev
It seems like now you can run the plugin as nagios user, so the check should also work for you in the GUI. Let us know if your issue has been resolved.
Re: UDP port for monitor
Posted: Thu Sep 27, 2018 1:14 pm
by Vigneshwar.A
lmiltchev wrote:It seems like now you can run the plugin as nagios user, so the check should also work for you in the GUI. Let us know if your issue has been resolved.
Still am facing same issue, backend CCM UDP Port service is working but in frontend GUI still its showing CRITICAL
PFA SS
Re: UDP port for monitor
Posted: Thu Sep 27, 2018 1:37 pm
by lmiltchev
Have you applied configuration after making the changes to your configs, e.g. adding sudo to the "check_udp_port" command? Try going to the CCM > Tools > Config File Management > Delete Files > Write Configs > Verify Files > Apply Configuration (in this exact order).
Another reason for the issue could be multiple nagios processes running on this machine. Perhaps, there is an old nagios process running that is "stuck" and it's still reporting "Critical".
To check for multiple instances of nagios, run:
Code: Select all
ps -ef | head -1 && ps -ef | grep bin/nagios
To kill the process run:
Code: Select all
service nagios stop
killall nagios
service nagios start