1

I have installed ICINGA2 Server on Ubuntu 16.04 LTS. Now I added 3 Windows hosts to monitoring and everything works fine, but I also configured UPTIME and MEMORY services for my new Windows hosts. I works properly but plugin check_uptime return output like this: UPTIME OK 2500h. How can I change unit from hours to days? The same with check_memory windows plugin - I received: MEMORY OK - XX % free, but I want to display output like this: MEMORY OK - XX % (X MB) free

It is possible to do?

EDITED: With reference to Sorcha respond I have checked help of check_uptime but I received different output.

check_uptime.exe Help
        Version: 1
check_uptime.exe is a simple program to check a machines uptime.
You can use the following options to define its behaviour:

  -h [ --help ]         Print help message and exit
  -V [ --version ]      Print version and exit
  -d [ --debug ]        Verbose/Debug output
  -w [ --warning ] arg  Warning threshold (Uses -unit)
  -c [ --critical ] arg Critical threshold (Uses -unit)
  -u [ --unit ] arg     Unit to use:
                        h- hours
                        m- minutes
                        s- seconds (default)
                        ms- milliseconds

It will then output a string looking something like this:

        UPTIME WARNING 712h | uptime=712h;700;1800;0
473183469
  • 1,350
  • 1
  • 12
  • 23

2 Answers2

1

When you see the help of check_uptime you have the desired unit :

Usage:
check_uptime [-u uom] [-w threshold] [-c threshold] [-t] [-h] [-vvv] [-V]

Options:
 -h, --help
    Print detailed help screen
 -V, --version
    Print version information
 --extra-opts=[section][@file]
    Read options from an ini file. See
    https://www.nagios-plugins.org/doc/extra-opts.html
    for usage and examples.
-t, Plugin timeout, default 10 seconds
-c, Critcal threshold
-w, Warning threshold
-u, Time unit of measurement (seconds|minutes|hours|days) (default: minutes)
-vvv, Enable verbose output

For check_memory you can test it on the host with differents outputs styles, you can see nsclient.ini.sample for some examples. And test with nscp test in a admin console

Sorcha
  • 1,315
  • 8
  • 11
  • Thanks for your reply, but probably I have different check_uptime script (I have installed ICINGA2 Client on Windows host), please see my edited post – Bartosz Sowa Jan 27 '17 at 15:16
0

You will probably have to write your own checks. Fortunately, it is very easy. You can do it in any language, C#, C, powershell, etc.

State (OK/WARNING/CRITICAL/UNKNOWN) is determined by exit code. Exit code 0 is OK, 1 WARNING, and so on.

Check output is simply printing to console. So in Powershell you would use Write-Host. That's already it!

mzhaase
  • 3,778
  • 2
  • 19
  • 32