Manual installing Nagios on Ubuntu 2

Manual installing Nagios on Ubuntu 2

Share

After the first post, we will see now how to check jboss parameters using jmx and to create graph, based on data returned from nagios command, using PNP4NAGIOS.

JMX4PERL

Download jmx4perl


sudo apt-get install libxml-libxml-perl

perl Build.PL

Se le dipendenze non sono soddisfatte


./Build installdeps

sudo ./Build install

download jolokia-war-x.y.x.war from http://www.jolokia.org/download.html

rename to jolokia.war and deploy to jboss

test with jmx4perl http://<server>:<port>/jolokia will print some server information

check_jmx4perl -u http://localhost:8050/jolokia –alias MEMORY_HEAP_USED –base MEMORY_HEAP_MAX –warning 80 –critical 90 for HEAP MEMORY

Now modify command.cfg


#check_jmx_alias_base

define command {

command_name              check_jmx4perl_alias_base

command_line                  check_jmx4perl -u $ARG1$ --alias MEMORY_HEAP_USED --base MEMORY_HEAP_MAX --warning $ARG2$ --critical $ARG3$

}

Add the following command to your host


define service {

service_description JBoss Heap Memory

use                                generic-service

host_name                localhost

action_url                 http://localhost:8050/jolokia

check_command    check_jmx4perl_alias_base!$SERVICEACTIONURL$!80!90

}

PNP4NAGIOS

Download PNP4NAGIOS


./configure

sudo apt-get install librrds-perl rrdtool

sudo make all

sudo male install

sudo make install-webconf

sudo make install-config

sudo apt-get purge libapache2-mod-php5 php5 && sudo apt-get install libapache2-mod-php5 php5

mod_rewrite disabled? sudo a2enmod rewrite

Modify nagios.cfg


vi /usr/local/nagios/etc/nagios.cfg


process_performance_data=1

Additionally some new directives are required

#

# service performance data

#

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

#

# host performance data starting with Nagios 3.0

#

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

Modify command.cfg


define 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

}


sudo service apache restart

open browser http://localhost/pnp4nagios/

If your environment passed all requirements remove or rename the /usr/local/pnp4nagios/share/install.php file

Modify template.cfg


define host {

name host-pnp

action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$' class='tips' rel='/pnp4nagios/index.php/popup?host=$HOSTNAME$_

register 0

}

define service {

name srv-pnp

action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$' class='tips' rel='/pnp4nagios/index.php/popup?host=$HOSTNAME$&srv=$SERVICEDESC$

register 0

}

define service {

register 0

name pnp-preview-popup

icon_image Invisible.png' border="0"></a><a href="/pnp4nagios/graph?host=$HOSTNAME$&srv=$SERVICEDESC$" rel="/pnp4nagios/popup?host=$HOSTNAME$&srv=$S$

}

Enable pop up

move to the folder where you extract pnp4nagios.tar.gz


mv contrib/status-header.ssi /usr/local/nagios/share/ssi/status-header.ssi (check filename, had to remove fake extension .in)

check grant rw r r nagios nagios

modify file, the first two row must be changed like that


<script src="/pnp4nagios/media/js/jquery-min.js" type="text/javascript"></script>

<script src="/pnp4nagios/media/js/jquery.cluetip.js" type="text/javascript"></script>

Modify YourHost.cfg and add the following, for example you can create a graph for memory heap time-line of jboss

Add to Host the template        use linux-server, host-pnp

Add to service the template    use generic-service, srv-pnp (for visualize a link to graph)

Add to service the template    use generic-service, pnp-preview-popup (for visualize a small graph and onmouseOver popUp preview)

That’s all!

Show Comments Hide Comments

Lascia un Commento

L'indirizzo email non verrà pubblicato. I campi obbligatori sono contrassegnati *


*

È possibile utilizzare questi tag ed attributi XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

WP-SpamFree by Pole Position Marketing