Need help parsing XML to telegraf, happy to pay

Hi,

I’m trying to parse http://unix.co.nz/smsc02.htm (XML) example to telegraf.

SMS: received 58101 (1 queued), sent 266208 (0 queued), store size 1

These values will change the more messages sent or received and I want to graph it using grafana. I will poll the XML every minute so it needs to be able to work out what’s changed and then show messages per minute sent or received and want to show total per day etc.

For each “SMSC connections:” I wish to record the received and sent for each id and do the same things as above, see how many messages per minute have been sent or received and total per hour or day or month etc.

Any help with creating this telegraf config and the grafana json for the dashboard would be greatly appreciated. Happy to send some money your way for the assistance too.

Hello @icepicknz,
Welcome!
Have you seen this blog post? It’s quite excellent and might help you:

Yes thanks was a bit over my head. I have done JSON integration before which worked; but the XML one is a little too much for my little brain

This is a working example and should be enough to go on with it yourself:

[[inputs.http]]
  name_override = "smsc"
  tagexclude = ["url"]  # we don't need the url tag in every metric
  urls = ["http://unix.co.nz/smsc02.htm"]
  data_format = "xml"
  [[inputs.http.xml]]
    metric_selection = "/gateway/smscs/smsc"
    [inputs.http.xml.tags]
      id = "string(id)"
    [inputs.http.xml.fields_int]
      failed = "number(failed)"
      queued = "number(queued)"
      received = "number(sms/received)"
      sent = "number(sms/sent)"
    [inputs.http.xml.fields]
      name = "string(name)"
      status = "string(status)"

[[outputs.file]]  # file output only for debugging
  files = ["xmlsms.out"]
  influx_sort_fields = true
1 Like