Page 1 of 2

Watch FTP and HTTP service

Posted: Thu Apr 14, 2011 9:19 am
by groyii
While I have been able to watch running processes I would also like to add a "heartbeat" check. I am having a problem setting this up. I am also currently looking this up on other forums but think this would be the best place to ask.

Thanks for your guidance.

Paul

Re: Watch FTP and HTTP service

Posted: Thu Apr 14, 2011 12:05 pm
by tonyyarusso
How exactly are you wanting to do this? If you just want to check that any port is open and responding you can use check_tcp. Many also have specific plugins, like check_http.

Re: Watch FTP and HTTP service

Posted: Thu Apr 14, 2011 8:51 pm
by groyii
Correct I have and FTP server running and I need to know when/if it fails. I don't allow anonymous logins so I need to have it check with a user name and password. Check TCP might work for what I want to do.

Re: Watch FTP and HTTP service

Posted: Fri Apr 15, 2011 2:53 pm
by groyii
I now have the check_ftp running and it is working great. I now have a question about check_http.

The application I need to watch receives http post data like this,
<mmRequest command="ping" client="NexusTest 1.0" userData="hello"/>

The reply is this,
<mmReply command="ping" userData="hello" status="ok"/>

How can I set this up with quotes all ready in the string?

Thanks

Paul

Re: Watch FTP and HTTP service

Posted: Tue Apr 19, 2011 9:45 am
by tonyyarusso
You would need to either quote the whole thing 'singly', or use \"backslashes\" to escape the quotes in your command_line for the service.

Re: Watch FTP and HTTP service

Posted: Fri Apr 22, 2011 9:40 am
by groyii
Thanks for the help.

the command definition is setup like this.

Code: Select all

# 'check_tcp' command definition
        define command{
        command_name    check_tcp
        command_line    $USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$
        }
My define servervice looks like this.

Code: Select all

define service{
        use                     generic-service
        host_name               NEXUS_SVR
        service_description     Nexus Responding
        check_command           check_TCP-p 8080 -s '<mmRequest command="ping" client="Nagios Server Check" userData="Nexus Server Alive"/>' -e '<mmReply command="ping" userData="Nexus Server Alive" status="ok"/>'
                    }
Once this is entered the check command is highlighted yellow and the equal sign after status is white and " "ok"/>' " is red. I did try the same line escaping the quotes but the same thing happens. When this runs i get the message "check_tcp: Port must be a positive integer ". I'm not sure what I am missing.

Thanks For your help.

Paul

Re: Watch FTP and HTTP service

Posted: Fri Apr 22, 2011 11:59 am
by rdedon
In the define service try adding a space:

Code: Select all

check_TCP-p 8080 
old

Code: Select all

check_TCP -p 8080 
new

Re: Watch FTP and HTTP service

Posted: Fri Apr 22, 2011 12:47 pm
by groyii
same thing, but I did find something. I broke down my check_command line. The problem happens when I use an "=" in the string. I tried to escape the "=" by using the back slash but that didn't work.

Thanks

Paul

Re: Watch FTP and HTTP service

Posted: Mon May 09, 2011 3:46 pm
by groyii
groyii wrote:same thing, but I did find something. I broke down my check_command line. The problem happens when I use an "=" in the string. I tried to escape the "=" by using the back slash but that didn't work.

Anyone have any thoughts on this?

Thanks

Paul

Re: Watch FTP and HTTP service

Posted: Tue May 10, 2011 3:45 pm
by tonyyarusso
I have no idea... With the single quotes around everything it should be fine. One thing you can do is trying running it directly on the command line (outside of Nagios) and see what happens.