ICINGA2 – 编辑Windows插件输出

我已经在Ubuntu 16.04 LTS上安装了ICINGA2服务器。 现在我添加了3台Windows主机进行监控,一切正常,但我也为我的新Windows主机configuration了UPTIME和MEMORY服务。 我工作正常,但插件check_uptime返回这样的输出: UPTIME OK 2500h。 如何将单位从几小时改为几天? 与check_memory窗口插件相同 – 我收到: MEMORY OK - XX % free ,但是我想显示这样的输出: MEMORY OK - XX % (X MB) free

有可能吗?

编辑:参考Sorcha响应我已经检查了check_uptime的帮助,但我收到不同的输出。

 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 

你可能必须写自己的支票。 幸运的是,这很容易。 你可以用任何语言,C#,C,PowerShell等

状态(OK / WARNING / CRITICAL / UNKNOWN)由退出代码决定。 退出代码0是OK,1 WARNING,依此类推。

检查输出只是打印到控制台。 所以在Powershell中你可以使用Write-Host 。 这已经是它了!

当你看到check_uptime的帮助时,你有所需的单位:

 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 

对于check_memory,您可以使用不同输出样式在主机上进行testing,对于某些示例,您可以看到nsclient.ini.sample。 并在pipe理控制台中使用nscp test