Closed jriker1 closed 8 months ago
The cpu utilization is measured once a second (per core) and stored for 1hour per default. You can then request the average utilization for given durations. Have you actually tried SNClient and noticed an issue or is this just a general question?
Was a question, now that I tried it maybe an issue or usage problem. Seems the same as NSClient++. If I run say:
curl -k --user <username/password> 'https://
Well I uninstalled it but basically returns the same as NSClient++ info. So it would say return like the example below something like 5 - 7%:
{"command":"check_cpu","lines":[{"message":"OK: CPU load is ok.","perf":{"total 1m":{"critical":90,"maximum":0,"minimum":0,"unit":"%","value":5,"warning":80},"total 5m":{"critical":90,"maximum":0,"minimum":0,"unit":"%","value":5,"warning":80},"total 5s":{"critical":90,"maximum":0,"minimum":0,"unit":"%","value":5,"warning":80}}}],"result":0}
But the CPU is cranking away in Windows 11 at Task Manager say 60% utilization. So issue or usage question not sure.
Should note to that I'm not super concerned with anything historical, just at the point of check what is the total CPU usage percentage or if not possible maybe what is core 0?
Did a test with windows 11 vm:
Running the cpu check in a while loop:
while true; do ./check_nsc_web -k -p test -u https://192.168.56.12:8443 check_cpu time=3s; sleep 1; done
Looks good to me, the 3s average matches pretty much what the task manager shows.
Maybe one thing to note, the snclient gathers cpu metrics in memory only, so if you just (re)started the agent, the metrics can only calculated over the duration since the last restart.
closing this one, let me know if there any issues.
Sorry been a while until I could get back to this. Probably not getting it or there is some averages that makes it not current time but how would the above be working? You are reporting CPU utilization with snclient of let's say 9% but the task manager shows 24%.
I didn't found any description about how the task manager calculates the cpu load, so no idea tbh. Which time frame did you compare? 5s, 1m or 5m?
I'm using 5m.
Was curious. You mention "the 3s average matches pretty much what the task manager shows" The Task manager shows 24% not what your command prompt info is showing.
the command line output is not synchronized with the task manager. I'd expect the next check to match the 24% value. But you can see the 2 previous spikes in the list. Using the cpu value over 3 or 5 seconds does not make any sense anyway if your monitoring check_interval is one minute. The smallest timeframe should be longer or equal your check interval. Otherwise you just get random and worthless values.
I guess I am more looking for what the value is now, not an average.
Basically it is always an average because you have a cpu seconds
counter and divide by duration to get the percentage. But if you want the "current" value, just pick a very small duration. It just doesn't make much sense in my opinion. But that might depend on the actual use case.
I was using nsclient++ querying thru the web interface status of various items to report to a home automation tool I use. Still works but noticed that the cpu info reporting back is inaccurate. Like in the server it's showing 55% utilization in Windows but NSCLient++ reports back 8%. Noticed it's hard to pull those statistics in general from a Windows computer at least thru PowerShell. How well does SNCLient handle getting current CPU utilization? This would be for modern AM5 AMD CPUs in Windows 11 or Windows 2022.