Re: XML collection not working
JohnD Blackburn <[email protected]>
| Newsgroups | gmane.network.opennms.general |
|---|---|
| Message-ID | <DB6PR0602MB2902E6B91F30D6D08FB707EFCBA60@DB6PR0602MB2902.eurprd06.prod.outlook.com> |
Thankyou for your response.
I installed the VTD required packages before I tried setting it as a handler.
As suggested, I’ve removed the handler class entry from collectd-configuration.xml, but it was still not working.
I have just now added the following to the default-foreign-source.xml
<detector name="ABBCS-CUPS" class="org.opennms.netmgt.provision.detector.simple.HttpDetector">
<parameter key="url" value="/printers.xml"/>
<parameter key="port" value="8000"/>
</detector>
Which seems to have fixed the issue, but then I found I also needed to add a “~” to the “response-text” parameter in poller-configuration.xml:
<parameter key="response-text" value="~.*printer.*"/>
The documentation for the XML collector doesn’t mention default-foreign-source.xml at all, so is this something that I shouldn’t really need, and I’ve missed something else in my configuration, or is this just an oversight, and should be in the doco?
[ABB logo]
John Blackburn
Solution Architect - Cloud Services
Enterprise Software
Level 1, 757 Ann Street
Fortitude Valley, Queensland, 4006
AUSTRALIA
Phone: +61 7 33033219
Mobile: +61 403 344 524
E-Mail: [email protected]<mailto:[email protected]>
www.abb.com<http://www.abb.com/>
From: Ronald Roskens [mailto:[email protected]]
Sent: Tuesday, 18 July 2017 11:31 PM
To: General OpenNMS Discussion <[email protected]>
Subject: Re: [opennms-discuss] XML collection not working
Does it work if you take out the handler-class parameter in the collectd-configuration.xml? The size of your XML is so small, that I don’t think VTD is going to make that much of a difference in speed for parsing it, so lets try with the default handler first. (You didn’t list which packages you have installed. The VTD handler isn’t installed by default and you need an extra package for it.
On Jul 17, 2017, at 12:32 AM, JohnD Blackburn <[email protected]<mailto:[email protected]>> wrote:
Hi all,
I have been trying to implement a custom monitor for CUPS printers using the XML collector, but I’m having problems getting it to collect any data.
Can someone please confirm that my configuration is correct, or let me know what I’ve missed.
We’re running opennms 20.0.1
I have a webserver set up that returns the metrics I care about in xml format:
[root@aue-s-opennms01 etc]# curl http://10.1.2.3:8000/printers.xml
<?xml version="1.0" encoding="UTF-8"?>
<printers>
<printer name="Printer1">
<njobs>5</njobs>
</printer>
<printer name="Printer2">
<njobs>0</njobs>
</printer>
<printer name="Printer3">
<njobs>0</njobs>
</printer>
</printers>
Here is (I think) all the relevant configuration bits:
xml-datacollection-config.xml:
<xml-collection name="ABBCS-CUPS">
<rrd step="300">
<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>
<xml-source url="http://{ipaddr}:8000/printers.xml<http://%7bipaddr%7d:8000/printers.xml>">
<import-groups>xml-datacollection/CUPS-Printers.xml</import-groups>
</xml-source>
</xml-collection>
xml-datacollection/CUPS-Printers.xml:
<xml-groups>
<xml-group name="CUPS-Printer-stats" resource-type="CUPSPrinters"
resource-xpath="/printers/printer"
key-xpath="@name">
<xml-object name="printerName" type="string" xpath="@name" />
<xml-object name="njobs" type="GAUGE" xpath="njobs" />
</xml-group>
</xml-groups>
collectd-configuration.xml:
<package name="ABBCS-CUPS">
<filter>(IPADDR != '0.0.0.0')</filter>
<include-range begin="1.1.1.1" end="254.254.254.254"/>
<include-range begin="::1" end="ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"/>
<service name="ABBCS-CUPS" interval="300000" user-defined="false" status="on">
<parameter key="collection" value="ABBCS-CUPS"/>
<parameter key="handler-class" value="org.opennms.protocols.xml.vtdxml.DefaultVTDXmlCollectionHandler"/>
</service>
</package>
…
<collector service="ABBCS-CUPS" class-name="org.opennms.protocols.xml.collector.XmlCollector"/>
datacollection-configuration.xml:
<?xml version="1.0"?>
<datacollection-config rrdRepository="/opt/opennms/share/rrd/snmp/">
…
<snmp-collection name="ABBCS" snmpStorageFlag="select">
<rrd step="300">
<rra>RRA:AVERAGE:0.5:1:8928</rra>
<rra>RRA:AVERAGE:0.5:12:8784</rra>
<rra>RRA:AVERAGE:0.5:480:366</rra>
<rra>RRA:MIN:0.5:12:8784</rra>
<rra>RRA:MAX:0.5:12:8784</rra>
</rrd>
…
<include-collection dataCollectionGroup="ABBCS-CUPS"/>
</snmp-collection>
</datacollection-config>
datacollection/ABBCS-CUPS.xml:
<datacollection-group name="ABBCS-CUPS">
<resourceType name="CUPSPrinters" label="CUPS Printers"
resourceLabel="Printer ${printerName}" >
<persistenceSelectorStrategy
class="org.opennms.netmgt.collection.support.PersistAllSelectorStrategy"/>
<storageStrategy
class="org.opennms.netmgt.collection.support.IndexStorageStrategy"/>
</resourceType>
</datacollection-group>
poller-configuration.xml:
<package name="ABBCS-CUPS">
<filter>((IPADDR != '0.0.0.0') & (catincServers))</filter>
<include-range begin="1.1.1.1" end="254.254.254.254"/>
<include-range begin="::1" end="ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"/>
<rrd step="300">
<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>
<service name="ABBCS-CUPS" interval="300000" user-defined="false" status="on">
<parameter key="retry" value="1"/>
<parameter key="timeout" value="3000"/>
<parameter key="port" value="8000"/>
<parameter key="url" value="/printers.xml"/>
<parameter key="rrd-repository" value="/opt/opennms/share/rrd/response" />
<parameter key="rrd-base-name" value="cups" />
<parameter key="response" value="200-202,299"/>
<parameter key="response-text" value=".*printer.*"/>
</service>
<downtime begin="0" end="300000" interval="30000"/>
<downtime begin="300000" end="43200000" interval="300000"/>
<downtime begin="43200000" end="432000000" interval="600000"/>
<downtime begin="432000000" delete="true"/>
</package>
…
<monitor service="ABBCS-CUPS" class-name="org.opennms.netmgt.poller.monitors.HttpMonitor"/>
Any assistance greatly appreciated.
Regards,
John Blackburn.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org<http://slashdot.org/>! http://sdm.link/slashdot_______________________________________________
Please read the OpenNMS Mailing List FAQ:
http://www.opennms.org/index.php/Mailing_List_FAQ
opennms-discuss mailing list
To *unsubscribe* or change your subscription options, see the bottom of this page:
https://lists.sourceforge.net/lists/listinfo/opennms-discuss
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Please read the OpenNMS Mailing List FAQ:
http://www.opennms.org/index.php/Mailing_List_FAQ
opennms-discuss mailing list
To *unsubscribe* or change your subscription options, see the bottom of this page:
https://lists.sourceforge.net/lists/listinfo/opennms-discuss
image001.gif
(image/gif, 2.9 KB) - not displayed