api call for uptime returns plaintext not json #2025
-
Calling glances api by curl yields this plaintext result: http://0.0.0.0:61208/api/3/uptime: "1 day, 15:45:28" Whereas other calls return json as expected: http://0.0.0.0:61208/api/3/core: {"phys": 6, "log": 12} Peculiarly, 'glances --issue' gives json result: uptime [OK] 0.00004s {'seconds': 140725} I notice that 2 other api fields that have only a single value ('psutilversion' and 'now') return plaintext both by curl and --issue. As far as I can tell only 'uptime' returns different data types in curl vs --issue. Caveat: I have not tried ALL of the possible api calls so I don't know all where this occurs. What is the reason for this to happen? I saw nothing in the api documentation that would explain this. The '--issue' option isn't mentioned in the docs that I could see. I only knew to use it from an earlier question here. There may be other undocumented options/switches. Q: Is there a way for user to receive from the api a json response for uptime? No responses in official google group since Sep 2021 so I post this here. Regards, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
It seems glances must run a task, maybe at startup, that gets the public ip. This means it would not change what is reported if/when my isp changes my ip until glances restarts. cat /proc/uptime show uptime in seconds, which is probably where --issue gets it. The simple command 'uptime' returns the formatted information so this is reported via api. Why they are handled differently I can't guess. So just those minor confusions in the documentation. This concludes my several hour trip into proc and psutil. |
Beta Was this translation helpful? Give feedback.
It seems glances must run a task, maybe at startup, that gets the public ip. This means it would not change what is reported if/when my isp changes my ip until glances restarts.
cat /proc/uptime show uptime in seconds, which is probably where --issue gets it. The simple command 'uptime' returns the formatted information so this is reported via api. Why they are handled differently I can't guess. So just those minor confusions in the documentation.
This concludes my several hour trip into proc and psutil.