Monitoring Tomcat 5.0 on Ubuntu - Page 3
3 Configure Tomcat 5.0 for Log Tracking
To enable Log Tracking in HQ, Tomcat must be configured with log4j. These steps are based on the standard Tomcat documentation.
3.1 Set Up log4j
On a blank Ubuntu-Installation /usr/lib/tomcat5/common/classes/log4j.properties does not exist, so create one with the following example contents:
#These properties can be modified. The only requirement is that the #ConversionPattern includes the priority (%p) log4j.rootLogger=INFO, R log4j.appender.R.File=${catalina.home}/logs/tomcat.log log4j.appender.R.MaxBackupIndex=1 log4j.appender.R.MaxFileSize=5000KB log4j.appender.R.layout.ConversionPattern=%d %-5p [%c{1}] %m%n log4j.appender.R.layout=org.apache.log4j.PatternLayout log4j.appender.R=org.apache.log4j.RollingFileAppender
Next, copy the following jars unless they have already been installed:
cp pdk/lib/log4j.jar /usr/lib/tomcat5/common/lib
cp pdk/lib/commons-logging.jar /usr/lib/tomcat5/common/lib
Restart Tomcat for the changes to take effect:
/etc/init.d/tomcat5 restart
4 Start the HQ Server and Agents
To log in and see your monitoring metrics, we must first start the HQ Server and Agent.
4.1 Start The HQ Server
Start the server with the following command:
/home/hyperic/server-n.n.n/bin/hq-server.sh start
The initial startup should look like this:
Starting HQ server...
Initializing HQ server configuration...
Checking jboss jndi port...
Checking jboss mbean port...
Starting HQ built-in database...
HQ built-in database started.
Booting the HQ server...
HQ server booted.
Login to HQ at: http://127.0.0.1:7080/
Note: The first start will take more time as usual.
4.2 Start The HQ Agent
Start the agent with the following command:
/home/hyperic/agent-n.n.n/hq-agent.sh start
The initial startup should look like this:
Starting agent
- Unable to load agent token file. Generating a new one ... Done
- Invoking agent<br? -="" starting="" agent="" process="">
Agent successfully started</br?>
Follow the rest of the directions as prompted.
Confirm the Agent Registered Properly
Once the installation and startup is complete, confirm the agent registered itself with the host. It should look like this:
- Received temporary auth token from agent
- Registering agent with HQ
- HQ gave us the following agent token 1187275261550-13485140805726178-3666098505737167114
- Informing agent of new HQ server
- Validating
- Successfully setup agent
5 Using the HQ Server
Your setup is complete! You are now ready to monitor all the technologies, including your enabled Tomcat server with your Hyperic HQ Server.
5.1 Access the Hyperic HQ Server
To access the HQ Server with a browser of your choice at http://127.0.0.1:7080 on the host-system, or using another computer, at http://%hostip%:7080.
5.2 Discovering More Features
Hyperic HQ is packed with capabilities. For a good tour of the features and further setup instructions, check out the Hyperic Test Ride Guide.
5.3 Essential Commands
When managing your HQ environment, keep in mind the following commands:
Start the HQ Server:
/home/hyperic/server-n.n.n/bin/hq-server.sh start
Start the HQ Agent:
/home/hyperic/agent-n.n.n/hq-agent.sh start
Stop the HQ Agent:
/home/hyperic/agent-n.n.n/hq-agent.sh stop
Stop the HQ Server:
/home/hyperic/server-n.n.n/bin/hq-server.sh stop