Category: nagios
Downloaded: 1057


Nagios Plugin to check Things and Items from an Openhab Server

You need to install php-curl

If you find a bug or have a request, write me.



/usr/bin/php check_openhab.php -H [Openhab Server] -P [Port] -m [mode] -i [Item/ Thing or Group] 
( -u [user] -p [password] -T [Token] -U =unique -mi[numbertype/string] -A [YYYY-mm-dd] [startnumber]-w [Warning] -c [Critical] -s =https -l [label] -gl =group label -C [configfile] -d =debug -h =help)



number + warn crit 
= number value(Item)

Contact or Contact+
= Contact (Open - Critical, Closed - OK (Item)), Contact+ (Closed - Critical, Open - OK (Item)) - disabled thing will not counted

Switch or Switch+
= Switch (On - Critical, Off - OK (Item)), Switch+ (Off - Critical, On - OK (Item)) - disabled thing will not counted

= Offline - Critical, Online - OK (Thing)

= total of Things Online/ Offline with warning and critcal (-i comma separated don't test things(label)) - disabled thing will not counted

= Date format: [D.M.Y H:m:s] (Item)

String or String+
= find a string in a item to get OK, or find a String to get Critical

= test a hole group (only numbers)

GContact or GContact+
= test a hole group of Contacts (Open - Critical, Closed - OK (Item)), GContact+ (Closed - Critical, Open - OK (Item))

GSwitch  or GSwitch+
= test a hole group of Switchies (On - Critical, Off - OK (Item)), GSwitch+ (Off - Critical, On - OK (Item))


Temperatur  = °C
Humidity    = %
Pressure    = kPa
Battery     = %
Lightsensor = lx (mode number)
every unit  = [unit] (mode number)

or String to find/ not find

-A only number - set Date to calculate average with a startnumber
( -A [YYYY-mm-dd] [startnumber] ) 

only number/contact(+)/state(+) test if thing of an item is ONLINE or OFFLINE


only State+, unique Things

-gl  can be used to print the label of an item instead of the name (Group/GContact/Gcontact+/Gswitch/Gswitch+)

-T [Token]

since openhab 3.0 you can create a token to access the rest api. You can create it in the web interface of openhab


config file (default=openhab.php) instead of the controller parameters -H, -P, -s, -T (you can specify any file with path)

$host=''; # IP or Hostname Openhab Server
$port='8080'; # Openhab Port
$prot='http'; # Value http or https
$token='' # Token
$user='' # User
$password='' # Password



Would you like to support me?
Then donate to PayPal...