更新:日志报告:
no attributes defined by the response: <a class="navbar-brand" href="http://foo.com/foo1">
CSG - Client:DRS - Site:foo1 Gdns - August 13 2015 06:28 AM
<i style="display:none">opennms9929opennms</i>
</a>
似乎我的XML中的正则表达式不正确。请问有人可以为我的问题提供正确的正则表达式吗?感谢。
我一直在尝试使用OpenNMS设置HTTP收集器来定期从网站收集一个数字,原始的HTML代码如下:
<!DOCTYPE HTML>
............
<i style="display:none" >opennms781opennms</i>
............
</body>
</html>
目标是使用正则表达式在opennms(number)opennms
之间收集数字。
我按照OpenNMS HTTP Collector Wiki中的说明编辑了所需的XML文件,OpenNMS能够提取原始HTML数据并将其记录在日志中,但是我仍然收到以下警告/错误:
2015-08-13 14:18:39,946 WARN [Collectd-Thread-49-of-50] o.o.n.c.HttpCollector: doCollection: More than 1 Content-Language headers received. Ignoring them!
2015-08-13 14:18:39,946 WARN [Collectd-Thread-49-of-50] o.o.n.c.HttpCollector: doCollection: no attributes defined by the response: <a class="navbar-brand" href="http://foo.com/foo1">
CSG - Client:DRS - Site:foo1 Gdns - August 13 2015 06:28 AM
<i style="display:none">opennms9929opennms</i>
</a>
2015-08-12 12:08:14,771 WARN [Collectd-Thread-10-of-50] o.o.n.c.HttpCollector: collect: http collection failed
org.opennms.netmgt.collectd.HttpCollector$HttpCollectorException: Unexpected exception caught during HTTP collection
at org.opennms.netmgt.collectd.HttpCollector.doCollection(HttpCollector.java:307) ~[opennms-services-16.0.2.jar:?]
at org.opennms.netmgt.collectd.HttpCollector.access$100(HttpCollector.java:107) ~[opennms-services-16.0.2.jar:?]
at org.opennms.netmgt.collectd.HttpCollector$HttpCollectionSet.collect(HttpCollector.java:179) [opennms-services-16.0.2.jar:?]
at org.opennms.netmgt.collectd.HttpCollector.collect(HttpCollector.java:139) [opennms-services-16.0.2.jar:?]
at org.opennms.netmgt.collectd.CollectionSpecification.collect(CollectionSpecification.java:274) [opennms-services-16.0.2.jar:?]
at org.opennms.netmgt.collectd.CollectableService.doCollection(CollectableService.java:388) [opennms-services-16.0.2.jar:?]
at org.opennms.netmgt.collectd.CollectableService.doRun(CollectableService.java:322) [opennms-services-16.0.2.jar:?]
at org.opennms.netmgt.collectd.CollectableService.access$000(CollectableService.java:70) [opennms-services-16.0.2.jar:?]
at org.opennms.netmgt.collectd.CollectableService$1.run(CollectableService.java:300) [opennms-services-16.0.2.jar:?]
at org.opennms.core.logging.Logging.withPrefix(Logging.java:66) [org.opennms.core.logging-16.0.2.jar:?]
at org.opennms.netmgt.collectd.CollectableService.run(CollectableService.java:296) [opennms-services-16.0.2.jar:?]
at org.opennms.netmgt.scheduler.LegacyScheduler$1.run(LegacyScheduler.java:209) [opennms-services-16.0.2.jar:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_51]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_51]
at org.opennms.core.concurrent.LogPreservingThreadFactory$3.run(LogPreservingThreadFactory.java:124) [opennms-util-16.0.2.jar:?]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_51]
2015-08-12 12:08:14,771 WARN [Collectd-Thread-10-of-50] o.o.n.c.CollectableService: run: failed collection for 63/(foo's IP)/HttpSecCount/foo1
2015-08-12 12:08:14,771 ERROR [Collectd-Thread-10-of-50] o.o.n.c.CollectableService: Collection failed for an unknown reason (code 2. Please review previous logs for this thread for details. You can also open up an enhancement bug report (include your logs) to request that failure messages are logged for this type of error.
org.opennms.netmgt.collectd.CollectionFailed: Collection failed for an unknown reason (code 2. Please review previous logs for this thread for details. You can also open up an enhancement bug report (include your logs) to request that failure messages are logged for this type of error.
at org.opennms.netmgt.collectd.CollectableService.doCollection(CollectableService.java:413) ~[opennms-services-16.0.2.jar:?]
at org.opennms.netmgt.collectd.CollectableService.doRun(CollectableService.java:322) [opennms-services-16.0.2.jar:?]
at org.opennms.netmgt.collectd.CollectableService.access$000(CollectableService.java:70) [opennms-services-16.0.2.jar:?]
at org.opennms.netmgt.collectd.CollectableService$1.run(CollectableService.java:300) [opennms-services-16.0.2.jar:?]
at org.opennms.core.logging.Logging.withPrefix(Logging.java:66) [org.opennms.core.logging-16.0.2.jar:?]
at org.opennms.netmgt.collectd.CollectableService.run(CollectableService.java:296) [opennms-services-16.0.2.jar:?]
at org.opennms.netmgt.scheduler.LegacyScheduler$1.run(LegacyScheduler.java:209) [opennms-services-16.0.2.jar:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_51]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_51]
at org.opennms.core.concurrent.LogPreservingThreadFactory$3.run(LogPreservingThreadFactory.java:124) [opennms-util-16.0.2.jar:?]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_51]
我想知道是否有人知道可能导致此问题的原因?
HTTP的数据收集-config.xml中:
<http-collection name="sec-count">
<rrd step="900">
<rra>RRA:AVERAGE:0.5:1:2016</rra>
<rra>RRA:AVERAGE:0.5:12:1488</rra>
<rra>RRA:AVERAGE:0.5:288:366</rra>
<rra>RRA:MAX:0.5:288:366</rra>
<rra>RRA:MIN:0.5:288:366</rra>
</rrd>
<uris>
<uri name="foo">
<url path="/foo1/index.php"
host="www.foo.com"
user-agent="Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0"
matches="(?!opennms)(\d+)(?=opennms)" response-range="100-399" >
</url>
<attributes>
<attrib alias="secondCount" match-group="1" type="gauge"/>
</attributes>
</uri>
</uris>
</http-collection>
collectd-configuration.xml文件: 在包#&#34;例1&#34;
下<service name="HttpSecCount" interval="900000" user-defined="false" status="on">
<parameter key="collection" value="sec-count"/>
</service>
<collector service="HttpSecCount" class-name="org.opennms.netmgt.collectd.HttpCollector"/>
答案 0 :(得分:0)
答案 1 :(得分:0)
错误是由不正确的正则表达式引起的,并且已使用OpenNMS wiki中提供的Java Regex verification tool修复了此错误。