Monitoring Apache give error: java.lang.IndexOutOfBoundsException: No group 4

Description

I followed the note :
http://www.opennms.org/index.php/Monitoring_Apache_with_the_HTTP_collector
I keep getting :
2009-05-28 10:44:26,635 DEBUG [CollectdScheduler-50 Pool-fiber3] HttpCollector: responseBody = Total Accesses: 14937180
Total kBytes: 420858574
CPULoad: .0231281
Uptime: 3015633
ReqPerSec: 4.95325
BytesPerSec: 142908
BytesPerReq: 28851.4
BusyWorkers: 16
IdleWorkers: 17
Scoreboard: __K___K._KWKWKCKK_....WK__...KK.K.K..............................................................................
.....................................................................................................................................
..

2009-05-28 10:44:26,635 DEBUG [CollectdScheduler-50 Pool-fiber3] HttpCollector: getmatches = (?s).*BytesPerSec:\s([0-9]+).*BusyWorker
s:\s([0-9]).*IdleWorkers:\s([0-9]).*
2009-05-28 10:44:26,635 DEBUG [CollectdScheduler-50 Pool-fiber3] HttpCollector: flags = 0
2009-05-28 10:44:26,635 DEBUG [CollectdScheduler-50 Pool-fiber3] HttpCollector: processResponse: found matching attributes: true
2009-05-28 10:44:26,636 DEBUG [CollectdScheduler-50 Pool-fiber3] HttpCollector: processResponse: adding found numeric attribute: Http
Attribute: TotalAccesses:gauge32:142908
2009-05-28 10:44:26,636 DEBUG [CollectdScheduler-50 Pool-fiber3] HttpCollector: processResponse: adding found numeric attribute: Http
Attribute: TotalkBytes:gauge32:16
2009-05-28 10:44:26,636 DEBUG [CollectdScheduler-50 Pool-fiber3] HttpCollector: processResponse: adding found numeric attribute: Http
Attribute: CPULoad:gauge32:17
2009-05-28 10:44:26,636 ERROR [CollectdScheduler-50 Pool-fiber3] CollectableService: org.opennms.netmgt.collectd.CollectionException:
An undeclared throwable was caught during data collection for interface 10.200.203.70/Apache-Stats
org.opennms.netmgt.collectd.CollectionException: An undeclared throwable was caught during data collection for interface 10.200.203.70/Apache-Stats
at org.opennms.netmgt.collectd.CollectableService.doCollection(CollectableService.java:383)
at org.opennms.netmgt.collectd.CollectableService.run(CollectableService.java:292)
at org.opennms.netmgt.scheduler.LegacyScheduler$1.run(LegacyScheduler.java:292)
at org.opennms.core.concurrent.RunnableConsumerThreadPool$FiberThreadImpl.run(RunnableConsumerThreadPool.java:422)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.IndexOutOfBoundsException: No group 4
at java.util.regex.Matcher.group(Matcher.java:463)
at org.opennms.netmgt.collectd.HttpCollector.processResponse(HttpCollector.java:398)
at org.opennms.netmgt.collectd.HttpCollector.persistResponse(HttpCollector.java:449)
at org.opennms.netmgt.collectd.HttpCollector.doCollection(HttpCollector.java:250)
at org.opennms.netmgt.collectd.HttpCollector.access$000(HttpCollector.java:99)
at org.opennms.netmgt.collectd.HttpCollector$HttpCollectionSet.collect(HttpCollector.java:170)
at org.opennms.netmgt.collectd.HttpCollector.collect(HttpCollector.java:129)
at org.opennms.netmgt.collectd.CollectionSpecification.collect(CollectionSpecification.java:227)
at org.opennms.netmgt.collectd.CollectableService.doCollection(CollectableService.java:355)
... 4 more

Thanks,

Environment

Operating System: Linux Platform: PC

Acceptance / Success Criteria

None

Lucidchart Diagrams

Activity

Show:

Seth Leger (community account) February 23, 2010 at 3:50 PM

This error means that the <url matches="..."> regex statement in your config has the wrong number of regex groups as compared to the <attrib match-group="..."> group value in the config file.

I'll add an extra log message that catches IndexOutOfBoundsException to make this clearer in the logs but it's basically a configuration problem.

Note that these are Java regex expressions and that the first parenthetical expression in that doc (?s) is a modifier that enables multi-line matching, not a matching group itself.

http://java.sun.com/javase/6/docs/api/java/util/regex/Matcher.html
http://java.sun.com/javase/6/docs/api/java/util/regex/Pattern.html

If you need more help, please post the edited sections of your httpd-datacollection-config.xml file.

Incomplete

Details

Assignee

Reporter

Components

Fix versions

Affects versions

Priority

PagerDuty

Created May 28, 2009 at 11:46 AM
Updated January 27, 2017 at 4:27 PM
Resolved July 12, 2010 at 12:15 PM