扫二维码与项目经理沟通
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流
1、安装组件
在网站制作、成都网站设计中从网站色彩、结构布局、栏目设置、关键词群组等细微处着手,突出企业的产品/服务/品牌,帮助企业锁定精准用户,提高在线咨询和转化,使成都网站营销成为有效果、有回报的无锡营销推广。创新互联专业成都网站建设十余年了,客户满意度97.8%,欢迎成都创新互联客户联系。yum install perl-Time-HiRes rrdtool rrdtool-perl
2、安装pnp4nagios-0.6.24
wget http://jaist.dl.sourceforge.net/project/pnp4nagios/PNP-0.6/pnp4nagios-0.6.24.tar.gz
tar zxvf pnp4nagios-0.6.24.tar.gz
cd pnp4nagios-0.6.24
./configure --with-nagios-user=nagios --with-nagios-group=nagcmd
make all
make install
make install-webconf
make install-config
make install-init
3、创建配置文件
cd /usr/local/pnp4nagios/etc/
mv misccommands.cfg-sample misccommands.cfg
mv nagios.cfg-sample nagios.cfg
mv rra.cfg-sample rra.cfg
cd pages
mv web_traffic.cfg-sample web_traffic.cfg
cd ../check_commands
mv check_all_local_disks.cfg-sample check_all_local_disks.cfg
mv check_nrpe.cfg-sample check_nrpe.cfg
mv check_nwstat.cfg-sample check_nwstat.cfg
4、重启服务
service npcd restart
5、修改nagios配置档
1)vi /usr/local/nagios/etc/nagios.cfg
将process_performance_data=0 修改为 process_performance_data=1
将以下两项的#去掉
host_perfdata_command=process-host-perfdata
service_perfdata_command=process-service-perfdata
2)vi /usr/local/nagios/etc/objects/commands.cfg 添加以下内容
define command{ command_name process-service-perfdata-file command_line /bin/mv /usr/local/pnp4nagios/var/service-perfdata /usr/local/pnp4nagios/var/spool/service-perfdata.$TIMET$ } define command{ command_name process-host-perfdata-file command_line /bin/mv /usr/local/pnp4nagios/var/host-perfdata /usr/local/pnp4nagios/var/spool/host-perfdata.$TIMET$ }
并将原有# 'process-host-perfdata' command definition、# 'process-service-perfdata' command definition注解删除!
3)vi /usr/local/nagios/etc/objetcs/templates.cfg
添加红色字体内容
define service{
name generic-service
active_checks_enabled 1
passive_checks_enabled 1
parallelize_check 1
obsess_over_service 1
check_freshness 0
notifications_enabled 1
event_handler_enabled 1
flap_detection_enabled 1
failure_prediction_enabled 1
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 10
retry_check_interval 2
contact_groups admins
notification_options w,u,c,r
notification_interval 60
notification_period 24x7
register 0
action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$
process_perf_data 1
}
4)vi /usr/local/nagios/etc/nagios.cfg 修改参数如下
# Bulk / NPCD mode # process_performance_data=1 # *** the template definition differs from the one in the original nagios.cfg # service_perfdata_file=/usr/local/pnp4nagios/var/service-perfdata service_perfdata_file_template=DATATYPE::SERVICEPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tSERVICEDESC::$SERVICEDESC$\tSERVICEPERFDATA::$SERVICEPERFDATA$\tSERVICECHECKCOMMAND::$SERVICECHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$\tSERVICESTATE::$SERVICESTATE$\tSERVICESTATETYPE::$SERVICESTATETYPE$ service_perfdata_file_mode=a service_perfdata_file_processing_interval=15 service_perfdata_file_processing_command=process-service-perfdata-file # *** the template definition differs from the one in the original nagios.cfg # host_perfdata_file=/usr/local/pnp4nagios/var/host-perfdata host_perfdata_file_template=DATATYPE::HOSTPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tHOSTPERFDATA::$HOSTPERFDATA$\tHOSTCHECKCOMMAND::$HOSTCHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$ host_perfdata_file_mode=a host_perfdata_file_processing_interval=15 host_perfdata_file_processing_command=process-host-perfdata-file
6、检查配置是否有误
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
重启服务
service nagios restart
service httpd restart
7、排错
pnp4nagios输入用户名密码始终不正确具体解决方法
是由于在安装pnp4nagios后在/etc/httpd/conf.d里,已经生成pnp4nagios.conf配置文件
vi /etc/httpd/conf.d/pnp4nagios.conf 将AuthUserFile /usr/local/nagios/etc/htpasswd.user修改为 /usr/local/nagios/etc/htpasswd
The requested URL /nagios/pnp4nagios/index.php/graph was not found on this server
开启apache的php功能
vi /usr/local/httpd/conf/httpd.conf
查找字符串AddType,并增加
AddType application/x-httpd-php .php .php3 .htm .phtml .php4
AddType application/x-httpd-php-source .phps
查找字符串DirectoryIndex,并修改为
DirectoryIndex index.html index.php3 index.php default.php
将/etc/httpd/conf.d/pnp4nagios.conf所有内容复制到/etc/httpd/conf/httpd.conf后面
service httpd restart
perfdata directory "/usr/local/pnp4nagios/var/perfdata/localhost" for host "does not。。。。
chown -R nagios.nagcmd /usr/local/pnp4nagios/var/
另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流