我已经在Ubuntu16.04LTS上安装了ICINGA2服务器。现在,我在监控中添加了3台Windows主机,一切正常工作,但我也为我的新Windows主机配置了正常运行时间和内存服务。我工作正常,但插件check_uptime返回的输出如下:正常运行时间,OK,2500小时。我怎样才能把单位从几个小时改为几天?与check_memory windows插件相同-我收到了: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发布于 2017-01-26 13:36:25
你可能得自己开支票了。幸运的是,这很容易。您可以使用任何语言,C#、C、powershell等。
状态(确定/警告/临界/未知)由退出代码确定。退出代码0是OK,1警告,等等。
检查输出只是简单地打印到控制台。所以在Powershell中,您可以使用Write-Host。已经够了!
发布于 2017-01-26 13:36:36
当您看到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,您可以在具有不同输出样式的主机上测试它,可以通过一些示例查看nsclient.ini.sample。并在管理控制台中使用nscp test进行测试。
https://serverfault.com/questions/828754
复制相似问题