Skip to content
Icinga 2 Plugin to get thing and item count (aka stats) or item state
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Table of Contents

  1. About
  2. Requirements
  3. Arguments
  4. Icinga 2 CheckCommand
  5. Examples
  6. Contributing

What's this all about? helps you to integrate your openHAB 2 installation with Icinga 2.

One difficulty is, that there are naturally several different types of items:

  • Number items like temperature or humidity
  • Switch items which are typically ON or OFF
  • Contact items which are typically OPEN or CLOSED
  • Player items which can be PLAY, PAUSE and so on
  • ...

And of course all items could be in unknown state when restarting; to avoid a lot of unnecessary noise you should use a persistence service of your choice to get all items in defined (last known) states on restart.


  • openHAB 2 - openHAB 1.x will not work!
  • python-2.7.x with argparse, sys and requests enabled


Argument Description
--host / -H Required. Host your openHAB 2 installation is running on
--port / -P Port your openHAB 2 REST API is listening on. Default: 8080
--protocol Choose either HTTP or HTTPS. Default: HTTP
--stats / -S Get thing and item count for your openHAB 2. Supports perfdata. Mutually exclusive to --item
--item / -I Check a specific item (see examples below). Mutually exclusive to --stats
--warning / -W Value Icinga 2 should exit WARNING for (see examples)
--critical / -C Value Icinga 2 should exit CRITICAL for (see examples)

Icinga 2 CheckCommand

object CheckCommand "openhab2" {
    import "plugin-check-command"
    command = [ PluginDir + "/" ]
    arguments += {
        "--protocol" = "$openhab2_protocol$"
        "--host" = "$openhab2_host$"
        "--port" = "$openhab2_port$"
        "--item" = {
		description = "openHAB 2 item name"
		value = "$openhab2_item$"
        "--warning" = "$openhab2_warning$"
        "--critical" = "$openhab2_critical$"
        "--stats" = {
		description = "General openHAB 2 stats"
		set_if = "$openhab2_stats$"
        "--timeout" = "$openhab2_timeout$"
    vars.openhab2_host = "$address$"
    vars.openhab2_stats = false


Performance data are processed in the following use cases:

  • when using with --stats
  • when using the script with --item and it is an item of type Number

Getting openHAB 2 stats

$ ./ --host --port 8080 --protocol http --stats
openHAB OK - 36 things and 200 items in openHAB 2 system with UUID 02bb75e1-6195-4154-ae0f-c0b6a5ee6709.|openhab_items=200;;;; openhab_things=36;;;;

Screenshot: Stats Check Example

Check number item with thresholds

$ ./ --host --port 8080 --item Wetter_Temperatur --warning 18 --critical 20
openHAB CRITICAL - Wetter_Temperatur=21.4;18;20;;

Screenshot: Number Item Check Example

Check Switch item with threshold

$ ./ --host --port 8080 --item Schlafzimmer_0_Fenster --warning OPEN


If you're interested in contributing?

You can’t perform that action at this time.