I created this quick xmlexample schema for RESTmon using the XML you provided and a guess at the url, I assumed the url likely uses Basic Authentication
RESTmon supports xpath to extract xml data the same as it uses jsonpath for json.
{
"xmlexample": {
"urls": [{
"id": "status",
"url": "/status.xml"
}],
"definition": {
"resource_category": null,
"defaults": {
"checkcert": "no",
"port": 443,
"interval": 60,
"httptimeout": 30000
},
"addedProfileFields": [{
"name": "username",
"value": "",
"type": "text",
"label": "Username"
},
{
"name": "password",
"value": "",
"type": "password",
"label": "Password"
}],
"auth": "basic",
"name": "xmlexample",
"type": "https"
},
"metrics": [{
"calculation": "",
"xml_ns": "",
"attributes": {
"uim": {
"qos_name": "QOS_HTTP_STATUS",
"ci_type": "2.2.2.2",
"qos_desc": "HTTP response status (State)",
"qos_abbr": "State",
"metric_type": "2",
"qos_unit": "State",
"source": "%hostname",
"target": "%urlid",
"defaultpublishing": "true"
}
},
"value": "%httpstatus",
"url": "%urlid",
"group": "Connections",
"helptext" : "This monitor indicates the following response codes: HTTP Status Response code 200 (OK),401 (Unauthorized) and 403 (Forbidden)"
},
{
"xml_ns": "",
"attributes": {
"uim": {
"conversion": "Connected:1, NotConnected:0, Default:-999",
"qos_name": "QOS_XMLEX_MICROPHONE_STATUS",
"metric_type": "9.9.9:1",
"qos_desc": "Microphone Status (Boolean)",
"qos_abbr": "boolean",
"qos_unit": "boolean",
"source": "%hostname",
"target": "/Audio/Input/Connectors/Microphone/@item",
"defaultpublishing": "true"
}
},
"value": "/Audio/Input/Connectors/Microphone/ConnectionStatus",
"url": "status",
"group": "General",
"helptext" : "Value 1 shows if microphone is connected and value 0 shows if it is not connected."
}],
"calculated_metrics": []
}
}
Hope this helps, let me know if you need anymore help
Justin
Original Message:
Sent: 07-09-2019 01:10 PM
From: Justin Young
Subject: Best way to create alerts based on a xml response from a URL
Hi Devi Ojha
This XML looks very similar to XML returned from Tandberg Video Conferencing devices.
Turn the status into a metric that you can Alarm off in UIM using RESTmon would be very easy.
Could you give me an example of the URL you are calling that returned the XML at the top of this thread.
Regards
Justin
Original Message:
Sent: 07-09-2019 04:18 AM
From: devi ojha
Subject: Best way to create alerts based on a xml response from a URL
Thanks a lot Frank , i will give a try with logmon probe .
Original Message:
Sent: 07-08-2019 09:15 PM
From: Franklin D'souza
Subject: Best way to create alerts based on a xml response from a URL
Hi
Can also explore the logmon probe to parse xml file
https://docops.ca.com/ca-unified-infrastructure-management-probes/ga/en/alphabetical-probe-articles/logmon-log-monitoring/logmon-hints-and-examples#logmonHintsandExamples-Example3XMLFile
Original Message:
Sent: 07-08-2019 01:06 PM
From: devi ojha
Subject: Best way to create alerts based on a xml response from a URL
hello All ,
we have use case,
a XML response need to be parsed and alerts need to be created based on various elements in the xml .
Initially it was only one field to be checked so we used url_response to simply check for STRING_FOUND "<Status>Registered</Status>" and we we were fine :
sample alert was like "URL content for 'hostname-*****' contains the unexpected text '<Status>Registered</Status>' "
however we now want to check for many common additional fields from the response . for example , in the below xml response we want to
check for various <ConnectionStatus> of the microphones . So what would be the best way to parse the xml and create and alert like
Microphone item="1" status Disconnected ?
can we leverage restmon for this ? is it suitable for XML responses , if so can you please help me with a sample schema ? or is there any other better way to do this monitoring .
<Audio>
<Input>
<Connectors>
<HDMI item="1" maxOccurrence="n">
</HDMI>
<HDMI item="2" maxOccurrence="n">
</HDMI>
<Microphone item="1" maxOccurrence="n">
<ConnectionStatus>Connected</ConnectionStatus>
<Mute>Off</Mute>
</Microphone>
<Microphone item="2" maxOccurrence="n">
<ConnectionStatus>NotConnected</ConnectionStatus>
<Mute>Off</Mute>
</Microphone>
<Microphone item="3" maxOccurrence="n">
<ConnectionStatus>NotConnected</ConnectionStatus>
<Mute>Off</Mute>
</Microphone>
</Connectors>
<KeyClick>
<Attenuate>On</Attenuate>
<Detected>Silence</Detected>
<Enabled>Off</Enabled>
</KeyClick>
</Input>
<Microphones>
</Microphones>
<Output>
<Connectors>
<Line item="1" maxOccurrence="n">
<ConnectionStatus>NotConnected</ConnectionStatus>
</Line>
</Connectors>
</Output>
<Volume>70</Volume>
<VolumeMute>Off</VolumeMute>
</Audio>
Thanks
------------------------------
Devi Ojha
------------------------------