【问题标题】:Monitor a text file for a single string/line with Zabbix?使用 Zabbix 监视单个字符串/行的文本文件?
【发布时间】:2021-05-17 21:43:51
【问题描述】:

我有一个 Windows 服务器,上面运行着一个应用程序。使用 powershell 我正在检查来自所述应用程序的文件是否有更改(与另一个文件进行比较)并将结果作为文本文件输出到 C:\ 驱动器上。该文件仅包含字符串“True”或“False”(不是引号),具体取决于文件是否更改。

如何检查该文件的字符串值?我试过了:

{myserver:system.run[powershell.exe -Command "Get-Content 'C:\changed.txt' | Select-String 'True' -quiet"].regexp("False")}

但返回的只是 ??F.

【问题讨论】:

    标签: zabbix


    【解决方案1】:

    system.run 在这里并不真正需要。相反,您可以使用log file monitoring

    log["C:\changed.txt",True]
    

    记住,此项必须配置为active check

    【讨论】:

    • 嗨@itinneed,如果我的回答对你有帮助,请考虑accepting
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-01-30
    • 2012-09-10
    • 1970-01-01
    相关资源
    最近更新 更多