我无法获得一个定义的插件,这是一个batch file与Munin-node-win32(1.6.1)运行。
根据自述 ,它能够集成[ExternalPlugin]部分中定义的外部插件:
* External Plugin: * A plugin that supports external plugins in the style of munin-node. * Configuration in [ExternalPlugin] section. Just add an entry with the path to the program to run, It doesn't matter what the name of the name=value pair is. * The output of the external program should be similar to the following, * Note: add quotes (") around the value if it has spaces! :: >disk_free.py name drive_free >disk_free.py drive_free_c.value 40.3635149113 . >disk_free.py config graph_title Filesystem free (in %) graph_category disk graph_info This graph shows the amount of free space on each disk. graph_args --upper-limit 100 -l 0 graph_vlabel % drive_free_c.label C: .
我已经定义了插件如下:
[ExternalPlugin] ; For External Plugins just add an entry with the path to the program to run ; It doesn't matter what the name of the name=value pair is rdsessions="C:\Program Files\Monitoring-Scripts\munin-rdsessions.bat"
batch file似乎正在返回文档所需的输出:
C:\Program Files\Monitoring-Scripts>.\munin-rdsessions.bat name rdsessions C:\Program Files\Monitoring-Scripts>.\munin-rdsessions.bat total.value "6.000000" active.value "1.000000" . C:\Program Files\Monitoring-Scripts>.\munin-rdsessions.bat config graph_title Remote Desktop Sessions graph_category system graph_args --upper-limit 15 -l 0 -r graph_vlabel Sessions graph_order total active total.label Total sessions active.label Active sessions . C:\Program Files\Monitoring-Scripts>
但是,在查询时,Munin节点没有列出“rdsessions”作为可用的插件:
$ telnet rdsh-02.example.com 4949 Trying 192.168.21.85... Connected to rdsh-02.example.com. Escape character is '^]'. # munin node at rdsh-02 list df memory processes network cpu hdd
到目前为止,我已经find了一个关于.cmd s的外部插件的关于.Munin-node-win32的错误报告 ,答案暗示了最终点对于插件的function至关重要,并且揭示了一些人在集成外部插件时遇到了问题。
基于此,我已经设置了batch file,将输出写入临时文件,然后再写入标准输出,以便检查不可打印的字符,空格和换行符。 但一切看起来应该是这样。 我也尝试使用set / p hack去除输出中最后一行的尾部换行符,但是无济于事 – 插件从未出现在列表中。 每次修改batch file时,我都重新启动了Munin服务。
那么Munin-node-win32有什么问题,它不喜欢我的批处理?
批量上市:
@echo off set OUTFILE=%TEMP%\munin-rdsessions.output if "%1" == "config" goto config if "%1" == "name" (echo rdsessions && goto end) for /F "usebackq delims=, tokens=2,3,4" %%a IN (`typeperf -sc 1 "Terminaldienste\Sitzungen insgesamt" "Terminaldienste\Aktive Sitzungen" ^| find /V "(PDH-CSV"`) do ( echo total.value %%a>%OUTFILE% echo active.value %%b>>%OUTFILE% echo .>>%OUTFILE% ) type %OUTFILE% goto end :config type "%~dpn0.conf" goto end :end
事实certificate,munin-node-win32对“名称”输出结尾处的空格非常谨慎。 所以看起来像这样的一条线
if "%1" == "name" (echo rdsessions && goto end)
会导致munin-node-win32简单地吞下插件定义。 echo调用结束处的空白区域必须被删除才能工作:
if "%1" == "name" (echo rdsessions&&goto end)