Monat: Januar 2018
Kleines Expect-Script für alte Cisco Switches un err-disabled
Expect-Script
#!/usr/bin/expect
set host [lindex $argv 0]
spawn telnet $host
expect „Password:“
send „YourPassword\n“
log_file ./err-status-$host.log
send „term len 0\n“
send „show int status err-disabled\n“
expect „end\r“
send „\n“
send „exit\n“
log_file
Bash-Wrapper
cat check-state.sh
/usr/bin/expect ./check-state.expect 1.2.3.4
sleep 2
/usr/bin/expect ./check-state.expect 1.2.3.5
sleep 2
check_mk Powershell KV-Safenet Status eines Routers abfragen – KAMP-Safebox
#0=ok; 1=warn; 2=crit
$OK = 0
$Warning = 1
$Critical = 2
c:\skript\curl.exe -s -k https://your-safebox.address:8443/netaccess/connstatus.html > C:\Skript\kv-safenet-state.log
if (Select-String -Quiet -Path c:\skript\kv-safenet-state.log -Pattern „You are logged in.“) {
$status = $OK
$statustext = „OK“
$detail = „KV-Safenet Verbindnung OK“
}
else {
$status = $CRITICAL
$statustext = „CRITICAL“
$detail = „KV-Safenet Verbindnung CRITICAL“
}
Write-Host „$status KV-Safenet – $($statustext) – $detail“