z

Commercial Support Clients: Clients with support contracts can get escalated support assistance by visiting Nagios Answer Hub. These forums are for community support services. Although we at Nagios try our best to help out on the forums here, we always give priority support to our support clients.

Monitor a service running on a port other than 80 in Nagios

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.

Monitor a service running on a port other than 80 in Nagios

Postby BettyRNorahDeniels » Mon Jul 25, 2022 6:46 am

How do we monitor a remote service running on a machine using Nagios. I have created a cfg file as follows:

define command {
command_name check_http
command_line /usr/lib64/nagios/plugins/check_http -H $HOSTADDRESS$ -p 8082
}
Now when I reload the configuration file, it throws following error:

Warning: Duplicate definition found for command 'check_http' (config file '/etc/nagios/servers/cfbase-prod.cfg', starting on line 19)
Error: Could not add object property in file '/etc/nagios/servers/cfbase-prod.cfg' on line 20.
Error processing object config omegle.2yu.co files!
I am not able to figure out omeglz echat what is the problem. Please help!
Last edited by BettyRNorahDeniels on Mon Aug 29, 2022 6:59 am, edited 1 time in total.
BettyRNorahDeniels
 
Posts: 10
Joined: Tue Feb 15, 2022 7:13 am

Re: Monitor a service running on a port other than 80 in Nag

Postby gormank » Mon Jul 25, 2022 5:18 pm

Warning: Duplicate definition found

You're redefining check_http so it gives an error. Use a new name.
gormank
 
Posts: 1081
Joined: Tue Dec 02, 2014 12:00 pm

Re: Monitor a service running on a port other than 80 in Nag

Postby gormank » Mon Jul 25, 2022 5:25 pm

Sorry,
I should have said create a service that uses the check_http command, not create a new command.
gormank
 
Posts: 1081
Joined: Tue Dec 02, 2014 12:00 pm

Re: Monitor a service running on a port other than 80 in Nag

Postby JernalinSadhoo » Fri Jul 29, 2022 7:29 am

You can specify the port number directly in the command but you will must create one command per tested port.

Or you can create a custom variable to store the port number , with your example:

define host {
use linux-server
host_name cfbase-prod
alias cfbase-prod
address x.x.x.x
contacts admin
}

define service {
use generic-service
host_name cfbase-prod
service_description HTTP
check_command check_http
contacts admin
check_interval 1
_port_number 8083
}
And on your command you can inherite of this variable like this :

define command{
command_name check_http
command_line $USER1$/check_http -I $HOSTADDRESS$ -p $_SERVICEport_number$ $ARG1$
}
You must prepend _service for a service or _host for a host to use your echatspin echatrandom variable in a command.
JernalinSadhoo
 
Posts: 5
Joined: Sat May 21, 2022 7:53 am


Return to Open Source Nagios Projects

Who is online

Users browsing this forum: Google [Bot] and 9 guests