首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ICINGA2 -编辑输出

ICINGA2 -编辑输出
EN

Server Fault用户
提问于 2017-01-26 13:28:51
回答 2查看 758关注 0票数 1

我已经在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的帮助,但是我收到了不同的输出。

代码语言:javascript
复制
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
EN

回答 2

Server Fault用户

回答已采纳

发布于 2017-01-26 13:36:25

你可能得自己开支票了。幸运的是,这很容易。您可以使用任何语言,C#、C、powershell等。

状态(确定/警告/临界/未知)由退出代码确定。退出代码0是OK,1警告,等等。

检查输出只是简单地打印到控制台。所以在Powershell中,您可以使用Write-Host。已经够了!

票数 0
EN

Server Fault用户

发布于 2017-01-26 13:36:36

当您看到check_uptime的帮助时,您就得到了所需的单元:

代码语言:javascript
复制
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进行测试。

票数 1
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/828754

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档