Nagios 安装PNP(类似Cacti)绘图查看监控主机
Nagios 安装过程请看 http://bbs.linuxtone.org/thread-2201-1-1.html 这里省略
下载pnp-0.4.13.tar.gz
tar zvxf pnp-*
cd pnp*
./configure
当显示出以下信息,就表示配置正常
*** Configuration summary for pnp 0.4.13 02-19-2009 ***
General Options:
------------------------- -------------------
Nagios user/group: nagios nagios
Install directory: /usr/local/nagios
HTML Dir: /usr/local/nagios/share/pnp
Config Dir: /usr/local/nagios/etc/pnp
Path to rrdtool: /usr/bin/rrdtool (Version 1.2.30)
RRDs Perl Modules: FOUND (Version 1.203)
RRD Files stored in: /usr/local/nagios/share/perfdata
process_perfdata.pl Logfile: /usr/local/nagios/var/perfdata.log
Perfdata files (NPCD) stored in: /usr/local/nagios/var/spool/perfdata/
make all && make install
make install-config && make install-init
我这里安装的时nagios 3.0.6,所以要在templates.cfg 的最后添加
define host {
name host-pnp
register 0
action_url /nagios/pnp/index.php?host=$HOSTNAME$
}
define service {
name srv-pnp
register 0
action_url /nagios/pnp/index.php?host=$HOSTNAME$&srv=$SERVICEDESC$
}
Since Nagios 3.x it is possible to deactivate the export of environment variables (as part of optimizing the system for maximum performance). Unfortunately this directive has to be enabled to use the default mode. So either you use the default value (which means that the export is enabled) or you define the variable in nagios.cfg
enable_environment_macros=1Additionally the command to process performance data is to be specified in nagios.cfg
service_perfdata_command=process-service-perfdataStarting with Nagios 3.0 it may be useful to enable processing of performance data for hosts as well. Due to changed host check logic Nagios 3 now performs regularly scheduled host checks.
host_perfdata_command=process-host-perfdata
在commands.cfg 添加一下
define command {
command_name process-service-perfdata
command_line /usr/bin/perl /usr/local/nagios/libexec/process_perfdata.pl
}
define command {
command_name process-host-perfdata
command_line /usr/bin/perl /usr/local/nagios/libexec/process_perfdata.pl -d HOSTPERFDATA
}
在一个要使用pnp监控的主机配置文件里,比如 localhost.cfg 修改以下内容
define host{
use linux-server,host-pnp
host_name localhost
alias localhost
address 127.0.0.1
action_url /nagios/pnp/index.php?host=$HOSTNAME$
process_perf_data 1
}
define service{
use local-service,srv-pnp host_name localhost
service_description PING
check_command check_ping!100.0,20%!500.0,60%
process_perf_data 1
}
以此类推,祝大家好运!
附上流量监控
下载pnp-0.4.13.tar.gz
tar zvxf pnp-*
cd pnp*
./configure
当显示出以下信息,就表示配置正常
*** Configuration summary for pnp 0.4.13 02-19-2009 ***
General Options:
------------------------- -------------------
Nagios user/group: nagios nagios
Install directory: /usr/local/nagios
HTML Dir: /usr/local/nagios/share/pnp
Config Dir: /usr/local/nagios/etc/pnp
Path to rrdtool: /usr/bin/rrdtool (Version 1.2.30)
RRDs Perl Modules: FOUND (Version 1.203)
RRD Files stored in: /usr/local/nagios/share/perfdata
process_perfdata.pl Logfile: /usr/local/nagios/var/perfdata.log
Perfdata files (NPCD) stored in: /usr/local/nagios/var/spool/perfdata/
make all && make install
make install-config && make install-init
- Nagios 2.x
- Until nagios 2.10 the integration of external URLs into the nagios web interface occurs using Extended Info Objects. For PNP we use the directive action_url to call the PNP web frontend with the appropriate options.
- define serviceextinfo {
- host_name localhost
- service_description load
- action_url /nagios/pnp/index.php?host=$HOSTNAME$&srv=$SERVICEDESC$
- }
- Nagios 3.x
- Since nagios 3.0 the action_url-directive has be moved to the host or service definition. The objects serviceextinfo and hostextinfo do not apply anymore. This way the definition of URLs to the PNP-interface have been simplified.
- define host {
- name host-pnp
- register 0
- action_url /nagios/pnp/index.php?host=$HOSTNAME$
- }
- define service {
- name srv-pnp
- register 0
- action_url /nagios/pnp/index.php?host=$HOSTNAME$&srv=$SERVICEDESC$
- }
我这里安装的时nagios 3.0.6,所以要在templates.cfg 的最后添加
define host {
name host-pnp
register 0
action_url /nagios/pnp/index.php?host=$HOSTNAME$
}
define service {
name srv-pnp
register 0
action_url /nagios/pnp/index.php?host=$HOSTNAME$&srv=$SERVICEDESC$
}
Since Nagios 3.x it is possible to deactivate the export of environment variables (as part of optimizing the system for maximum performance). Unfortunately this directive has to be enabled to use the default mode. So either you use the default value (which means that the export is enabled) or you define the variable in nagios.cfg
enable_environment_macros=1Additionally the command to process performance data is to be specified in nagios.cfg
service_perfdata_command=process-service-perfdataStarting with Nagios 3.0 it may be useful to enable processing of performance data for hosts as well. Due to changed host check logic Nagios 3 now performs regularly scheduled host checks.
host_perfdata_command=process-host-perfdata
在commands.cfg 添加一下
define command {
command_name process-service-perfdata
command_line /usr/bin/perl /usr/local/nagios/libexec/process_perfdata.pl
}
define command {
command_name process-host-perfdata
command_line /usr/bin/perl /usr/local/nagios/libexec/process_perfdata.pl -d HOSTPERFDATA
}
在一个要使用pnp监控的主机配置文件里,比如 localhost.cfg 修改以下内容
define host{
use linux-server,host-pnp
host_name localhost
alias localhost
address 127.0.0.1
action_url /nagios/pnp/index.php?host=$HOSTNAME$
process_perf_data 1
}
define service{
use local-service,srv-pnp host_name localhost
service_description PING
check_command check_ping!100.0,20%!500.0,60%
process_perf_data 1
}
以此类推,祝大家好运!
附上流量监控
bbs.linuxtone.org_pnp-1.jpg_09032219488a3357f4badca41a.jpg (69.63 KB, 下载次数: 4)
bbs.linuxtone.org_pnp-2.jpg_0903221948e3c3bd234f0a7f2f.jpg (73.54 KB, 下载次数: 5)
bbs.linuxtone.org_pnp-3.jpg_0903221948a01fd007c38a1e49.jpg (61.81 KB, 下载次数: 7)
bbs.linuxtone.org_pnp-4.jpg_090322194884b454da0d9eff3d.jpg (65.18 KB, 下载次数: 6)
bbs.linuxtone.org_pnp-5.jpg_0903221948dd1037e5f9590e54.jpg (65.18 KB, 下载次数: 8)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
学习了 收藏先