Nagios 安装与功能拓展全解析
Nagios 是一款强大的网络监控工具,下面将详细介绍其操作理论、安装步骤以及相关的补丁应用。
操作理论
性能数据包装器
以下是一个为所有插件添加性能数据功能的包装器脚本:
#!/bin/sh #a wrapper which adds perfdata functionality to any nagios plugin #link pluginName_wrapper to this script for it to work #for example, if you want to enable perfdata for check_mem #you would 'ln -s check_wrapper_generic check_mem_wrapper' #get rid of the 'wrapper' on the end of the name NAME=`echo $0 | sed -e 's/_wrapper//'` #call the plugin and capture it's output OUTPUT=`${NAME} $@` #capture it’s return code too CODE=$? #parrot the plugin's output back to stdout twice, seperated with a pipe echo "${OUTPUT}|${OUTPUT}" #exit with the same code that plugin would have exited with exit ${CODE}