NagiOS - Monitor Tomcat Using check_tomcat.pl Plugin - CentOS 7

Linuxtopic
7



nagios toturial, nagios monitoring tool, server monitoring, host & service monitor,  nagios installation, nagios core,nagios plugin , nagios configuration, nagios latest version





Step 1:





Login NagiOS Server & Install Dependency Package


yum install perl-XML-XPath perl-libwww-perl




Step 2:





Download check_tomcat.pl




A: Using WebBrowser









B: Using curl


cd /usr/local/nagios/libexec

curl "https://exchange.nagios.org/components/com_mtree/attachment.php?link_id=2522&cf_id=24" -o check_tomcat.pl



1tomcat-curl.png


chmod +x /usr/lib/nagios/plugins/check_tomcat.pl


Step 3:





Test check_tomcat.pl




cd /usr/local/nagios/libexec

./check_tomcat.pl -h


check_tomcat-help.png



./check_tomcat.pl -I 172.17.20.103 -p 8080 -l admin -a admin -w 20%,30% -c 10%,20%


check_tomcat-test.png





Step 4:





Add Command for Check Tomcat


vi /etc/nagios/objects/commands.cfg






#Check tomcat service





define command{


command_name    check_tomcat


command_line   /bin/sh -c  “$USER1$/check_tomcat.pl -H $HOSTADDRESS$ -p $ARG1$ -l $ARG2$ -a $ARG3$ -w $ARG4$ -c $ARG5$”


}





check_tomcat-command.png





Note: we can use the command_line variable as below. But sometimes you will get an error. So we can use “/bin/sh -c ” to avoid the error





Step 5:





Add Service in Client.cfg





 define service{


use                           generic-service         ; Inherit default values from a template


host_name               test-red1


service_description  Tomcat


check_command      check_tomcat!8080!admin!admin!10%,50%!5%,10%





}


check_tomcat-service.png





Step 6:





check Nagios configurations and restart


/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg


Total Warnings: 0


Total Errors:   0





Things look okay – No serious problems were detected


systemctl restart nagios


Step 7:





check Nagios service monitoring page for tomcat status in Browser





         http://172.17.20.100/nagios/





tomcat-web-service.png






Post a Comment

7Comments

  1. Hello! i have an problem whit nagios, when i try to check the tomcat status, i have this error:
    (Return code of 127 is out of bounds - plugin may be missing : (No output on stdout) stderr: -H: “/usr/local/nagios/libexec/check_tomcat.pl: No such file or directory))

    ReplyDelete
  2. I Ve problem
    Tomcat
    CRITICAL 03-24-2018 03:00:41 0d 15h 14m 6s 3/3 (Return code of 127 is out of bounds - plugin may be missing : (No output on stdout) stderr: -H: “/usr/local/nagios/libexec/check_tomcat.pl: No such file or directory))


    please help me to resolve as soon as possible

    ReplyDelete
  3. Warning: Return code of 127 for check of service 'Tomcat' on host '#### Server' was out of bounds. Make sure the plugin you're trying to run actually exists.

    ReplyDelete
  4. Use this
    define command{
    command_name check_tomcat
    command_line /bin/perl $USER1$/check_tomcat.pl -H $HOSTADDRESS$ -p $ARG1$ -l $ARG2$ -a $ARG3$ -w $ARG4$ -c $ARG5$
    }

    ReplyDelete
  5. Facing below error while executing
    CRITICAL: http://172.31.92.209:8081/manager/status?XML=true HTTP/1.1 403 Forbidden

    ReplyDelete
  6. PC monitors have developed from the early green screen and shading monitors sold with the IBM PC into interconnected high-goal tone multi-monitors. https://bestmonitorhub.com/

    ReplyDelete
  7. (Return code of 127 is out of bounds. Check if plugin exists)
    i am getting this error while doing above steps

    ReplyDelete
Post a Comment

#buttons=(Ok, Go it!) #days=(20)

Our website uses cookies to enhance your experience. Check Now
Ok, Go it!