Installation of Pnp4nagios

Source: Internet
Author: User
Tags php session php template rrdtool perl script

There are a number of solutions in Nagios, such as the one that Nagiosgraph once said, and the need to see: http://jim123.blog.51cto.com/4763600/ 1956268, and here's the other more commonly used Nagios charting solutions, and here we have to say that good performance in Nagios comes from Perl, So in Nagios's charting solution, putting Nagios data in MySQL or other data is not necessarily better than putting it directly on disk, so the Nagios diagram plugin used here is Pnp4nagios, Like Nagiosgraph, Pnp4nagios also uses the RRDtool database to display Nagios data, unlike Nagiosgraph's front end, which uses Perl, while Pnp4nagios is PHP. This makes the interface with Pnp4nagios more intuitive and better-looking than nagiosgraph, and most of the Nagios charts used are pnp4nagios. Pnp4nagios This name is because there are 4 modes of operation under Pnp4nagios: Synchronous mode, bulk mode, NPCD mode with bulk and Npcdmod mode with bulk, 4 modes are as follows:

Synchronous mode: Time mode, simplest and easiest to configure, Nagios invokes a Perl script when it detects every host or service Process_ perfdata.pl to process the obtained PerfData data, this mode can handle 1000 or less, and the detection interval is 5 minutes of service. BUKL mode: Centralized processing mode, Nagios writes the required data to a temporary file, and then uses Nagios to call process_perfdata.pl to process it once. This mode has a higher performance than the first, but it also poses some risks, and nagios blocks. Bulk mode with NPCD: The PerfData file is timed to be a time-stamped file, which is then processed by the NPCD process on the perfdata of the MV. This mode has high performance and is independent of nagios and does not affect Nagios performance. Bulk mode with Npcdmod: Similar to the third, but using the Nagios embedded module.

Here can be based on the actual situation to choose the appropriate mode, Pnp4nagios recommended in the official website (http://docs.pnp4nagios.org/) Download the latest version, so that the template is the most graphics, installation is simple, as follows:

[Email protected] pnp4nagios-0.6.26]# yum-y install rrdtool perl-rrdtool perl-time-hires Perl-uri perl-string-crc32 per L-io-socket-inet6 Perl-socket6[[email protected] src]# TAR-ZXVF pnp4nagios-0.6.26.tar.gz && CD Pnp4nagios-0.6.26[[email protected] pnp4nagios-0.6.26]#./configure--prefix=/usr/local/pnp4nagios-- With-nagios-user=nagios--with-nagios-group=nagcmd# Here the Nagios user group can be based on the user group that Nagios is installing, or you can not specify a file group to modify later [[email Protected] pnp4nagios-0.6.26]# make all && make Fullinstall

After installation, you can find the file description that needs to be modified in the ETC directory under the specified perfix path.

[[email protected] pnp4nagios-0.6.26]# cd /usr/local/pnp4nagios/etc/[[email protected ] etc]# cat nagios.cfg-sample# himself choose a mode, where the choice is bulk mode, the contents of bulk copy to the Nagios nagios.cfg [email  protected] etc]# vim /usr/local/nagios/etc/nagios.cfg ... Slightly ... #php4nagiosprocess_performance_data =1service_perfdata_file=/usr/local/pnp4nagios/var/service-perfdataservice _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=aservice_perfdata_file_processing_interval=15service_perfdata_file_processing_ Command=process-service-perfdata-filehost_perfdata_file=/usr/local/pnp4nagios/var/host-perfdatahost_perfdata_ File_template=datatype::hostperfdata\ttimet:: $TIMET $\thostname::$Hostname$\thostperfdata:: $HOSTPERFDATA $\thostcheckcommand:: $HOSTCHECKCOMMAND $\thoststate:: $HOSTSTATE $\ Thoststatetype:: $HOSTSTATETYPE $host_perfdata_file_mode=ahost_perfdata_file_processing_interval=15host_perfdata _file_processing_command=process-host-perfdata-file[[email protected] etc]# cat  misccommands.cfg-sample# configures Nagios's commands.cfg file according to this instruction [[email protected] etc]# vim /usr/ Local/nagios/etc/objects/commands.cfg ... Little ... #php4nagiosdefine  command {       command_name     process-service-perfdata-file       command_line     /usr/local/pnp4nagios/libexec/process_perfdata.pl --bulk /usr/local/pnp4nagios/var/ service-perfdata}define command {       command_name     process-host-perfdata-file       command_line     /usr/local/pnp4nagios/libexec/process_perfdata.pl --bulk /usr/local/pnp4nagios/var/host-perfdata}[[ Email protected] etc]# vim /usr/local/nagios/etc/objects/templates.cfg Modify the template templates.cfg ... Little ... #pnp4nagiosdefine  host {        name             host-pnp         action_url      /pnp4nagios/index.php/graph?host= $HOSTNAME $&srv=_host_         register        0         }define service {         name            srv-pnp         action_url      /pnp4nagios/index.php/graph? host= $HOSTNAME $&srv= $SERVIcedesc$        register         0        }[[email protected] etc]# /etc/init.d/ npcd start# starting with a startup script

Add the upper Host-pnp,service section to the host section where you normally need to display the chart information, add Srv-pnp, and then restart Nagios and httpd to display the chart information on the monitoring page as follows:

define host{        use              network-printers,host-pnp         host_name       hplj_m177         alias           hp laserjet m177         address         192.168.0.251         hostgroups      network-printers         contact_groups  admins         }define service{        use                       Network-printers,srv-pnp        host_name                hplj_M177         service_description     printer status         check_command           check_snmp!-c public  -o sysDescr.0        check_interval  10         retry_interval  1         max_check_attempts      2         notifications_enabled   1        }define  service{        use                      network-printers,srv-pnp         host_name               hplj_ M177        service_description     ping         check_command            check_ping!3000.0,80%!5000.0,100%        check_ interval  10        retry_interval  1         max_check_attempts      2         notifications_enabled   1         }

650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M02/07/D7/wKiom1nR_DnCyNV2AAAlagrD4lA711.png-wh_500x0-wm_ 3-wmp_4-s_2903029810.png "title=" chart icon "alt=" Wkiom1nr_dncynv2aaalagrd4la711.png-wh_50 "/>

After you click on the chart icon, you will have an installed check page, and if you do not have an error, remove or rename the page as prompted:

650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M02/07/D7/wKiom1nR_NHgYOvnAAGRQj29nTI347.png-wh_500x0-wm_ 3-wmp_4-s_1935448107.png "title=" Pnp4nagios check "alt=" Wkiom1nr_nhgyovnaagrqj29nti347.png-wh_50 "/>"

To pay attention to the use of Pnp4nagios drawing will be used in the PHP session, here if the error is more than PHP session variable or session path does not have permissions, need to change according to the actual hints, here are passed the renamed

[[email protected] etc]# Cd/usr/local/pnp4nagios/share/[[email protected] share]# mv install. {Php,bak}

Once you've configured the chart icon again, you'll have a diagram defined in the template that defines the RRDtool PHP template path in the Pnp4nagios/usr/local/pnp4nagios/ Share directory in Templates.dist and templates.special, where templates.dist commonly used templates, in templates.special to put a custom template, note that if you want to display the monitoring item without the corresponding template will be reported similar to the following error Miss:

650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M01/A6/89/wKioL1nSAFfxKsHcAABw0i-U6HY977.png-wh_500x0-wm_ 3-wmp_4-s_3495759663.png "title=" error "alt=" Wkiol1nsaffxkshcaabw0i-u6hy977.png-wh_50 "/>

Of course, you can define your own template according to the actual, and also recommend to add a monitoring npcd after doing the process, to ensure that the NPCD process is

[[email protected] ~]#/usr/local/nagios/libexec/check_procs-a ' npcd '-c 1:procs ok:1 process with args ' npcd ' | Procs=1;; 1:;0;


This article from "Jim's Technical Essay" blog, declined to reprint!

Installation of Pnp4nagios

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.