I use Chek MK and would like to run a check on device that supports only telnet protocol. Im new at writing this so would appriciate any help.
Basicly its like this: I log in via telnet to IP / Port (no username and password) and then issue a command: "get pw"
I get 3 lines response (first repeat of command, than one empty and in 3rd line actual value: So output for instance is:
"get pw
600W"
I would like to extract only integer 600 from this output and then based on the specified limits (for instance < 100 is warning, < 50W is critical) combine it to output that checkmk agent would understand.
For instance:
0 power=600 OK: All looking fine
...or:
1 power=90 Warning: Power low
2 power=20 Critical: Power critical
(I already checked this: Telnet based check_mk checks SO I understand that I could do this via script that would get executed on a host with checkmk agent installed. But I would need some extra help to connect everything togehter. :))
Scripting language can be anything that runs on linux (already tried bash, or expect or python...) Here for isntance is part of teh script that gets me output:
spawn telnet host port set timeout 1 send "get pw\r" expect "$ " send "exit\r"
Thanks for your help in advance and br, David