Monitor THANKS telnet response of web server

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
rferebee
Posts: 733
Joined: Wed Jul 11, 2018 11:37 am

Monitor THANKS telnet response of web server

Post 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.
User avatar
jdunitz
Posts: 235
Joined: Wed Feb 05, 2020 2:50 pm

Re: Monitor THANKS telnet response of web server

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
rferebee
Posts: 733
Joined: Wed Jul 11, 2018 11:37 am

Re: Monitor THANKS telnet response of web server

Post 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!
User avatar
jdunitz
Posts: 235
Joined: Wed Feb 05, 2020 2:50 pm

Re: Monitor THANKS telnet response of web server

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
rferebee
Posts: 733
Joined: Wed Jul 11, 2018 11:37 am

Re: Monitor THANKS telnet response of web server

Post 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.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Monitor THANKS telnet response of web server

Post by scottwilkerson »

That's not a blank response, you have an unterminated quote since you didn't wrap the response in double quotes

change

Code: Select all

You're welcome!
to

Code: Select all

"You're welcome!"
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
rferebee
Posts: 733
Joined: Wed Jul 11, 2018 11:37 am

Re: Monitor THANKS telnet response of web server

Post 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?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Monitor THANKS telnet response of web server

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
rferebee
Posts: 733
Joined: Wed Jul 11, 2018 11:37 am

Re: Monitor THANKS telnet response of web server

Post by rferebee »

Yes, the error is CRITICAL - Socket timeout.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Monitor THANKS telnet response of web server

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked