Monitoring host 192.168.24.69, the following with a for the monitored host 192.168.24.79, the following with a B logo, A host cacti 1. Import the XML template in Tomcatstat 2. Copy tomcatstats.pl from Tomcatstat to/var/www/html/cacti/srcipts directory while granting permissions #cd/var/www /html/cacti/scripts#chown apache.apache tomcatstats.pl && chmod 755 tomcatstats.plPS: note my $xml = ' GET $url ' in tomcatstats.pl, and modify it to my $xml = ' wget-qo-$url '; Otherwise there may be no data on the graph; Also check if the wget command is installed, #install yum wget
Second, b host
1. Add User #cd/usr/tomcat/conf#vi Tomcat-users.xml Add the changes in/usr/tomcat/conf/tomcat-users.xml tomcat-users as follows <role Rolename= "Tomcat"/>
<role rolename= "Role1"/>
<role rolename= "Manager-gui"/>
<user username= "admin" password= "12345678" roles= "Manager-gui"/>
<user username= "Tomcat" password= "Tomcat" roles= "Tomcat"/>
<user username= "Both" password= "Tomcat" roles= "Tomcat,role1"/>
<user username= "Role1" password= "Tomcat" roles= "Role1"/> 2. Restart tomcat#/usr/tomcat/bin/shutdown.sh#/usr/tomcat/ bin/startup.sh Login 192.168.24.79:8080/manager/status See if you can log in successfully three, test in a host, you have to install Perl and Xml::simple module #cd/var/www/html/ Cacti/scripts#perl tomcatstats.pl 192.168.24.79:8080 admin 12345678 \ "Http-bio-8080\" has data that is normal, error 1:can ' t locate XML/ SIMPLE.PN in @INC open cpan shell, executeForce Install Xml::simple
Error 2: Prompt error Sh:Get:command not found #yum install-y perl-libwww-perl perl-xml-parser error 3: Hint could not find parsedetails.ini#p Erl-mxml::sax-e "Xml::sax->add_parser (' Xml::sax::P ureperl ')->save_parsers ()" If there is an error can ' t ' locate Xml/sax: PUREPERL.PM in @INC #yum install-y expat expat-devel then open cpan shell, execute install xml::sax::expat four, Cacti settings (1) Import tomcatstats in cacti templates (2) in Console->data input methods click Tomcat Status (3) Modify Input String to Perl <path_cacti>/scripts/tomcatstats.pl Tomcat 7 with \ "Http-bio-8080\", Tomcat with \ "Http-8080\", both sides of the \ "must have, or some data will be empty
(4) After adding the appropriate templates in the device to see the Cacti/rra folder in the corresponding RRD has been generated, and then see the cacti.log there is no error. Ps:1, if two graphs of heap statistics and connect rate are found to appear, in Console->graph templates, locate the corresponding template, and the unit Grid Value (--unit/--y-grid ) is set to 0 or empty, and you can see the diagram after saving.
2, there is no data and cacti log display error:empty result
Workaround #yum-y install perl* gcc*
Attachment:
Https://app.yinxiang.com/shard/s41/res/87d1b22a-e8db-40c8-b3a1-ac2fc003c91b/TomcatStats-0.1.zip
Cacti adding tomcat monitoring