我在ubuntu机器上设置了Nagios 4核心,我在Windows 7机器上安装了NSClient ++。对于CPU,内存等开箱即用的监控,一切正常。
我还在.Net中编写了一个EXE,它收集了Windows机器上的一些指标,希望Windows机器上的NSClient能够执行这个EXE并将这些输出编组回服务器。问题是我不知道如何安装插件。你在服务器上安装它吗?在客户端?都?如果是这样的话?不用说ubuntu(nagios服务器所在的位置)不应该尝试执行.net EXE。
当我查看服务器上的配置文件时,我看到nagios服务器使用Check_NT与NSclient进行通信。我们的语法类似于Check_nt!blah
。在执行不属于核心的.Net EXE时,是否需要使用相同的语法?
我几乎没有找到任何详细的文档,如何安装Windows插件,让服务器和客户端相互通信。所以无论是极其简单还是非常复杂。我还看了一些YouTube视频......我面临的问题没有任何问题。
感谢任何帮助。谢谢大家!
答案 0 :(得分:0)
You'll want to define it as an NRPE check on your monitor, then define the check using the same name @ NSClient++ on Windows. The NSClient++ configuration has a section for NRPE handlers, just for this (source: op5 kb):
[NRPE Handlers] The nrpe handlers provide a way to execute any custom plugin/check command on the monitored Windows server. In this section you configure all the commands that should be available.
Adding a custom NRPE command to NSClient++ follow this syntax:
command[my_custom]=c:\mycustomdir\my_prog.exe
To test the check from your monitoring system you can use NRPE from the CLI to call my_custom
:
./check_nrpe -H 10.0.0.1 -c my_custom
And then define the service in your Nagios config like so:
define service{
use generic-service
host_name windowshost
service_description CPU Load
check_command check_nrpe!my_custom
}
You may need to do some extra work to format the output correctly. In BASH, exit 1 and exit 0 are commonly used to indicate state, IE: OK/Critical (source), and you may find it easier to augment your EXE's output with some simple scripting like that.