Show value monitoring via SNMP

icinga2
director

(Adrian) #1

HI,
I have a little problem with show uptime. I monitor my host via SNMP and I would like to show day / hour / minutes / seconds but my view is like in attatchment. Secend problem is similar monitoring usage RAM via SNMP in my view show kb but not mb, I don’t how change it.
Regards,
Adrian


(Michael Friedrich) #2

You’d either need to write a wrapper script around the generic snmp plugin to format datetime, or you’ll look into a different plugin which natively provides a different format.


(watermelon) #3

Just to give you a little helping hand if you are inexperienced with scripts (since I had no idea what a wrapper script was when I needed a similar solution), you’ll need to create a script (bash, perl) which can call your check_snmp plugin which gives the output you initially get. From within the script, you can then make various output cases based on what you need. For example, you want MB instead of KB, so you just do some basic math within a script on the initial check_snmp output so you can get MB. You can also make the output look nicer and also send performance data if needed.

After all that, call the script from Icinga in a CheckCommand object and you should be good to go!


(Adrian) #4

Hi,
Thanks for help. I resoleved my problem diffrent plugin, but my problem now:
If I do it this way:

object CheckCommand “Uptime SNMP” {
import “plugin-check-command”
command = [ PluginDir + “/check_snmp_uptime.pl” ]
arguments += {
“-C” = “PUBLIC”
“-H” = “192.168.X.X”
}
}

Is all ok, but I will do it:

object CheckCommand “Uptime SNMP” {
import “plugin-check-command”
command = [ PluginDir + “/check_snmp_uptime.pl” ]
arguments += {
“-C” = “$snmp_community$”
“-H” = “$host_address$”
}
}

I have statement in dashboard:
Usage: /usr/lib64/nagios/plugins/check_snmp_uptime.pl [-v] -H [-6] -C <snmp_community> [-2]

Mayby you know where is the problem?

I do all operations in icinga director.


(Adrian) #5

Ok I resolved problem in this way:

arguments += {
“-C” = “$snmp_community$”
“-H” = “$address$”
}
vars.snmp_community = “PUBLIC”

Thanks for all.