|
| 1 | +# Check better-ehr-health |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +Monitoring plugin for Better EHR, querying the JSON health endpoint (for example, `http://server:port/health`). |
| 6 | +Supports overriding component states and applying Nagios-style threshold ranges to detail metrics. |
| 7 | + |
| 8 | +Hints: |
| 9 | + |
| 10 | +* Useful for monitoring Better EHR availability and component health. |
| 11 | +* Allows fine-grained overrides to adjust alerting behaviour. |
| 12 | + |
| 13 | +## Fact Sheet |
| 14 | + |
| 15 | +| Fact | Value | |
| 16 | +|----------------------------------|---------------------------------------------------------------------------------------------| |
| 17 | +| Check Plugin Download | https://github.com/Linuxfabrik/monitoring-plugins/tree/main/check-plugins/better-ehr-health | |
| 18 | +| Check Interval Recommendation | Once a minute | |
| 19 | +| Can be called without parameters | No | |
| 20 | + |
| 21 | +## Help |
| 22 | + |
| 23 | +```text |
| 24 | +usage: better-ehr-health [-h] [-V] [--always-ok] [--insecure] [--no-proxy] |
| 25 | + [--url URL] [--test TEST] [--record-json FILE] |
| 26 | + [--timeout TIMEOUT] |
| 27 | + [--override-status COMPONENT:API_STATE:NAGIOS_STATE] |
| 28 | + [--override-threshold COMPONENT:DETAIL[:WARN[:CRIT]]] |
| 29 | + [-v] |
| 30 | +
|
| 31 | +Monitoring plugin for Better EHR, querying the JSON health endpoint (e.g. |
| 32 | +http://server:port/health). Supports overriding component states and applying |
| 33 | +Nagios-style threshold ranges to detail metrics. |
| 34 | +
|
| 35 | +options: |
| 36 | + -h, --help show this help message and exit |
| 37 | + -V, --version show program's version number and exit |
| 38 | + --always-ok Always returns OK. |
| 39 | + --insecure This option explicitly allows to perform "insecure" |
| 40 | + SSL connections. Default: True |
| 41 | + --no-proxy Do not use a proxy. Default: False |
| 42 | + --url URL Better EHR Health Endpoint. Default: |
| 43 | + http://localhost:80/health |
| 44 | + --test TEST For unit tests. Provide a path to a JSON file |
| 45 | + containing a captured API response. |
| 46 | + --record-json FILE Write the full fetched JSON (including status_code and |
| 47 | + response_json) to the given file. |
| 48 | + --timeout TIMEOUT Network timeout in seconds. Default: 3 (seconds) |
| 49 | + --override-status COMPONENT:API_STATE:NAGIOS_STATE |
| 50 | + Override mapping from API state to Nagios state. |
| 51 | + Format: component:api_state:nagios_state Example: |
| 52 | + diskSpace:DEGRADED:WARN |
| 53 | + --override-threshold COMPONENT:DETAIL[:WARN[:CRIT]] |
| 54 | + Override threshold check for a component detail. |
| 55 | + Nagios format: component:detail[:warn[:crit]] Example: |
| 56 | + diskSpace:free::20000000 |
| 57 | + -v, --verbose Set the verbosity level. |
| 58 | +``` |
| 59 | + |
| 60 | +## Usage Examples |
| 61 | + |
| 62 | +```bash |
| 63 | +./better-ehr-health --url http://server:8080/health |
| 64 | +``` |
| 65 | + |
| 66 | +```bash |
| 67 | +./better-ehr-health --override-status diskSpace:DEGRADED:WARN |
| 68 | +``` |
| 69 | + |
| 70 | +```bash |
| 71 | +./better-ehr-health --override-threshold diskSpace:free::20000000 |
| 72 | +``` |
| 73 | + |
| 74 | +### Output: |
| 75 | +```text |
| 76 | +[WARNING] overridden from API Status: UP |
| 77 | +Component ! Status ! Details |
| 78 | +---------------------+--------------------+-------------------------- |
| 79 | +db ! UP ! |
| 80 | + ! ! database=Oracle |
| 81 | + ! ! validationQuery=isValid() |
| 82 | +diskSpace ! UP ! |
| 83 | + ! ! total=61041709056 |
| 84 | + ! [WARNING] ! free=35045371904 |
| 85 | + ! ! threshold=10485760 |
| 86 | + ! ! exists=True |
| 87 | +hikariConnectionPool ! UP ! |
| 88 | + ! ! activeConnections=0 |
| 89 | + ! ! maxPoolSize=40 |
| 90 | +indexStatus ! GREEN -> [WARNING] ! |
| 91 | +indexSynchronization ! GREEN ! |
| 92 | + ! ! queuedEntries=0 |
| 93 | + ! ! erroredEntries=0 |
| 94 | +ping ! UP !|'diskSpace_free'=35045371904;20;2000000000000000000000;61041709056; 'diskSpace_exists'=1;;;; 'hikariConnectionPool_activeConnections'=0;;;; 'hikariConnectionPool_maxPoolSize'=40;;;; 'indexSynchronization_queuedEntries'=0;;;; 'indexSynchronization_erroredEntries'=0;;;; |
| 95 | +``` |
| 96 | + |
| 97 | +## States |
| 98 | + |
| 99 | +* Returns **OK**, **WARN**, **CRIT**, or **UNKNOWN** depending on API state, component overrides, and threshold checks. |
| 100 | +* `--always-ok` forces the check to always return OK. |
| 101 | + |
| 102 | +## Perfdata / Metrics |
| 103 | + |
| 104 | +Each numeric detail is exposed as perfdata unless explicitly excluded (`threshold`, `total`). |
| 105 | + |
| 106 | +| Name | Type | Description | |
| 107 | +| ------------------ | ------ | ----------------------- | |
| 108 | +| diskSpace\_free | Bytes | Free disk space | |
| 109 | +| diskSpace\_total | Bytes | Total disk space | |
| 110 | +| hikari\_activeConn | Number | Active DB connections | |
| 111 | +| ... | ... | Other component details | |
| 112 | + |
| 113 | +## Troubleshooting |
| 114 | + |
| 115 | +**Error:** Connection refused |
| 116 | +**Solution:** Verify Better EHR endpoint is reachable and correct URL is provided with `--url`. |
| 117 | + |
| 118 | +**Error:** SSL error |
| 119 | +**Solution:** Use `--insecure` for testing, but configure proper certificates in production. |
| 120 | + |
| 121 | +## Credits, License |
| 122 | + |
| 123 | +* Authors: [Linuxfabrik GmbH, Zurich](https://www.linuxfabrik.ch) |
| 124 | +* License: The Unlicense, see [LICENSE file](https://unlicense.org/). |
0 commit comments