check_log service does not create performance data

This forum was archived to /woltlab and is now in read-only mode.
  • Hi guys,


    iv been reading a lot of similar hits to my topic but unfortunately nothing really applies to my problem:


    Some hosts forward their syslog messages into my central syslog.

    There I check for specific matches and in case they hit => alarm me


    My check command looks like this:


    object CheckCommand "check_tanaza_syslog_warning" {

    import "plugin-check-command"

    command = [ PluginDir + "/check_log"]

    arguments = {

    "-F" = "$logname$"

    "-O" = "$oldlogname$"

    "-q" = "$match$"

    }

    vars.logname = "/var/log/syslogs/tanaza/messages.log"

    vars.oldlogname = "/var/log/syslogs/tanaza/oldlog"

    vars.match = "warning"

    }


    The respective service:


    apply Service "check_tanaza_syslog_warning" {

    import "generic-service"

    check_command = "check_tanaza_syslog_warning"

    assign where host.name == "GW900001_HH"

    }


    output looks like this:


    Log check ok - 0 pattern matches found


    icinga2 checks it just fine, no errors being reported when I reload/restart the daemon. However, pnp4nagios does not get any perfdata from that check:


    Please check the documentation for information about the following error.

    XML file "/var/lib/pnp4nagios/perfdata/GW900001_HH/check_tanaza_syslog_warning.xml" not found. Read FAQ online

    file [line]:

    application/models/data.php [312]:

    back


    all other services just look fine and are being graphed properly.


    Anyone an idea?


    Thanks!

  • good catch.


    I read through that performance data chapter and added some stuff to the plugin:


    if [ "$count" = "0" ]; then # no matches, exit with no error

    $ECHO "OK |'match'=($count);1;2;"

    exitstatus=$STATE_OK

    else # Print total matche count and the last entry we found

    $ECHO "ERROR |'match'=($count);1;2;'lastentry'=($lastentry)"

    exitstatus=$STATE_CRITICAL

    fi


    I can now see that in icings web my performance data is shown:



    Performancedaten


    Label Wert Warnung Kritisch
    match 0.00 1.00 2.00



    however, pnp4nagios is not graphing these.


    Any idea?


    Thanks!

  • Executing the snippet I see parentheses around the values leading to invalid performance data.

    I'd propose something like

    Code
    1. if [ $count = 0 ]; then # no matches, exit with no error
    2.     $ECHO "OK |'match'=$count;1;2"
    3.     exitstatus=$STATE_OK
    4. else # Print total matches count and the last entry we found
    5.     $ECHO "ERROR |'match'=$count;1;2 'lastentry'=$lastentry"
    6.     exitstatus=$STATE_CRITICAL
    7. fi