Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http.json not converting numeric and float strings to floats #2904

Closed
kotarusv opened this issue Jun 9, 2017 · 2 comments
Closed

http.json not converting numeric and float strings to floats #2904

kotarusv opened this issue Jun 9, 2017 · 2 comments

Comments

@kotarusv
Copy link

kotarusv commented Jun 9, 2017

We are using Netscaler as LB. trying to monitor Netscaler health and CPU metrics using telegraf http.json plugin. Unfortunately Netscaler putting quotes for numbers and floats as well. Not sure why they are doing.Is it possible to convert them to floats using any mapping?

below is sample output from 2 Netscaler API's

http:///nitro/v1/stat/hanode

{
"errorcode": 0,
"message": "Done",
"severity": "NONE",
"hanode": {
"hacurstatus": "YES",
"hacurstate": "UP",
"hacurmasterstate": "Secondary",
"transtime": "Wed May 24 14:31:57 2017",
"hatotpktrx": "6955746",
"hapktrxrate": 5,
"hatotpkttx": "6981947",
"hapkttxrate": 5,
"haerrproptimeout": "0",
"haerrsyncfailure": "0"
}
}

CPU and memory usage:
http://FQDN/nitro/v1/stat/ns?args=detail:true

{
"errorcode": 0,
"message": "Done",
"severity": "NONE",
"ns": {
"rescpuusagepcnt": 0,
"cpuusagepcnt": 0,
"cachemaxmemorykb": "0",
"delcmpratio": 0,
"rescpuusage": "0",
"cpuusage": "0",
"resmemusage": "0",
"comptotaldatacompressionratio": 1,
"compratio": 0,
"cacheutilizedmemorykb": "0",
"cachemaxmemoryactivekb": "0",
"cache64maxmemorykb": "0",
"cachepercentoriginbandwidthsaved": "0",
"cachetotmisses": "0",
"cachemissesrate": 0,
"cachetothits": "0",
"cachehitsrate": 0,
"sslnumcardsup": "0",
"memusagepcnt": 5.779006,
"memuseinmb": "1029",
"mgmtcpuusagepcnt": 3.6,
"pktcpuusagepcnt": 0.8,
"starttime": "Wed May 24 14:31:57 2017",
"transtime": "Wed May 24 14:31:57 2017",
"hacurstate": "UP",
"hacurmasterstate": "Secondary",
"sslcards": "0",
"disk0perusage": 18,
"disk1perusage": 37,
"disk0avail": 1189,
"disk1avail": 7970,
"totrxmbits": "80503",
"rxmbitsrate": 0,
"tottxmbits": "22168",
"txmbitsrate": 0,
"tcpcurclientconn": "67",
"tcpcurclientconnestablished": "66",
"tcpcurserverconn": "8",
"tcpcurserverconnestablished": "8",
"httptotrequests": "34",
"httprequestsrate": 0,
"httptotresponses": "34",
"httpresponsesrate": 0,
"httptotrxrequestbytes": "34613",
"httprxrequestbytesrate": 0,
"httptotrxresponsebytes": "183980",
"httprxresponsebytesrate": 0,
"ssltottransactions": "0",
"ssltransactionsrate": 0,
"ssltotsessionhits": "0",
"sslsessionhitsrate": 0,
"appfirewallrequests": "0",
"appfirewallrequestsrate": 0,
"appfirewallresponses": "0",
"appfirewallresponsesrate": 0,
"appfirewallaborts": "0",
"appfirewallabortsrate": 0,
"appfirewallredirects": "0",
"appfirewallredirectsrate": 0,
"misccounter0": 0,
"misccounter1": 0,
"numcpus": "5"
}
}

If you look at, very important metrics have quotes thus telegraf treating it as strings rather numbers/floats. I have seen this behaviour in couple of other API calls as well

It would be great help if we able to convert strong quoted numbers/floats to real floats Because of this limitation, we are unable to use telegraf to collect important metrics of our netscaler based load balancers.

Srinivas Kotaru

@danielnelson
Copy link
Contributor

It's not currently possible unfortunately, we have an issue open for this #2835.

@RAMKUMARCHANDRAPATI
Copy link

Hi Srinivas,
I hope you are getting an error as Json object parameter value as string ....try below when you are pulling the data.

in Python:
Band_Width = obj['ns']['totrxmbits']
print (Band_Width)

Once you have the 'Band_Width' value , you can call it to anywhere like int(Band_Width) . which would be integer.

HOPE this Helps!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants