Giter Site home page Giter Site logo

Comments (3)

mpounsett avatar mpounsett commented on July 28, 2024

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.

mpounsett avatar mpounsett commented on July 28, 2024

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.

mpounsett avatar mpounsett commented on July 28, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.