I think either I’m uber confused, through my efforts, or this simply isn’t possible yet, however;
There is a service that I wish to monitor, whose only data source that I can realistically monitor is an HTTP endpoint that returns a text response like so:
{"1.3.6.1.2.1.10.127.1.1.5.0":"4",
"1.3.6.1.2.1.10.127.1.1.4.1.3.1":"602",
"1.3.6.1.2.1.10.127.1.1.4.1.4.1":"0",
"1.3.6.1.2.1.10.127.1.1.4.1.5.1":"386",
"1.3.6.1.4.1.4491.2.1.20.1.24.1.1.1":"386",
"1.3.6.1.2.1.10.127.1.1.4.1.3.2":"390",
"1.3.6.1.2.1.10.127.1.1.4.1.4.2":"0",
....this then carries on for many, many fields..
}
The config I started with looks like this:
[[inputs.http]]
interval = "1m"
urls = ["http://127.0.0.1/getMyDats"]
data_format = "json"
So far so good. However, I don’t want all the fields, so I’ve narrowed them down…
fieldpass = ["1.3.6.1.2.1.10.127.1.1.5.0", "1.3.6.1.2.1.10.127.1.1.4.1.3.1"]
That’s ok, but now I want them named differently…
[[processors.rename]]
order = 1
[[processors.rename.replace]]
field = "1.3.6.1.2.1.10.127.1.1.5.0"
dest = "bunnies"
[[processors.rename.replace]]
field = "1.3.6.1.2.1.10.127.1.1.4.1.3.1"
dest = "flowers"
That should be ok, right?
The problem, however, is that the data-producing system has output all its values as strings. My approach then was to add the following:
json_string_fields = ["1.3.6.1.2.1.10.127.1.1.5.0", "1.3.6.1.2.1.10.127.1.1.4.1.3.1"]
…which seemed to then fix my issue of data not being stored. Data was being collected and I could see that it was being stored.
24 hours later, I decide to actually show it on Grafana. Oddly, none of the values actually “displayed”, but graphs are definitely visible, so I didn’t worry about it too much. Until I ran a math operation on a field. At that point, it refuses to doso… because the type is - of course - string…
So the question is…
How do I attempt to store these “string” values as numeric data in the first place? I hope I’ve overlooked the answer to this, but there doesn’t seem to be some basic parsing of string to a numeric type anywhere. I find that hard to believe, though?
Thanks!