0

I want to implement a check which is telnet based. In every 5 minutes check telnets a network device and run some command on it and get the output.

Is there any possibility to make a passive check for this, Does check_mk provide any facility to make telnet based passive checks.

AngocA
  • 7,655
  • 6
  • 39
  • 55
nitin
  • 49
  • 1
  • 8

2 Answers2

0

I'm just getting going with Check_MK, but I think if you can write a script to do whatever your check requires, then check_mk can monitor it.

Your script just needs to write something like this to STDOUT:

0 my_telnet_test time=0.1 OK: All looking fine

...or:

2 my_telnet_test time=0.7 Critical: Device said "foo", but I'm expecting "baa"

The STDOUT format is described in detail here: http://mathias-kettner.com/checkmk_localchecks.html

Once you've got your script working, if you can run it without arguments, you can just drop it into /usr/local/check_mk_agent/local on the machine that you'd like to run the check, and then run an inventory on the check_mk server. It'll pick up the change, and run the script for you.

Ralph Bolton
  • 774
  • 7
  • 14
0

for the telnet part you should take a look at

Creating a script for a Telnet session?

for the Check_MK part I want to add: to accomplish the requirment to run the script every 5 minutes you can create a folder insider the Check_MK local plugin directory (/usr/lib/check_mk_agent/local/) named with the time in seconds as name. Check_MK will for example run every script inside /usr/lib/check_mk_agent/local/300/ every 300 seconds and hold the previous check result in cache for the agent.

https://mathias-kettner.de/checkmk_localchecks.html

Sometimes a script will run for longer than a few seconds. If the run time of all script and plugins of an agent exceed the timeout for active checks of the monitoring core (usually 60 or 120 seconds), then the complete check will be aborted. In order to avoid this you can have local checks be run asynchronously and use cache files. This is done by putting your script into a subdirectory that is named by a number - the number of seconds that >the output of the script is valid:

/usr/lib/check_mk_agent/local/300/myscript

In this case the agent will:

Run this script in the background and wait not for it to finish. Store the result of the script in a cache file below /etc/check_mk/cache. Use that file for 300 seconds before running the script again.

Community
  • 1
  • 1
Henrik Pingel
  • 3,083
  • 1
  • 19
  • 27