There is no need for it to log the warning, since the PC already logs a warning if SIGAR is not found. The warning is particularly undesirable when the JMX plugin is running inside the admin-console (EmbJopr), since SIGAR is intentionally not included with the admin-console (see https://jira.jboss.org/jira/browse/JBPAPP-3280).
Fixed as follows: 1) Stop logging the warning in the JMXDiscoveryComponent.discoverResources(). 2) Stop logging the warning in SystemInfoFactory's static init block, since this also would get logged when running in the admin console. 3) Start logging once during Agent startup (in AgentMain), but don't log the warning if the user explicitly disabled the native system via their Agent config or via the -t command-line option. The underlying Throwable is saved by SystemInfoFactory and printed by AgentMain only if DEBUG is enabled. Fix committed to gwt branch (git rev ab1816d) and cherry-picked to master branch (git rev 44ca5dd). Note, in this same commit, I also updated the JMX Server Resource type to store its autodiscovery process table query expression in its plugin descriptor rather than hard-coding it in its discovery class.
qa -> skondkar
Mass-move to ON_QA
TEST AS FOLLOWS =============== Test Case A ----------- 1) Start the Agent w/ the -t option to disable the native system. 2) Verify that the Agent logs the following INFO level message once: "The native system has been disabled." Test Case B ----------- 1) Remove all SIGAR shared libraries from AGENT_HOME/lib/ (back them up to some other dir). 2) Start the Agent. 3) Verify that the Agent logs the following WARN level message once: "Native system info is enabled, but the system info API is not accessible on this platform " + "(sigar.jar not found in classpath or SIGAR shared library not found in shared library path). " + "Enable DEBUG logging for more details." Verify that no stack trace is dumped. Test Case C ----------- 1) Remove all SIGAR shared libraries from AGENT_HOME/lib/ (back them up to some other dir). 2) Turn on DEBUG logging by setting RHQ_AGENT_DEBUG=1 in rhq-agent-env.sh. 3) Start the Agent. 4) Verify that the Agent logs the following DEBUG level message once: "Native system info is enabled, but the system info API is not accessible on this platform " + "(sigar.jar not found in classpath or SIGAR shared library not found in shared library path)." Verify that the message is followed by an exception stack trace. For all of the above cases, verify that no warning related to SIGAR or native libraries being missing are logged by JMXDiscoveryComponent or SystemInfoFactory. The only message should be logged once at Agent startup by AgentMain (the messages described in the test cases above).
Verified on master build #153, the INFO and WARN level messages are displayed as expected. But below WARN/DEBUG messages are displayed twice in agent.log on agent startup. These messages are expected only once in agent.log. Test case B) : Remove all SIGAR shared libraries, restart agent and verify WARN messages: agent.log: 2010-04-05 14:43:28,192 WARN [main] (org.rhq.enterprise.agent.AgentMain)- {AgentMain.native-sysinfo-unavailable}Native system info is enabled, but the system info API is not accessible on this platform (sigar.jar not found in classpath or SIGAR shared library not found in shared library path). Enable DEBUG logging for more details. 2010-04-05 14:43:28,210 INFO [main] (org.rhq.enterprise.agent.AgentMain)- {AgentMain.identify-version}Version=[RHQ 3.0.0-SNAPSHOT], Build Number=[d5c27af], Build Date=[Apr 2, 2010 10:57 PM] 2010-04-05 14:43:28,210 WARN [main] (org.rhq.enterprise.agent.AgentMain)- {AgentMain.native-sysinfo-unavailable}Native system info is enabled, but the system info API is not accessible on this platform (sigar.jar not found in classpath or SIGAR shared library not found in shared library path). Enable DEBUG logging for more details. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Test case C) Remove all SIGAR shared libraries, turn on DEBUG logging by setting RHQ_AGENT_DEBUG=1, restart agent and verify messages. agent.log 2010-04-05 14:56:22,551 DEBUG [main] (org.rhq.enterprise.agent.AgentMain)- {AgentMain.native-sysinfo-unavailable-debug}Native system info is enabled, but the system info API is not accessible on this platform (sigar.jar not found in classpath or SIGAR shared library not found in shared library path). 2010-04-05 14:56:22,564 INFO [main] (org.rhq.enterprise.agent.AgentMain)- {AgentMain.identify-version}Version=[RHQ 3.0.0-SNAPSHOT], Build Number=[d5c27af], Build Date=[Apr 2, 2010 10:57 PM] 2010-04-05 14:56:22,564 DEBUG [main] (org.rhq.enterprise.agent.AgentMain)- {AgentMain.native-sysinfo-unavailable-debug}Native system info is enabled, but the system info API is not accessible on this platform (sigar.jar not found in classpath or SIGAR shared library not found in shared library path).
As of commit 3f73687b9ddc7a102ec96e4bd9a1463bdcca825d to RHQ git, master branch, the warning should only be logged once at Agent startup.
Verified on master build #196 (Revision:7f5c8df6eb4e8a7f24e43a1b7b7e414557feebb6) The INFO, WARN and DEBUG level messages are displayed as expected and only once at agent startup as below. 2010-04-13 17:25:43,482 INFO [main] (org.rhq.enterprise.agent.AgentMain)- {AgentMain.native-system-disabled}The native system has been disabled. 2010-04-13 17:29:53,241 WARN [main] (org.rhq.enterprise.agent.AgentMain)- {AgentMain.native-sysinfo-unavailable}Native system info is enabled, but the system info API is not accessible on this platform (sigar.jar not found in classpath or SIGAR shared library not found in shared library path). Enable DEBUG logging for more details. 2010-04-13 17:32:34,726 DEBUG [main] (org.rhq.enterprise.agent.AgentMain)- {AgentMain.native-sysinfo-unavailable-debug}Native system info is enabled, but the system info API is not accessible on this platform (sigar.jar not found in classpath or SIGAR shared library not found in shared library path).
Mass-closure of verified bugs against JON.