Bug 875203

Summary: [iis] ResponseTime data fails to be collected due to incorrect and hard-coded log file prefix validation
Product: [Other] RHQ Project Reporter: Larry O'Leary <loleary>
Component: PluginsAssignee: RHQ Project Maintainer <rhq-maint>
Status: NEW --- QA Contact: Mike Foley <mfoley>
Severity: high Docs Contact:
Priority: unspecified    
Version: 4.4CC: ajuricic, hrupp
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Windows   
See Also: https://bugzilla.redhat.com/show_bug.cgi?id=873495
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 875202 Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On:    
Bug Blocks: 875202    

Description Larry O'Leary 2012-11-09 14:42:22 EST
+++ This bug was initially created as a clone of JBoss ON Bug #875202 +++

Description of problem:
Response Time (CallTime) metrics for an IIS VHost are not being collected and the following message is logged in the agent:

DEBUG [ResourceContainer.invoker.daemon-2] (org.rhq.plugins.iis.IISResponseTimeDelegate)- No log files exist yet

This failure is due to the plug-in looking for the wrong file name prefix. It appears that in IIS 7+ the default log file name begins with "u_ex" however, in IIS 6 (and the existing plug-in) "ex" was the prefix.

Version-Release number of selected component (if applicable):

How reproducible:

Additional info:
From the support engineer who did some preliminary investigating:

After performing some tests locally, I have identified that the root cause should be related to the logging file name. As described in this page [2], "By Default IIS 7 log file format is stored using the u_ex prefix rather than ex prefix as seen in IIS 6." and there is a validation to check the logging file name, as follows:

**CLASS: IISResponseTimeDelegate

 -> This is a snippet of the class that contains the method responsible for validating the file name:

        private class IISResponseTimeLogFileFilter implements FileFilter {
            public boolean accept(File f) {
                String fileName = f.getName().toLowerCase();
                return fileName.startsWith("ex") && fileName.endsWith(".log");
Comment 1 Amana 2012-11-12 11:30:41 EST
** Steps to reproduce **

After installing the "IIS 6 Metabase Compatibility" Role to monitor the VHosts for IIS on JBoss ON (as described in https://bugzilla.redhat.com/show_bug.cgi?id=873494), the walkthrough below was performed to reproduce the issue:

1) Enabling Response Time data in JBoss ON for the VHost discovered.

   a. Go to JBoss ON and Click on the VHost discovered -> Monitoring -> Schedules and enable the HTTP Response Time.
   b. For the same VHost, click on Inventory -> Connection Settings and check the values defined in "Log Format" (i.e. date time cs-uri-stem c-ip sc-status time-taken). You will have to set those same values for IIS when enabling the log file.

2) Configuring IIS for response time collection:

   a. Open IIS7+ Manager on Windows and navigate to the level you want to manage (i.e. Sites -> Default Web Site)
   b. In Features View, double-click Logging.
   c. On the Logging page, in the Actions pane on the right side, click "Enable" to enable logging and after that, "Apply".
   d. "Directory" field displays the path of the log file (Note: I have changed this value in IIS but apparently in JBoss ON this is not changed automatically, so I had to change that manually there). Check if the path is the same in JBoss ON and IIS.
   e. In the log file, click on "Select Fields" button, it will open a new panel. There you have to check-in the same options defined in "Log Format" field in JBoss ON for that Vhost (i.e. date time cs-uri-stem c-ip sc-status time-taken).
   f. Restart the VHost.
   g. After that, you can access that VHost a couple of times, so the log file will be generated in that path defined in "Directory" field. There you will see that this file is named as "u_ex...".
After performing these steps, the following message should be thrown in agent.log file when enabling debug messages:

   2012-11-06 16:34:47,825 DEBUG [ResourceContainer.invoker.daemon-2] (org.rhq.plugins.iis.IISResponseTimeDelegate)- No log files exist yet

To test that, I just renamed manually the generated log file from "u_ex121108" to "ex121108". After a while trying to monitor that, I could see that the file was found but the calltime was not being collected yet.
Comment 2 Larry O'Leary 2012-11-16 18:54:02 EST
I wasn't able to find reference of this in the IIS documentation but the prefix "ex" vs. "u_ex" seems to be dependent on the log file format/character encoding.