gs2527
July 5, 2022, 8:45pm
#1
Hi,
I am using XMLCollector to collect data from PaloAlto API. It seems to work when I tested it through the Karaf shell and I can verify the metrics being polled.
However for whatever reason in the RRD folder, I don’t find any .rrd files generated.
Any ideas on what could be broken?
Thanks!
Probably user error
Can you show your collectd-configuration.xml
stanza, the relevant portion of xml-datacollection.xml
, and the Karaf command you’re running?
gs2527
July 5, 2022, 9:44pm
#3
collectd-cofiguration.xml
<service name="PA-IPSec" interval="300000" user-defined="false" status="on">
<parameter key="collection" value="xml-palo-alto-ipsec"/>
<parameter key="thresholding-enabled" value="true"/>
<parameter key="handler-class" value="org.opennms.protocols.xml.collector.DefaultXmlCollectionHandler"/>
</service>
<collector service="PA-IPSec" class-name="org.opennms.protocols.xml.collector.XmlCollector"/>
xml-datacollection-config.xml
<xml-collection name="xml-palo-alto-ipsec">
<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="https://X.X.X.X/api/?type=op&cmd=<show><running><tunnel><flow><all></all></flow></tunnel></running></show>">
<request method="GET">
<parameter name="timeout" value="6000" />
<parameter name="retries" value="2" />
<parameter name="disable-ssl-verification" value="true"/>
<header name="Authorization" value="Basic XYZ" />
</request>
<import-groups>xml-datacollection/xml-palo-alto-ipsec.xml</import-groups>
</xml-source>
</xml-collection>
Karaf shell command -
opennms:collect -n 16 org.opennms.protocols.xml.collector.XmlCollector X.X.X.X handler-class=org.opennms.protocols.xml.collector.DefaultXmlCollectionHandler collection=xml-palo-alto-ipsec
What’s the xml-datacollection/xml-palo-alto-ipsec.xml
look like? Wonder if you’re trying to store an invalid alias, or eveything is a string, or similar.
gs2527
July 6, 2022, 2:56am
#5
Yes, everything is a string, is that incorrect?
<xml-groups>
<xml-group name="xml-palo-alto-ipsec" resource-type="node" resource-xpath="/response/result/IPSec/entry">
<xml-object name="Peer IP" type="String" xpath="peerip" />
<xml-object name="Name" type="String" xpath="name" />
<xml-object name="Local IP" type="String" xpath="localip" />
</xml-group>
</xml-groups>
It isn’t incorrect per se, but only numerical data are stored in RRD files, while strings are stored in strings.properties
instead. That would explain why you aren’t seeing RRDs create.
gs2527
July 6, 2022, 3:31am
#7
That makes sense. Is there a way to store (and possibly alert on) these metrics then?
They are stored but not as a series over time, just as a string in a file named string.properties
in the same directory where the RRD would be.
Unfortunately, you can’t threshold on strings, and in graphs they are only useful as labels (Xaxis, Yaxis, resourceTypes, etc)
Hi dino2gnt.
I think that when we have a resource that only collects string values, we can’t get that resource using the RestAPI Resources API (opennms.com) . Is this a limitation or a bug, do you know?
How are you calling the API? I don’t have a resource handy that is only strings to verify, but for mixed data types I can see string resources via the resources API (with /opennms/rest/resources/fornode/1
for example)
Hi. Yes, it is that way that I’m calling it.
If you have a linux system that is reporting temperature sensors via netsnmp agent one way to test it is to temporarily change on etc/datacollection/netsnmp.xml the type of lms-temp to string and you should be able to reproduce it.
This is an example, it can be done with other collection that might be easier for you to test.
Example to reproduce, change lms-temp from gauge32 to string, below.
<group name="lmsensors-temp" ifType="all">
<mibObj oid=".1.3.6.1.4.1.2021.13.16.2.1.2" instance="lmTempIndex" alias="lms-tempdevice" type="string"/>
<mibObj oid=".1.3.6.1.4.1.2021.13.16.2.1.3" instance="lmTempIndex" alias="lms-temp" type="gauge32"/>
</group>
gs2527
July 26, 2022, 12:22am
#12
Hi,
Any further details on using the Resources API?
Thanks!
I encourage you to make an bug report @ issues.opennms.org and include the reproducer details and a link to this thread. If you share the issue number, I’ll try to get it some traction.
gs2527
July 27, 2022, 11:58pm
#14
Will do. In the meantime I was able to get string values mapped to numeric data by following the “Mapping values” section below -
https://docs.opennms.com/horizon/30/reference/performance-data-collection/collectors/xml.html
I am trying to plot these “numeric” values to graphs, however I am not sure where will the definition reside, I see the following for snmp-graphs
-rw-r--r-- 1 opennms opennms 1317 Jun 8 13:46 snmp-adhoc-graph.properties
-rw-r--r-- 1 opennms opennms 2529 Jun 8 13:46 snmp-graph.properties
drwxr-xr-x 2 opennms opennms 8192 Jul 1 13:35 snmp-graph.properties.d
For legacy reasons, all the graph definitions are in snmp-graph.properties.d/
gs2527
July 28, 2022, 7:48pm
#16
I am having a little trouble with persisting RRD files for the xml collector. Below is the config -
Resource-type definition -
<?xml version="1.0"?>
<resource-types>
<resourceType name="PABgpPeerStatus" label="BGP Peer" resourceLabel="ASN ${ASN}, Peer ${PeerIP}">
<persistenceSelectorStrategy class="org.opennms.netmgt.collection.support.PersistAllSelectorStrategy"/>
<storageStrategy class="org.opennms.protocols.xml.collector.XmlStorageStrategy"/>
</resourceType>
</resource-types>
XML Collector config -
<xml-groups>
<xml-group name="xml-palo-alto-bgp" resource-type="PABgpPeerStatus" resource-xpath="/response/result/entry[@peer]">
<xml-object name="PeerGroup" type="String" xpath="peer-group" instance="PABgpPeerStatus" />
<xml-object name="Status" type="Gauge" xpath="status" instance="PABgpPeerStatus">
<xml-mapping from="Idle" to="0" />
</xml-object>
<xml-object name="PeerIP" type="String" xpath="peer-address" instance="PABgpPeerStatus"/>
<xml-object name="ASN" type="Gauge" xpath="remote-as" instance="PABgpPeerStatus"/>
<xml-object name="LocalIP" type="String" xpath="local-address" instance="PABgpPeerStatus" />
</xml-group>
</xml-groups>
The data collection works through the Karaf shell -
admin@opennms()> opennms:collect -n 16 org.opennms.protocols.xml.collector.XmlCollector X.X.X.X handler-class=org.opennms.protocols.xml.collector.DefaultXmlCollectionHandler collection=xml-palo-alto-bgp
GenericTypeResource[node=NodeLevelResource[nodeId=16, path=null], instance=node, unmodified-instance=node, resourceType=ResourceType [name=PABgpPeerStatus, label=BGP Peer, resourceLabel=ASN ${ASN}, Peer ${PeerIP}, persistenceSelectorStrategy=PersistenceSelectorStrategy [class=org.opennms.netmgt.collection.support.PersistAllSelectorStrategy, parameters=[]], storageStrategy=StorageStrategy [class=org.opennms.protocols.xml.collector.XmlStorageStrategy, parameters=[]]], storageStrategy=org.opennms.protocols.xml.collector.XmlStorageStrategy@45b77923, persistenceSelectorStrategy=org.opennms.netmgt.collection.support.PersistAllSelectorStrategy@366da76]
Group: xml-palo-alto-bgp
Attribute[PeerGroup:abc]
Attribute[Status:0.0]
Attribute[PeerIP:X.X.X.X]
Attribute[ASN:]
Attribute[LocalIP:Z.Z.Z.Z]
Attribute[PeerGroup:xyz]
Attribute[Status:0.0]
Attribute[PeerIP:X.X.X.X]
Attribute[ASN:64514.0]
Attribute[LocalIP:X.X.X.X]
RRD files -
root@d0082e83f989:/usr/share/opennms/share/rrd/snmp/fs/Staging/1654718088386/PABgpPeerStatus/node# ls -l
total 92
-rw-rw-r-- 1 root root 62 Jul 28 11:40 ASN.meta
-rw-r--r-- 1 root root 38232 Jul 28 13:42 ASN.rrd
-rw-rw-r-- 1 root root 68 Jul 28 11:40 Status.meta
-rw-r--r-- 1 root root 38232 Jul 28 13:42 Status.rrd
-rw-rw-r-- 1 root root 92 Jul 28 13:42 strings.properties
I am basically looking to persist files per PeerIP
instead of being node
, anything that can help alter the node
structure?
In your resourceType
, try something like:
<storageStrategy class="org.opennms.netmgt.dao.support.SiblingColumnStorageStrategy">
<parameter key="sibling-column-name" value="PeerIP"/>
</storageStrategy>
gs2527
August 3, 2022, 2:33pm
#18
Thanks I will try this out.