Bug 602678

Summary: Metrics collection incorrect for named-based vhosts sharing the same IP address and port
Product: [Other] RHQ Project Reporter: Lukas Krejci <lkrejci>
Component: PluginsAssignee: Lukas Krejci <lkrejci>
Status: CLOSED CURRENTRELEASE QA Contact: Corey Welton <cwelton>
Severity: high Docs Contact:
Priority: high    
Version: 3.0.0   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 2.4 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-08-12 16:59:34 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 593121    

Description Lukas Krejci 2010-06-10 13:13:18 UTC
Description of problem:

The apache plugin incorrectly determines what SNMP stats to collect if 2 virtual hosts (or a main server config and a virtual host) share the same IP and port (and are differentiated only by hostname).

How reproducible:
always

Steps to Reproduce:
1. Add a vhost to apache config that will listen on the same ip and port as the main server, define the ServerName directive for the vhost to some hostname resolvable to the IP
2. enable SNMP monitoring in the apache config
3. inventory the apache instance
4. create some traffic on both the main server and the vhost
5. see if the stats contain the correct values
  
Actual results:
the main server and the vhost have the same stats

Expected results:
the main server and the vhost should have different stats based on the actual traffic to each.

Comment 1 Lukas Krejci 2010-06-14 11:52:57 UTC
Fixed in commit b824d63

Comment 2 Charles Crouch 2010-06-18 16:41:20 UTC
Lukas, any reason this can't be on-qa?

Comment 3 Corey Welton 2010-06-29 17:52:53 UTC
I have my SNMP set up and from all I can tell, things are listening....

[root@jiaozi ~]# nmap -sV -sU -p 1610 localhost

Starting Nmap 5.21 ( http://nmap.org ) at 2010-06-29 13:52 EDT
Nmap scan report for localhost (127.0.0.1)
Host is up.
Hostname localhost resolves to 2 IPs. Only scanned 127.0.0.1
rDNS record for 127.0.0.1: localhost.localdomain
PORT     STATE SERVICE VERSION
1610/udp open  snmp    SNMPv1 server (public)
Service Info: Host: jiaozi.usersys.redhat.com

Service detection performed. Please report any incorrect results at http://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 44.79 seconds


And all my virtualhosts are "green"....

That said, I have been clicking through on and off throughout the day, and I still have "No Metric Data Available" in the graphs for any of the given vhosts (Bytes/Requests?Responses, etc.)


Any ideas?

Comment 4 Lukas Krejci 2010-06-30 14:04:50 UTC
hmmm... this would mean that the plugin doesn't match the virtualhosts with their snmp indexes correctly. Could you attach your httpd.conf and associated files please?

Comment 5 Lukas Krejci 2010-07-01 22:59:34 UTC
The algorithm to match the vhost resource with the snmp index was indeed failing.

This was because the snmp module somewhat confusingly represents the default port 80 as "0" and at the same time uses "0" to represent the port wildcard. This could be classified as a bug in the snmp module.

Nevertheless, commit ed06919 works around that deficiency and hardens the matching algorithm to take that behaviour into account as well as not failing on unknown hosts (this enables to match everything up correctly even if the apache configuration contains some misconfigured entries).

Comment 6 Lukas Krejci 2010-07-02 12:35:08 UTC
Clearing the needinfo flag, because it's no longer needed.

Comment 7 Corey Welton 2010-07-02 18:58:23 UTC
I installed the latest build and am still getting "No Metric Data Available".  Did this fix go into the release branch?

Comment 8 Lukas Krejci 2010-07-02 23:03:45 UTC
I can't make this not work... I replicated your setup precisely and I always get the data collected eventually.

Not sure what would be the problem with your snmp setup because it looks ok from what i've seen.

I made sure that the following works:

- multiple vhosts domain names resolve to the IP of the agent box and get resolved correctly
- _default_ gets resolved
- * ports get resolved

Comment 9 Corey Welton 2010-07-03 00:51:25 UTC
Finally got this to work on a separate httpd server.  Something must be
wrong with the original one because the two have nearly identical
httpd.conf files, but one won't run with "Listen 80", and the other
won't run without it....

In any case, with this other httpd, I did successfully see the statistical differences.  QA Verified!

Comment 10 Corey Welton 2010-08-12 16:59:34 UTC
Mass-closure of verified bugs against JON.