nagios
和cacti不适合超大规模的监控、由于大规模的带宽和网络限制,会导致监控的延迟等问题,所以有很多是nagios+cacti整合,但是依然不适合在大规模的环境中,不适合分布式部署,Nagios在大规模中就会出现延迟,失去Nagios本事的特色。
警告,基于状态的警告:OK,Warning(警告),critical(关键),unknown(未知)
插件去检测服务器状态,同时Nagios会维持一个队列,所有插件返回来的状态信息都进入队列,Nagios每次都从队首开始读取信息,并进行处理后,把状态结果通过web显示出来。
/libexec里放有nagios自带的可以使用的所有插件,如,check_disk是检查磁盘空间的插件,check_load是检查CPU负载的,等等。每一个插件可以通过运行./check_xxx –h 来查看其使用方法和功能。
- [root@XueGod63 ~]# yum install -y gccglibc glibc-common php gd gd-devel libpng libmng libjpeg zlib
- [root@XueGod63 ~]# yum install -y httpd ;service httpd restart
- [root@XueGod63 ~]# useraddnagios //建立Nagios用户,这里不能使用nologin的shell,nagios会用到
- [root@XueGod63 ~]# groupadd nagcmd //建立一个组
- [root@XueGod63 ~]# usermod -G nagcmd nagios //将Nagios和apache加入该组
- [root@XueGod63 ~]# usermod -G nagcmdapache
- [root@XueGod63 ~]# mkdirNagios //所有软件包放在此目录下
- [root@XueGod63~]# cd Nagios ; ls
- nagios-3.5.1.tar.gz nrpe-2.15.tar.gz
- nagios-plugins-2.1.1.tar.gz vautour_style.zip
- [root@XueGod63 Nagios]# tar xvfnagios-3.5.1.tar.gz -C /usr/local/src/
- [root@XueGod63 Nagios]# cd/usr/local/src/nagios/
[root@XueGod63nagios]# ./configure –with-command-group=nagcmd //指定Nagios运行用户组……General Options:————————-Nagiosexecutable: nagiosNagiosuser/group: nagios,nagios #运行用户Commanduser/group: nagios,nagcmd #运行用户组EmbeddedPerl: noEventBroker: yesInstall
${prefix}: /usr/local/Nagios #默认安装到了/usr/local/nagiosLockfile:
${prefix}/var/nagios.lockCheck result directory:
${prefix}/var/spool/checkresultsInitdirectory: /etc/rc.d/init.dApache conf.d directory: /etc/httpd/conf.d #Apache的conf.d配置文件目录Mailprogram: /bin/mailHostOS: linux-gnu
Web Interface Options:————————HTMLURL:
http://localhost/nagios/ #登陆地址CGIURL:
http://localhost/nagios/cgi-bin/Traceroute (used by WAP): /bin/tracerouteReview the options above foraccuracy. If they look okay,type
‘make all‘ to compile the main program andCGIs.
[root@XueGod63 nagios]# makeall//根据上面提示,Make all,下图出现,就无问题** Compile finished ***
If the main program and CGIs compiledwithout any errors, youcan continue with installing Nagios asfollows (
type‘make‘without any arguments for a list of allpossible options):#下面已经提示安装步骤,我们就使用这个步骤来操作
make install– This installs the main program, CGIs, and HTML files
make install-init– This installs the init scriptin /etc/rc.d/init.d
make install-commandmode– This installs and configurespermissions on thedirectoryfor holding the external command file
make install-config– This installs *SAMPLE* config files in /usr/local/nagios/etcYou‘ll have to modify thesesample files before you canuseNagios. Read the HTML documentation for more infoondoing this. Pay particular attention to the docs onobjectconfiguration files, as they determine what/howthingsget monitored!
make install-webconf– This installs the Apache config filefor the Nagioswebinterface
make install-exfoliation #主题相关,不需要安装– This installs the Exfoliation themefor the Nagioswebinterface
make install-classicui #主题相关,不需要安装,安装到web-conf就可以了– This installs the classic theme for theNagioswebinterface*** Support Notes*******************************************
If you have questions about configuring orrunning Nagios,please make sure that you:
– Look atthe sample config files– Read thedocumentation on the Nagios Library at:
http://library.nagios.com
before you post a question to one of themailing lists.Also make sure to include pertinentinformation that couldhelp others help you. Thismight include:
– Whatversion of Nagios you are using– Whatversion of the plugins you are using– Relevantsnippets from your config files– Relevanterror messages from the Nagios log file
For more information on obtaining supportfor Nagios, visit:
http://support.nagios.com
*************************************************************
Enjoy.
- [root@XueGod63 nagios]# make install && make install-init && makeinstall-commandmode && make install-config && makeinstall-webconf
//若是单步执行,每次执行一部,都会提示你下一步需要干什么,非常easy//make install安装生成/usr/local/nagios/,其中/usr/local/nagios/share即nagiosWEB访问界面的站点目录//makeinstall-init 安装生成/etc/rc.d/init.d/nagios 启动脚本//makeinstall-config 安装生成/usr/local/nagios/etc下的nagios相关配置文件//makeinstall-commandmode 设定相应nagios工作目录的权限//makeinstall-webconf 安装Nagios的WEB配置文件到Apache的conf.d目录下
- [root@XueGod63nagios]# cd /root/Nagios ; ls /usr/local/nagios/share/
config.inc.php docs includes js media rss-corefeed.php side.php stylesheetscontexthelp images index.php main.php robots.txt rss-newsfeed.php ssi
- 在make install-init的时候,生存了启动脚本
- [root@XueGod63Nagios]# ls /etc/init.d/nagios
- /etc/init.d/nagios #其实就是在/etc/rc.d/init.d/nagios
- 在make install-config的时候,生成了Nagios的相关配置文件
- [root@XueGod63Nagios]# ls /usr/local/nagios/etc/
- cgi.cfg nagios.cfg objects resource.cfg
- #包括以后安装了plugin等软件后,配置文件也会放入此目录
- [root@XueGod63Nagios]# ls /etc/httpd/conf.d/nagios.conf
- [root@XueGod63Nagios]# vim /etc/httpd/conf.d/nagios.conf
[root@XueGod63 Nagios]# ll/usr/local/nagios/bin #Nagios执行程序所在目录etc #nagios配置文件所在目录,初始安装只有几个*.cfg文件libexec #监控所用命令,需要安装了nagios-plugins插件了才会有,检测命令,不装是空的sbin #Nagios的Cgi文件所在目录,外部命令所需要的文件存放目录share #Nagios前端页面var #日志文件,pid文件等
[root@XueGod63 Nagios]# vim/usr/local/nagios/etc/nagios.cfglog_file=/var/log/nagios/nagios.log #日志位置cfg_file=/etc/nagios/objects/commands.cfg #这个文件定义了很多命令cfg_file=/etc/nagios/objects/contacts.cfg #定义联系人,怎么联系cfg_file=/etc/nagios/objects/timeperiods.cfg #定义了时间段cfg_file=/etc/nagios/objects/templates.cfg #模板(联系人,主机,时间)cfg_file=/etc/nagios/objects/localhost.cfg #监控本机相关配置文件#cfg_file=/etc/nagios/objects/windows.cfg #windows,默认不监控#cfg_file=/etc/nagios/objects/switch.cfg #交换机路由器监控,默认不监控#cfg_file=/etc/nagios/objects/printer.cfg #打印机监控,默认不监控
#cfg_dir=/etc/nagios/servers #定义了服务合集(多个使用)#cfg_dir=/etc/nagios/printers #定义了打印机合集(多个使用)#cfg_dir=/etc/nagios/switches #定义了交换合集(多个使用)#cfg_dir=/etc/nagios/routers #定义了路由合集(多个使用)resource_file=/etc/nagios/private/resource.cfg 资源变量配置文件,包括$USER1$变量(一个路径)等status_update_interval=
10 #状态更新时间,单位slog_rotation_method=
d #日志滚动,默认天service_check_timeout=
60 #服务检查超时时间host_check_timeout=
30 #主机检查超时时间event_handler_timeout=
30notification_timeout=
30ocsp_timeout=
5perfdata_timeout=
5
[root@XueGod63 Nagios]# vim/usr/local/nagios/etc/cgi.cfg//此配置文件比nagios.cfg优先级高main_config_file=
/usr/local/nagios/etc/nagios.cfg
#主配置文件physical_html_path=
/usr/local/nagios/share
#物理路径url_html_path=/nagios #在URL后面加上/nagios才能访问use_authentication=
1 #使用认证use_ssl_authentication=
0 #不使用sslauthorized_for_system_information=nagiosadmin #认证用户
- [root@XueGod63Nagios]# service httpd restart
- [root@XueGod63Nagios]# vim /etc/httpd/conf.d/nagios.conf
- Alias /nagios “/usr/local/nagios/share”
- <Directory “/usr/local/nagios/share”>
- # SSLRequireSSL
- Options None
- AllowOverride None
- Order allow,deny
- Allow from all
- # Order deny,allow
- # Deny from all
- # Allow from 127.0.0.1
- AuthName “Nagios Access” #这三个字段,就是访问nagios的认证用户名和密码相关配置
- AuthType Basic
- AuthUserFile /usr/local/nagios/etc/htpasswd.users
- Require valid-user
- </Directory>
- 在Directory字段里面有Auth这三个字段,那么就可以使用htpasswd来生成用户名和密码
- [root@XueGod63Nagios]# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
- -c表示创建,二次添加用户,不能使用-c参数
- [root@XueGod63 Nagios]# cat /usr/local/nagios/etc/htpasswd.users
- nagionsadmin:HQolRVjV67MiQ #密码
- [root@XueGod63Nagios]# service httpd restart //再次测试(我的用户名是nagiosadmin,密码123456)
- ##nagios 默认使用nagiosadmin来管理,如果使用其他用户名,对应的配置文件也要修改
- [root@XueGod63 Nagios]#/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
- -v=–verify-config 验证配置文件是否有误,着重看到下图亮点就没问题
- Total Warnings:0
- Total Errors: 0
- [root@XueGod63 Nagios]#/usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
- [root@XueGod63 Nagios]# tar xvfnagios-plugins-2.1.1.tar.gz -C /usr/local/src/
- [root@XueGod63 Nagios]# cd/usr/local/src/nagios-plugins-2.1.1/
- [root@XueGod63 nagios-plugins-2.1.1]#./configure –with-nagios-user=nagios –with-nagios-group=nagcmd
- [root@XueGod63 nagios-plugins-2.1.1]# make&& make install ; cd /root/Nagios/
- [root@XueGod63 Nagios]# ls/usr/local/nagios/libexec/ //已经有了很多check命令
- check_apt check_ftp check_mailq check_oracle check_ssmtp
- check_breeze check_http check_mrtg check_overcr check_swap
- check_by_ssh check_icmp check_mrtgtraf check_pgsql check_tcp
- check_clamd check_ide_smart check_mysql check_ping check_time
- check_cluster check_ifoperstatus check_mysql_query check_pop check_udp
- ……
- [root@XueGod63Nagios]# service httpd restart ; service nagios restart
定义主机—定义服务 –定义监控命令—检查配置文件—启动Nagios)
- [root@XueGod63Nagios]# cd /usr/local/nagios/etc/objects
- [root@XueGod63objects]# cp localhost.cfglocalhost.cfg.bak //备份配置文件
- [root@XueGod63objects]# vim localhost.cfg
- define service{
- use local-service
- host_name localhost
- service_description NFS
- check_command check_tcp!2049
- }
##在使用check命令之前,要确保下/usr/local/nagios/libexec/ 目录下有没有你需要的check命令,如果有,直接调用,如果没有,检测端口来代替,检测格式: check_tcp!端口号
- [root@XueGod63 objects]#vim/etc/exports //创建一个共享
- /tmp *(rw)
- [root@XueGod63objects]# /etc/init.d/nfs restart
- [root@XueGod63objects]# showmount -e192.168.1.63 //检测NFS目前是否正常
- Export list for 192.168.1.63:
- /tmp *
- [root@XueGod63objects]# vim /usr/local/nagios/etc/nagios.cfg
- cfg_file=/usr/local/nagios/etc/objects/localhost.cfg #localhost默认已经启用了
- [root@XueGod63objects]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
- Total Warnings:0
- Total Errors: 0
- [root@XueGod63objects]# service nagiosrestart //重启nagios服务
- [root@XueGod63objects]# service nfsstop //再观察
- [root@xuegod63 ~]# unzip vautour_style.zip-d /usr/local/nagios/share/
- Archive: vautour_style.zip
- replace /usr/local/nagios/share/images/ack.gif?[y]es, [n]o, [A]ll, [N]one, [r]ename: A
- inflating: /usr/local/nagios/share/images/ack.gif
定义主机,定义服务,定义命令】
- [root@XueGod64 ~]# yum install -ymysql-server mysql
- [root@XueGod64 ~]# service mysqld restart
- [root@XueGod64 ~]#mysql //登陆创建一个测试数据库
- mysql> create database nagiosdb;
- mysql> grant select on nagiosdb.* to nagiosdb@‘192.168.1.63‘;
- mysql> exit
- [root@XueGod63 objects]# vim/usr/local/nagios/etc/nagios.cfg
- # Definitions for monitoring the local(Linux) host
- cfg_file=/usr/local/nagios/etc/objects/localhost.cfg #在这两行下面添加下面两行
- cfg_file=/usr/local/nagios/etc/objects/hosts.cfg
- cfg_file=/usr/local/nagios/etc/objects/service.cfg
yum install mysqlmysql-devel
- [root@XueGod64 ~]# service mysqldstop //XueGod64停到服务再检测
- [root@XueGod63 objects]#/usr/local/nagios/libexec/check_mysql -H 192.168.0.64 -u nagiosdb -d nagiosdb
- can‘t connect to MySQL server on ‘192.168.0.64‘ (111)
前段测试
- [root@XueGod63 objects]# servicenagios restart
- [root@XueGod64 ~]# service mysqld start
去停掉数据库[root@XueGod64 ~]# service mysqldstop
:/usr/local/nagios/libexec/check_tcp-H 192.168.0.64 -p 80
- [root@XueGod63 objects]# vim hosts.cfg
- define host{
- use linux-server #使用的模板名字
- alias apache-Server #别名
- address 192.168.0.64 #IP地址
- icon_image server.gif #/usr/local/nagios/share/images/logos有各种图片
- statusmap_imageserver.gd2 #状态图
- 2d_coords 500,200 #2D图形坐标
- 3d_coords 500,200,100 #3D图形坐标
- }<span style=”line-height: 1.5; “> </span>
- [root@XueGod63 objects]# vim service.cfg
- define service{
- use local-service
- host_name xuegod64
- service_description apache
- check_command check_apache
- }
- [root@XueGod63 objects]# service nagios restart
- [root@XueGod63 Nagios]#
- [root@XueGod64 ~]# yum install -y opensslopenssl-devel
- [root@XueGod63 Nagios]# tar xvfnrpe-2.15.tar.gz -C /usr/local/src/
- [root@XueGod63 Nagios]# cd/usr/local/src/nrpe-2.15/
- [root@XueGod63 nrpe-2.15]# ./configure&& make && make install
- [root@XueGod63 nrpe-2.15]# makeinstall-plugin && make install-daemon
- //前者安装插件,后者以守护经常来运行
- [root@XueGod63 nrpe-2.15]# cd/root/Nagios/ ; ls /usr/local/nagios/libexec/check_nrpe
- /usr/local/nagios/libexec/check_nrpe #这个命令需要安装nrpe之后才有
- [root@XueGod63 objects]# cd /root/Nagios/
- [root@XueGod63 Nagios]# scpnagios-plugins-2.1.1.tar.gz nrpe-2.15.tar.gz root@192.168.0.64:/root
- [root@XueGod64 ~]# useradd -s/sbin/nologin nagios
- [root@XueGod64 ~]# groupadd nagcmd
- [root@XueGod64 ~]# usermod -G nagcmdnagios
- [root@XueGod64 ~]# tar xvfnagios-plugins-2.1.1.tar.gz -C /usr/local/src/
- [root@XueGod64 ~]# tar xvf nrpe-2.15.tar.gz-C /usr/local/src/
- [root@XueGod64 ~]# cd/usr/local/src/nagios-plugins-2.1.1/
- [root@XueGod64 nagios-plugins-2.1.1]#./configure && make && make install
- [root@XueGod64 nagios-plugins-2.1.1]# cd../nrpe-2.15/
- [root@XueGod64 nrpe-2.15]# ./configure&& make && make install
- [root@XueGod64 nrpe-2.15]# makeinstall-daemon-config //这里是客户端,不用make-install-plugin
- [root@XueGod64 nrpe-2.15]# makeinstall-xinetd
- [root@XueGod64 nrpe-2.15]# yum install -yxinetd ; cd
- [root@XueGod64 ~]# vim /etc/xinetd.d/nrpe
- # default: on
- # description: NRPE (Nagios Remote PluginExecutor)
- service nrpe
- {
- flags = REUSE
- socket_type = stream
- port =5666
- wait = no
- user = nagios
- group = nagios
- server =/usr/local/nagios/bin/nrpe
- server_args = -c /usr/local/nagios/etc/nrpe.cfg –inetd
- log_on_failure += USERID
- disable = no
- only_from =127.0.0.1192.168.1.63 # #添加红色 nagios服务器地址, 允许235这台机器来连接自己的nrpe服务,多个IP地址空格分隔
- }
- nrpe 5666/tcp # NRPE
- #/etc/services文件的作用:
- #作用1:xinet.d来启动服务时他就会在/etc/services找相应服务对应的端口来启动服务。找不到对应端口,将不启动服务。
- #作用2: 显示对应端口对应的协议名。
- #例如 iptables -L 不加-n参数, 查看时,把 80转 -> www http
- #作用3:查看常用端口
- [root@XueGod64 ~]# /etc/init.d/xinetdrestart
- [root@XueGod64 ~]# chkconfig xinetd on
- [root@XueGod64 ~]# netstat -antup | grep5666
- tcp 0 0:::5666 :::* LISTEN 68667/xinetd
- [root@XueGod64 ~]# vim/usr/local/nagios/etc/nrpe.cfg
- command[check_sda1]=/usr/local/nagios/libexec/check_disk -w 38% -c 35% -p /dev/sda1
- command[check_sda2]=/usr/local/nagios/libexec/check_disk -w 42% -c 43% -p /dev/sda2
- command[check_swap]=/usr/local/nagios/libexec/check_swap -w 20% -c 10%
- #-w为警告 -C为告急 sda2中,我们是指占用42%
- [root@XueGod64 ~]# service xinetdrestart
- [root@XueGod63 Nagios]#/usr/local/nagios/libexec/check_nrpe -H 192.168.0.64
- NRPE v2.15
- [root@xuegod63 ~]#/usr/local/nagios/libexec/check_nrpe -H 192.168.0.64 -c check_sda1
- DISK OK – free space: /boot 2700 MB (98%inode=99%);| /boot=38MB;1790;1877;0;2888#如果出现以一下错误,说明没有允许192.168.1.63 访问我们的64服务器
- #CHECK_NRPE: Error – Could not completeSSL handshake.
- #我们需要检查/etc/init.d/nrpe 下面的onlyfrom中的有无添加
- [root@XueGod63 Nagios]# cd/usr/local/nagios/etc/objects/
- [root@XueGod63 objects]# vim hosts.cfg
- define host{
- use linux-server
- host_name xuegod64
- alias MySQL-Server
- address 192.168.0.64
- }
- [root@XueGod63 objects]# vim service.cfg
- define service{
- use local-service
- host_name xuegod64
- service_description Root Partition
- check_command check_nrpe!check_sda2 #/root分区
- }
- define service{
- use local-service
- host_name xuegod64
- service_description TotalProcesses #进程总数
- check_command check_nrpe!check_total_procs
- }
- define service{
- use local-service
- host_name xuegod64
- service_description CurrentLoad #负载
- check_command check_nrpe!check_load
- }
[root@XueGod63 objects]# vim commands.cfgdefine command{command_name check_nrpecommand_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$}
- [root@XueGod63 objects]# service nagiosrestart
- [root@XueGod64 ~]# dd if=/dev/zero of=1.txt count=100 bs=30M
- [root@XueGod64 ~]# rm -rf * //清除这些临时测试文件
- root@XueGod63 Nagios]# yum install -y sendmail
- [root@XueGod63 Nagios]# /etc/init.d/sendmail start
- [root@XueGod63 Nagios]# chkconfig sendmail on
- #如果主机配置了多个邮件服务,设置sendmail为默认的发件服务:
- alternatives –config mta
- root@XueGod63 Nagios]# cd /usr/local/nagios/etc/objects/
- [root@XueGod63 objects]# vim contacts.cfg
- define contact{
- contact_name nagiosadmin
- use generic-contact
- alias Nagios Admin
- email nagiostest@163.com #修改为自己的邮箱
- }
- [root@XueGod63 objects]# service nagios restart
- [root@XueGod64 ~]# service mysqld restart //XueGod64上的数据库启动
- [root@XueGod64 ~]# /etc/init.d/mysqld stop //然后再停掉,测试能否触发邮件
强制检测,避免时间等待
1. 下载安装windows代理插件
2. 修改配置文件:
3. 启动服务:
1. 修改主配置文件,启用监控windows配置文件:
2. 编辑这个配置文件,修改监控主机信息:
- vim/usr/local/nagios/etc/objects/service.cfg
加入下面的服务定义以监控Windows机器的启动后运行时间。define service{ use generic-service host_name winserver service_description Uptime check_command check_nt!UPTIME }
加入下面的服务定义可监控Windows机器的CPU利用率,并在5分钟CPU负荷高于90%时给出一个紧急警报或是高于80%时给出一个告警警报。define service{ use generic-service host_name winserver service_description CPU Load check_command check_nt!CPULOAD!-l 5,80,90 }
加入下面的服务定义可监控Windows机器的内存占用率,并在5分钟内存占用率高于90%时给出一个紧急警报或是高于80%时给出一个告警警报。define service{ use generic-service host_name winserver service_description Memory Usage check_command check_nt!MEMUSE!-w 80 -c 90 }
加下面的服务定义可监控Windows机器的C:盘的磁盘利用率,并在磁盘利用率高于90%时给出一个紧急警报或是高于80%时给出一个告警警报。define service{ use generic-service host_name winserver service_description C:\ Drive Space check_command check_nt!USEDDISKSPACE!-l c -w 80 -c 90 }
加入下面的服务定义可监控Windows机器上的W3SVC服务状态,并在W3SVC服务停止时给出一个紧急警报。define service{ use generic-service host_name winserver service_description W3SVC check_command check_nt!SERVICESTATE!-d SHOWALL -l W3SVC }
加入下面的服务定义可监控Windows机器上的Explorer.exe进程,并在进程没有运行时给出一个紧急警报。define service{use generic-service host_name winserver service_description Explorer check_command check_nt!PROCSTATE!-d SHOWALL -l Explorer.exe }
4. 定义监控命令:
- vi /usr/local/nagios/etc/commands.cfg
##这个命令已经存在,只需要添加 -s 123456 就可以指定密码。define command{command_name check_ntcommand_line $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -s 123456 -v $ARG1$ $ARG2$}
- [root@XueGod63Nagios]# yum install -y rrdtool php-gd perl-Time-HiRes
- [root@XueGod63Nagios]# tar xvf pnp4nagios-0.6.25.tar.gz
- [root@XueGod63Nagios]# cd pnp4nagios-0.6.25
- [root@XueGod63pnp4nagios-0.6.25]# ./configure –prefix=/usr/local/pnp4nagios–with-nagios-user=nagios –with-nagios-group=nagcmd
- [root@XueGod63pnp4nagios-0.6.25]# make all && make install && makeinstall-webconf && make install-config && make install-init
- [root@XueGod63pnp4nagios-0.6.25]# make fullinstall
[root@XueGod63pnp4nagios]# vim /usr/local/nagios/etc/nagios.cfg#修改以下几个内容…process_performance_data=1 #修改…host_perfdata_command=process-host-perfdata #取消注释service_perfdata_command=process-service-perfdata…
[root@XueGod63pnp4nagios]# vim /usr/local/nagios/etc/objects/commands.cfg#‘process-host-perfdata‘ command definitiondefinecommand{command_name process-host-perfdatacommand_line /usr/bin/perl /usr/local/pnp4nagios/libexec/process_perfdata.pl -d HOSTPERFDATA}
#‘process-service-perfdata‘ command definitiondefinecommand{command_name process-service-perfdatacommand_line /usr/bin/perl /usr/local/pnp4nagios/libexec/process_perfdata.pl}
[root@XueGod63pnp4nagios]# vim /usr/local/nagios/etc/objects/templates.cfgdefinehost {name host-pnpaction_url /pnp4nagios/index.php/graph?host=$HOSTNAME$‘ class=‘tips‘ rel=‘/pnp4nagios/index.php/popup?host=$HOSTNAME$&srv=_HOST_register 0#process_perf_data 1}
defineservice {name srv-pnpaction_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$‘class=‘tips‘rel=‘/pnp4nagios/index.php/popup?host=$HOSTNAME$&srv=$SERVICEDESC$register 0#process_perf_data 1}
- [root@XueGod63pnp4nagios]# cp ~/Nagios/pnp4nagios-0.6.25/contrib/ssi/status-header.ssi/usr/local/nagios/share/ssi/
- [root@XueGod63pnp4nagios]# vim /usr/local/nagios/etc/objects/localhost.cfg
- use local-service,srv-pnp ; Name of service #每一行加上,那么每一个服务就会有一个图标
- [root@XueGod63pnp4nagios]# mv /usr/local/pnp4nagios/share/install.php/usr/local/pnp4nagios/share/install.php.bak
- [root@XueGod63pnp4nagios]# chown -R nagios:nagios /var/www/html/ /usr/local/nagios//usr/local/pnp4nagios/
- [root@XueGod63pnp4nagios]# service nagios restart;service httpd restart; service npcd start
- Pnp4nagios提供了各种配置文件的模板,我们需要把它正名才能使用
- [root@XueGod63pnp4nagios-0.6.25]# cd /usr/local/pnp4nagios/etc/
- [root@XueGod63 etc]#mv misccommands.cfg-sample misccommands.cfg
- [root@XueGod63 etc]#mv nagios.cfg-sample nagios.cfg
- [root@XueGod63 etc]#mv rra.cfg-sample rra.cfg
- [root@XueGod63 etc]#cd pages/
- [root@XueGod63 pages]#mv web_traffic.cfg-sample web_traffic.cfg
- [root@XueGod63 pages]#cd ../check_commands/
- [root@XueGod63check_commands]# mv check_all_local_disks.cfg-sample check_all_local_disks.cfg
- [root@XueGod63check_commands]# mv check_nrpe.cfg-sample check_nrpe.cfg
- [root@XueGod63check_commands]# mv check_nwstat.cfg-sample check_nwstat.cfg
- [root@XueGod63check_commands]# /etc/init.d/npcd restart
- [root@XueGod63pnp4nagios-0.6.25]# cd /usr/local/pnp4nagios/etc/
- [root@XueGod63 etc]#mv misccommands.cfg-sample misccommands.cfg
- [root@XueGod63 etc]#mv nagios.cfg-sample nagios.cfg
- [root@XueGod63 etc]#mv rra.cfg-sample rra.cfg
- [root@XueGod63 etc]#cd pages/
- [root@XueGod63 pages]#mv web_traffic.cfg-sample web_traffic.cfg
- [root@XueGod63 pages]#cd ../check_commands/
- [root@XueGod63check_commands]# mv check_all_local_disks.cfg-sample check_all_local_disks.cfg
- [root@XueGod63check_commands]# mv check_nrpe.cfg-sample check_nrpe.cfg
- [root@XueGod63check_commands]# mv check_n