You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+128-5Lines changed: 128 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -41,15 +41,82 @@ The Monitoring Plugin then proceeds to execute it's duty and returns the result
41
41
Part of the process of returning the result is the termination of the execution of the Monitoring Plugin itself.
42
42
43
43
## Input Parameters for a Monitoring Plugin
44
+
A _Monitoring Plugin_ MUST expect input parameters as arguments during execution, if any are needed/expected at all. It MAY accept these parameters
45
+
given as _environment variables_ and it MAY accept them in a configuration file (with a default path or a path given via arguments or _environment variables_).
46
+
47
+
In general positional arguments are strongly discouraged.
48
+
49
+
Some arguments MUST have this predetermined meaning, if they are used:
50
+
| Argument (long) | Argument (short version, optional) | Argument | Meaning | optional | can be given multiple times |
51
+
| --help | -h | None | "Triggers the help functionality of the _Monitoring Plugin_, showing the individual parameters and their meaning, examples for usage of the _Monitoring Plugin_ and general remarks about the how and why of the _Monitoring Plugin_. SHOULD overwrite all other options, meaning, they are ignored if `--help` is given. The _Monitoring Plugin_ SHOULD exit with state UNKNOWN (3). | no | -- (makes no difference) |
52
+
| --version | -V | None | Shows the version of the _Monitoring Plugin_ to allow users to report errors better and therefore help them and the developers. The _Monitoring Plugin_ SHOULD exit with state UNKNOWN (3). | no | -- (makes no difference) |
53
+
| --timeout | -t | Integer (meaning seconds) or a time duration string | Sets a limit for the time which a _Monitoring Plugin_ is given to execute. This is there to enforce the abortion of the test and improve the reaction time of the _Monitoring System_ (e.g. in bad network conditions it might be helpful to abort the test prematurely and inform the user about that, than trying forever to do something which won't succeed. Or if soft real time constraints are present, a result might be worthless altogether after some time). A sane default is probably 30 seconds, although this depends heavily on the scenario and should be given a thought during development. If the execution is terminated by this timeout, it should exit with state UNKNOWN (3) and (if possible) give some helpful output in which stage of the execution the timeout occurred. | no | no |
54
+
| --hostname | -H | String, meaning either a DNS name, an IPv4 or an IPv6 address of the targeted system | If the _Monitoring Plugin_ targets ONE other system on the network, this option should be used to tell it which one. If the _Monitoring Plugin_ does it's test just locally or the logic does not apply to it, this option is, of course, optional. | yes | yes |
55
+
| --verbose | -v | None | Increases the verbosity of the output, thereby breaking the suggested rules about a short and concise output. Can be used to debug the _Monitoring Plugin_ and should there expose internals, intermediate results and so on. | yes | yes |
56
+
| --detail || None | Increases the level of detail in the output, thereby giving the user more information about the result of the test and helping with determining errors and problems or just satisfy some curiosity. SHOULD NOT be used to debug the _Monitoring Plugin_, so there is no need to expose internals. | yes | yes |
57
+
| --exit-ok || The _Monitoring Plugin_ exits unconditionally with OK (0). Mostly useful for the purpose of packaging and testing plugins, but might be used to always ignore errors (e.g. to just collect data). | yes | no |
58
+
59
+
### Examples
60
+
For the execution with `--help`:
61
+
```
62
+
$ my_check_plugin --help
63
+
```
64
+
the output might look like this:
65
+
```
66
+
my_check_plugin version 3.1.4
67
+
Licensed under the AGPLv1.
68
+
Repository: git.example.com/jdoe/my_check_plugin
69
+
70
+
This plugin just says hello. It fails if you don't give it a name.
71
+
72
+
Usage:
73
+
my_check_plugin --name NAME [--greeting GREETING]
74
+
75
+
Options:
76
+
--help
77
+
this help
78
+
--version
79
+
Shows the version of the plugin
80
+
--name NAME
81
+
if given, uses NAME as a name to greet.
82
+
--greeting GREETING
83
+
if given, uses GREETING instead of Hello.
84
+
85
+
Examples:
86
+
$ my_check_plugin --name Jane
87
+
Hello Jane
88
+
89
+
$ my_check_plugin --greeting Ciao --name Alice
90
+
Ciao Alice
91
+
```
92
+
This imaginary _Monitoring Plugin_ tries to be really helpful here,
93
+
displays the version, the license and the upstream repository with the help
94
+
(although not necessary), has a short description about the purpose,
95
+
lists the options in an easily readable way and even gives some examples.
44
96
45
-
## Ouput of a Monitoring Plugin
97
+
For the execution with `--version`
98
+
```
99
+
$ my_check_plugin --version
100
+
```
101
+
the output might be a bit shorter:
102
+
```
103
+
my_check_plugin version 3.1.4
104
+
```
105
+
or even:
106
+
```
107
+
3.1.4
108
+
```
109
+
where both show the necessary information.
110
+
111
+
112
+
## Output of a Monitoring Plugin
46
113
The output of a Monitoring Plugin consists of two parts on the first level, the *Exit Code* and
47
114
output in textual form on _stdout_.
48
115
49
116
### Exit Code
50
117
The *Monitoring Plugin* MUST make use of the *Exit Code* as a method to communicate a result to
51
118
the *Monitoring System*. Since the *Exit Code* is more or less standardized over different systems
52
-
as a number with a size of or greater than 256 bit, the following mapping is used:
119
+
as an integer number with a width of or greater than 8bit, the following mapping is used:
53
120
54
121
|*Exit Code* (numerical) | Meaning (short) | Meaning (extended) |
55
122
| --- | --- | --- |
@@ -98,7 +165,7 @@ are better.
98
165
Although no strict guidelines for creating this part of the output can really be given, a developer should
99
166
keep a potential user in mind. It might, for example, be OK to put the output in a single line if there are
100
167
only one or two items of a similar type (think: multiple file systems, multiple sensors, etc.) are present,
101
-
but not if there 10 or 100, although this might present a total valid use case.
168
+
but not if there 10 or 100, although this might present a valid use case.
102
169
If there are several different items exists in the output of the *Monitoring Plugin*, furthermore called *partial results*,
103
170
they probably SHOULD be given their own line in the output.
104
171
@@ -110,6 +177,62 @@ The performance data then MUST consist of space separated single values, these M
110
177
`'label'=value[UOM][;warn[;crit[;min[;max]]]]`
111
178
112
179
with the following definitions:
113
-
1._label_ must consist of at least on non-space character, but can otherwise contain any printable characters except for the equals sign ("=") or single quotes ("'").
180
+
181
+
1._label_ must consist of at least on non-space character, but can otherwise contain any printable characters except for the equals sign (`=`) or single quotes (`'`).
114
182
If it contains spaces, it must be surrounded by single quotes
115
-
2._value_ is a numerical value
183
+
2._value_ is a numerical value, might be either an integer or a floating point number. Using floating point numbers if the value is really discreet SHOULD be avoided. Also the
184
+
representation of a floating point number SHOULD NOT use the "scientific notation" (e.g. `6.02e23` or `-3e-45`), since some systems might not be able to parse them correctly.
185
+
Also values with a base other then 10 SHOULD be avoided (see below for more information on `Byte` values).
186
+
3._UOM_ is the _Unit of measurement_ (e.g. "B" for _Bytes_, "s" for seconds) which gives more context to the _Monitoring System_. The following constraints MUST be applied:
187
+
1. An _UOM_ of `%` MUST be used for percentage values
188
+
2. An _UOM_ of `c` MUST be used for continuous counters (commonly used for the sum of bytes transmitted on an interface)
189
+
190
+
The following recommendations SHOULD be applied:
191
+
1. The _UOM_ for `Byte` values is `B` and although many systems do understand units like
192
+
`KB`,`KiB`, `MB`, `GB`, `TB` they SHOULD be avoided, at the least to avoid the ugly hassle about
193
+
people misinterpreting the *base10* values as *base2* values and the other way round.
194
+
This is also a prime example where floating point number SHOULD NOT be used, since there are
195
+
obviously only integer numbers included.
196
+
2. The _UOM_ for time is `s`, meaning seconds, SI-Prefixes (e.g. `ms` for milli seconds) are allowed if
197
+
necessary or useful, but be aware, that many systems may not understand `μs` for micro seconds and expect
198
+
`us` instead.
199
+
3. In general, SI units and SI prefixes SHOULD be used as _UOM_ if applicable, but the _Monitoring System_
200
+
may not understand them correctly (mostly in uncommon cases), in that cases appropriate workarounds
201
+
MAY be applied on the side of the _Monitoring Plugin_, but it would be nice make the developer
202
+
of the _Monitoring System_ aware of the problem.
203
+
204
+
4._warn_ and _crit_ are the threshold values for this measurement, which may have been given by the user as input, may be hardcoded in the _Monitoring Plugin_
205
+
or may be retrieved from a file or a device or somewhere else during the execution of the tests. The unit used MUST be the same as for _value_.
206
+
These values are not simple numbers, but _range_ expressions.
207
+
5._min_ and _max_ are the minimal respectively the maximal value the _value_ could possibly be. The unit is the same as for _value_.
208
+
These values can be omitted, if the _value_ is a percentage value, since _min_ and _max_ are always `0` and `100` in this case.
209
+
210
+
## Range expressions
211
+
212
+
In many cases thresholds for metrics mark a certain range of values where the values is considered to be good or bad if it is inside or outside.
213
+
While for significant number of metrics a upper (e.g. load on unixoid systems) or lower (e.g. effective throughput, free
214
+
space in memory or storage) border might suffice, for some it does not, for example a temperature value from a temperature
215
+
sensor should be within certain range (let's say 10℃ and 45℃).
216
+
217
+
Regarding input parameters this might be handled with with options like `--critical-upper-temperature` and `--critical-lower-temperature`,
218
+
this presents a problem with the performance data, if only scalar values could be used.
219
+
To resolve this situation the _Range expression_ format was introduced, with the following definition:
220
+
221
+
`[@][start:][end]`
222
+
where:
223
+
1.`start` <= `end`
224
+
2. If `start` == 0, then it can be omitted.
225
+
3. If `end` is omitted, it has the "value" of positive infinity.
226
+
4. Negative infinity can be specified with `~`.
227
+
5. If the prefix `@` is NOT given, the value exceeds the threshold if it is OUTSIDE of the range between `start` and `end` (including the endpoints).
228
+
6. If the prefix `@` IS given, the value exceeds the threshold if it is INSIDE the range between `start` and `end` (including the endpoints).
229
+
7. Contrary to the short definition above, an empty _Range expression_ is not a valid one, at least either `start` or `end` must be provided.
230
+
231
+
### Examples
232
+
233
+
| Range definition | Exceeds threshold if x...|
234
+
| 10 | < 0 or > 10, (outside the range of {0 .. 10}) |
235
+
| 10: | < 10, (outside {10 .. ∞}) |
236
+
|~:10 | > 10, (outside the range of {-∞ .. 10}) |
237
+
| 10:20 | < 10 or > 20, (outside the range of {10 .. 20}) |
238
+
|@10:20 | ≥ 10 and ≤ 20, (inside the range of {10 .. 20}) |
0 commit comments