monitoring-plugins / monitoring-plugin-perl

Perl module Monitoring::Plugin - Nagios::Plugin
http://search.cpan.org/dist/Monitoring-Plugin/
42 stars 20 forks source link

Threshold specification fixes #15

Open edlitmus opened 7 years ago

edlitmus commented 7 years ago

After writing tests for a monitoring tool that uses this module I notices what seems like deviations from the written specs for thresholds, going by:

https://nagios-plugins.org/doc/guidelines.html#THRESHOLDFORMAT

For instance, this rule:

@6

by my reading should mean 'inside the range [0 - 6]', while this rule:

6

would be 'anything outside the range [6 - positive infinity]', so anything less than 6.

Similarly, ~:25 would be anything over 25, while @~:25 would be 'anything in the range of negative infinity to 25'.

If I'm on crack please feel free to say so.

hirotnk commented 7 years ago

The link to the nagios document is broken ?

edlitmus commented 7 years ago

fixed link in description

sni commented 7 years ago

Mixing whitespace changes with functional changes makes reviews really hard. I also don't understand whats the purpose of invertig the unit tests?

edlitmus commented 7 years ago

Here are some notes:

Sorry about the white space thing. There was a mix of tabs and spaces that made parts hard to read and I ran them through perltidy out of habit.

dermoth commented 7 years ago

About whitespace, IIRC we settled toward using tabs for indent and space for alignment (i.e. continuation lines should be tab-indented like the preceding line then space-indented to align). ex:

sub main {
[TAB]if ($foo & 0x0010 &&
[TAB][SP]$bar & 0x1000) {
[TAB][TAB]do_something();
[TAB]}
}

This way you can adjust the tab size to your liking and alignment remains correct.

I believe only 7 lines would be affected if you fix indents accordingly.

Regards