Comments (3)
Original comment by mrvinti (Bitbucket: mrvinti, GitHub: mrvinti).
You can get around this by specifying a -inf:inf
("~:"
) range for your critical
threshold. This won't result in a CRITICAL
status and will evaluate to OK
when within the warning
range:
#!python
import nagiosplugin
class Sensors(nagiosplugin.Resource):
def probe(self):
return nagiosplugin.Metric('sens1', -3)
check = nagiosplugin.Check(Sensors(), nagiosplugin.ScalarContext('sens1', warning="-10:10", critical="~:"))
check.main()
>>> SENSORS OK - sens1 is -3 | sens1=-3;-10:10;~:
I've created a pull request #6 which addresses this issue replacing the default.
from nagiosplugin.
Original comment by Christian Kauhaus (Bitbucket: ckauhaus, GitHub: ckauhaus).
I think that changing the interpretation of an empty string in Range() should be ok. The specs state that if a Range does not state an explicit value for start, start should be assumed as 0. However, there is no saying in the specs what to do if a range is left completely empty. So the change is agreeable. And it is more intuitive of course. :-)
from nagiosplugin.
It looks like Christian never got around to dealing with this issue. I've had a look and at first glance what I think he had in mind seems reasonably do-able. The pull request mentioned by @mrvinti didn't survive the migration from BitBucket, but I think I can see what was probably done there. I'm adding this to the work list for the next 1.3.x release.
from nagiosplugin.
Related Issues (20)
- Wrong argument order for (all ?) super(*,*) calls HOT 2
- Logged messages appear after the summary HOT 3
- Sample haproxy log, LICENSE, CONTRIBUTORS, etc not installed by package
- Move example code out of the nagiosplugin package into its own path
- Support of pytest capsys HOT 9
- nagiosplugin.state.Warn vs. nagiosplugin.state.Warning (considering nagiosplugin.state.Critical) HOT 1
- Support Nagios passive checks
- Default output only shows one failed metric HOT 4
- Best practice for "missing" metrics? HOT 3
- Support for extra-opts HOT 4
- Support for extra-opts HOT 1
- Multiple calls of a guarded() function retain output HOT 1
- Runtime singleton should be refactored out
- Duplicated text in docstring in state.py
- class Resource should be reimplemented as an actual Abstract Base Class
- Class Context should be reimplemented as an actual Abstract Base Class
- Class Summary could be reimplemented as an actual Abstract Base Class
- Performance class should be a dataclass HOT 1
- Accessing results.by_state creates empty list and corrupts results.most_significant_state HOT 1
- test_examples.py:2: DeprecationWarning: pkg_resources is deprecated as an API HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nagiosplugin.