Skip to content

Commit

Permalink
clarify jsonpath
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmens committed May 3, 2019
1 parent ee00693 commit 02d262e
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ A [Nagios]/[Icinga] plugin for checking connectivity to an [MQTT] broker. Or wit
This plugin connects to the specified broker and subscribes to a topic. Upon successful subscription, a message is published to said topic, and the plugin expects to receive that payload within `max_wait` seconds.

## Prerequisite
This module needs jsonpath-rw. To install, use `$ pip install jsonpath-rw`
This module can use jsonpath-rw. To install, use `$ pip install jsonpath-rw`

## Configuration

Expand Down Expand Up @@ -127,39 +127,41 @@ There are no required arguments, defaults are displayed using `--help`. If `--wa
</dl>


## Example
## Examples

#### simple

```
./check-mqtt.py -H localhost -P 1883 -u user -p password -t nagios/test -m 10
OK - message from nagios/test at localhost in 0.00 | response_time=0.10 value=PiNG
```

## Status check
#### Status check

```
./check-mqtt.py -H localhost -t devices/mydevice/lastevent -v '!expr `date +%s` - 216000' -r -o greaterthan
OK - message from devices/mydevice/lastevent at localhost in 0.05s | response_time=0.05 value=1472626997
```

## Ping Pong check
#### Ping Pong check

```
./check-mqtt.py -H localhost -t nagios/ListenForPing -s nagios/PublishPongTo -l ping -v pong
OK - message from nagios/PublishPongTo at localhost in 0.05s | response_time=0.05 value=pong
```

## Jsonpath check
#### Jsonpath check

```
./check-mqtt.py -H localhost -t devices/mydevice/sensor -v '950' -j '$.BME280.Pressure' -r -o greaterthan
OK - message from devices/mydevice/sensor at localhost in 0.06s | response_time=0.06 value=1005.0
```

## Jsonpath check using range (warning if lower than 4° or higher than 28°, critical if minus or higher than 35°)
#### Jsonpath check using range (warning if lower than 4° or higher than 28°, critical if minus or higher than 35°)

```
./check-mqtt.py -H localhost -t devices/mydevice/sensor -v '950' -j '$.BME280.Temperature' -r --warning 'payload < 4 or payload >28' --critical 'payload < 0 or payload >35'
Expand All @@ -169,6 +171,7 @@ OK - message from devices/mydevice/sensor at localhost in 0.06s | response_time=


## Nagios Configuration

### command definition
```
define command{
Expand Down

0 comments on commit 02d262e

Please sign in to comment.