How to configure Host state ok if a host is offline

(michaelh) #1

Hello,

how can I configure a state of OK if an host is offline and critical if a host is online?
(no - its not for the Boss-PC)

best regards
Michael

#2

Do you mean if the Host is offline or is Critical you want show OK ?

(michaelh) #3

Host Offline: OK - Online: critical and/or warning

#4

Offline to OK, you can use
Host check Command rule to be Always UP/OK

I don’t now if there is a rule where you can change the Host stat to warn or critical if it’s ok

(Daniel) #5

I also had this issue once. I created a local script on another machine which checks the ping of the machine and adds it as piggyback information. It looks something like this:

#!/bin/bash
ping -c 2 someipaddress > /dev/null 2>&1
if [ $? -ne 0 ]; then
test=1
pingable=0
else
test=0
pingable=1
fi

echo “<<<<‘hostname’>>>>” (without quotes)
echo “<<<‘local’>>>” (without quotes)

if [ “$test” -ne “0” ]; then
echo “0 Ping_negate ping=”$pingable" OK Host is not reachable!"
else
echo “2 Ping_negate ping=”$pingable" CRIT Host is reachable!"
fi

echo “<<<<>>>>”

Not really nice but did what I needed.

Than you make a rule “host check command - use service instead” and use the new service (Ping_negate in my case) for the host and configure the host without an agent.

Hope this helps.

1 Like
#6

@Dani good one :wink: I like it :smiley:

(michaelh) #7

Thank you Daniel! I will try your Solution and hope a further update of check_mk make this possible
best regards
michael