Welcome to Pandora FMS Community!

Find answers, ask questions, and connect with our community around the world.

  • Plugins exit status

    Posted by redbaron on November 22, 2009 at 13:59

    Hi All,

    I’m moving from Nagios to Pandora.
    In the procedure I rewrite some of my plugins, but as they make there tests I see that if the plugin fail and exit whit status different then 0 Pandora “think” it’s OK (The status is green). For example, remote plugins that use SSH, but on the remote machine there is no SSH service.
    How do I set a plugin to fail if the exit status is different then 0?

    Thanks,
    Gil

    Sancho replied 14 years, 11 months ago 2 Members · 5 Replies
  • 5 Replies
  • Sancho

    Administrator
    December 2, 2009 at 02:53
    2229 Karma points
    Community awards: bulb Bright ideas
    Community rank: tentacle_master_icon Tentacle Master
    Like it
    Up
    0
    Down
    Drop it
    ::

    Hi All,

    I’m moving from Nagios to Pandora.
    In the procedure I rewrite some of my plugins, but as they make there tests I see that if the plugin fail and exit whit status different then 0 Pandora “think” it’s OK (The status is green). For example, remote plugins that use SSH, but on the remote machine there is no SSH service.
    How do I set a plugin to fail if the exit status is different then 0?

    Thanks,
    Gil

    You don’t need to rewrite the plugins, pandora 3.x has a “compatibity” mode to use exitcodes from nagios plugins to “know” if they are returning OK, CRITICAL o WARNING.

    Anyway, if you want to rewrite it, you just be sure to output a 0 for bad and anything else for OK, this worls for generic_proc only, you can return any value, use it for performance data and associate it status values using max/min in critical/warning thresholds.

    I hope this helps, but I’m not sure what version of Pandora are you using or what kind of checks you want to do.

  • redbaron

    Member
    December 3, 2009 at 16:56
    0 Karma points
    Community rank: tentacle-noob-1 Tentacle noob
    Like it
    Up
    0
    Down
    Drop it
    ::

    You don’t need to rewrite the plugins, pandora 3.x has a “compatibity” mode to use exitcodes from nagios plugins to “know” if they are returning OK, CRITICAL o WARNING.

    Anyway, if you want to rewrite it, you just be sure to output a 0 for bad and anything else for OK, this worls for generic_proc only, you can return any value, use it for performance data and associate it status values using max/min in critical/warning thresholds.

    I hope this helps, but I’m not sure what version of Pandora are you using or what kind of checks you want to do.

    Hi,

    I’m trying to check number of concurrent user in Oracle (just an example)…
    I wrote  a test script that echo “WARNING” and exit whit “3”.
    I added the plugin to Pandora as nagios plugin (menage Servers Manage plugins create “Plugin type” = nagios)

    #!/bin/bash
    printf  WARNING
    exit 3
    

    But the status is green and the data is “WARNING”…
    If I change the exit code to “0” it’s the same…

    Gili

  • Sancho

    Administrator
    December 9, 2009 at 16:18
    2229 Karma points
    Community awards: bulb Bright ideas
    Community rank: tentacle_master_icon Tentacle Master
    Like it
    Up
    0
    Down
    Drop it
    ::

    If you’re rewritting the code, better use native Pandora syntax.

    Just return the number of concurrent users, in this example: 3

    And later, in pandora module, define what you consider it’s a WARNING and CRITICAL using the module MIN_WARNING, and MIN_CRITICAL for this value.

    For exame, if you consider that 3 or more is warning and 6 or more is critical, configure:

    MIN_WARNING 3, MIN_CRITICAL 6

    In this way you define the method to get the information (plugin code) and let the processing of that is warning / critical to the pandora server, configured by the pandora console. You can get different values of critical/warning, using the same piece of code, without altering it, and change warning/critical values “on the fly” using the console, without touching the code.

    I hope this helps to understand better the pandora plugin concept !

  • redbaron

    Member
    December 10, 2009 at 13:37
    0 Karma points
    Community rank: tentacle-noob-1 Tentacle noob
    Like it
    Up
    0
    Down
    Drop it
    ::

    If you’re rewritting the code, better use native Pandora syntax.

    Just return the number of concurrent users, in this example: 3

    And later, in pandora module, define what you consider it’s a WARNING and CRITICAL using the module MIN_WARNING, and MIN_CRITICAL for this value.

    For exame, if you consider that 3 or more is warning and 6 or more is critical, configure:

    MIN_WARNING 3, MIN_CRITICAL 6

    In this way you define the method to get the information (plugin code) and let the processing of that is warning / critical to the pandora server, configured by the pandora console. You can get different values of critical/warning, using the same piece of code, without altering it, and change warning/critical values “on the fly” using the console, without touching the code.

    I hope this helps to understand better the pandora plugin concept !

    I tested it this way, and those are my guiding lines… But what if the plugin returns whit some error status?
    lets say the plugin, that runs locally on the Oracle server, can’t connect to the oracle and returns whit some error status.
    By it’s nature, the plugin and pandora server will ignore it and take the “status” as the value of the output and will display something like “unable to connect to ###”.
    In Nagios for example, in this example, the plugin return the error message and exit whit status error (some value different then “0”), and an alert will appear.
    How do I make Pandora behave in the same way?

    Gili

  • Sancho

    Administrator
    December 14, 2009 at 22:07
    2229 Karma points
    Community awards: bulb Bright ideas
    Community rank: tentacle_master_icon Tentacle Master
    Like it
    Up
    0
    Down
    Drop it
    ::

    Pandora only takes “one data” per module. This means if you want to get status AND the performance data, you should get two different modules. One for data and the other for status.

    Anyway you can trick it, suppose it returns values between 0 and 100. For you > 90 is critical. You can return errors with value “101” for example. But this is not a good idea because could be easily missunderstood. You should have two modules:

    Check Status -> Ok / Critical
    Check Value -> Value data

    Another way is to do not reply anything. A “invalid” value (for example a void value) for pandora should get your module as “unknown” status and see it as invalid (uknown). Unknown values at this time cannot be assigned to an alert, but are displayed as uknown in any status view.

    I hope this will help.

    I tested it this way, and those are my guiding lines… But what if the plugin returns whit some error status?
    lets say the plugin, that runs locally on the Oracle server, can’t connect to the oracle and returns whit some error status.
    By it’s nature, the plugin and pandora server will ignore it and take the “status” as the value of the output and will display something like “unable to connect to ###”.
    In Nagios for example, in this example, the plugin return the error message and exit whit status error (some value different then “0”), and an alert will appear.
    How do I make Pandora behave in the same way?

    Gili