Page 1 of 2
Monitor THANKS telnet response of web server
Posted: Sat Mar 21, 2020 2:27 pm
by rferebee
Hello,
I need some help figuring out how we would monitor the response to a telnet THANKS command. See details below:
If our mail and web servers are both responding, we still need to know if the LISTSERV application is responding. We can check that with a connection to port 2306 and a simple THANKS command:
-> telnet listserv.org 2306
Trying 167.154.x.x...
Connected to listserv.org.
Escape character is '^]'.
thanks
You're welcome!
quit
Connection closed by foreign host.
Would it be possible to create a check that does this? Thank you.
Re: Monitor THANKS telnet response of web server
Posted: Mon Mar 23, 2020 8:07 am
by jdunitz
Looks like this might be just the thing:
https://exchange.nagios.org/directory/P ... et/details
Let us know if that works for you!
--Jeffrey
Re: Monitor THANKS telnet response of web server
Posted: Wed May 13, 2020 9:20 am
by rferebee
Is there anyway someone could help me figure out how to write the command for this check_telnet plugin?
It doesn't have a help section written into it.
I just need to be able to send a statement (like THANKS) and check for a response "YOU'RE WELCOME". I'm not sure where to even start.
Thank you!
Re: Monitor THANKS telnet response of web server
Posted: Wed May 13, 2020 4:57 pm
by jdunitz
I think I found a better solution: the check_tcp plugin, which lets you specify a thing to say and an thing to expect to receive, just like you want.
Code: Select all
[root@jpd-nagiosxi-one libexec]# ./check_tcp -H localhost -p 25 -s "helo localhost" -e 220
TCP OK - 0.001 second response time on localhost port 25 [220 jpd-nagiosxi-one.localdomain ESMTP Postfix]|time=0.000897s;;;0.000000;10.000000
So for you, you'd want to do:
Code: Select all
./check_tcp -H listserv.org -p 2306 -s thanks -e YOU
...or whatever the case of the "You're welcome" response is.
Sorry for the misstep--let me know if this one is better!
--Jeffrey
Re: Monitor THANKS telnet response of web server
Posted: Thu May 14, 2020 2:07 pm
by rferebee
Do I need to include any quotations or any other characters in the send string and the expect string? I'm getting a timeout when I run this.
I have verified that I can run telnet on port 2306 from the XI server to the host in question. Furthermore, I'm able to send 'thanks' and receive 'You're welcome!' back.
When I try to run check_tcp from my XI server with the variables I think are correct all I get is a blank line response.
See attached image.
Re: Monitor THANKS telnet response of web server
Posted: Fri May 15, 2020 7:27 am
by scottwilkerson
That's not a blank response, you have an unterminated quote since you didn't wrap the response in double quotes
change
to
Re: Monitor THANKS telnet response of web server
Posted: Fri May 15, 2020 9:45 am
by rferebee
Ok, when I do that it times out.
Also, XI keeps adding a a backslash between the e and the !, like this "You're welcome\!". Is that normal/expected?
Re: Monitor THANKS telnet response of web server
Posted: Fri May 15, 2020 2:16 pm
by scottwilkerson
rferebee wrote:Ok, when I do that it times out.
Does it timeout from the command line?
rferebee wrote:Also, XI keeps adding a a backslash between the e and the !, like this "You're welcome\!". Is that normal/expected?
All ! must be escaped because the Nagios Core configuration uses it as a delimiter to separate commands from arguments
Re: Monitor THANKS telnet response of web server
Posted: Fri May 15, 2020 3:05 pm
by rferebee
Yes, the error is CRITICAL - Socket timeout.
Re: Monitor THANKS telnet response of web server
Posted: Fri May 15, 2020 4:09 pm
by scottwilkerson
Just curious, do you get a valid result when just checking the port without the send/expect strings?
Code: Select all
./check_tcp -H 167.154.10.63 -p 2306