View Full Version : Perf Counter Windows calculate and average values
documention is very short about this item. So i have linux an windows server on linux non problem to use user pararmeter but under widows it is more difficult.
I can have information from perf_counter, first i suppose that the number a the end of line was the time (in seconde) use to do an average (i dreamed :D )but it seem to be an update time.
1°) how can i do to obtain; for exemple; average byte per seconde of the network interface for 1 min/ 5min / 15 min (such as processor use).
i can have disk free space in MB but i want it in per cent
2°) how can i do to calculate a value in zabbix agent and the send it to the serveur such as in linux
3°)More generaly is it possible to create user parameter such as in linux, using shell command (windows shell,wmi,....)
i can have disk free space in MB but i want it in per cent
2°) how can i do to calculate a value in zabbix agent and the send it to the serveur such as in linux
agentd will not do any calculations on data it will only pass data back to server.
3°)More generaly is it possible to create user parameter such as in linux, using shell command (windows shell,wmi,....)
Yes. Use the following code:
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_LogicalDisk WHERE DeviceID='C:'",,48)
For Each objItem in colItems
pctfree = Round((objitem.freespace/objitem.size)*100,2)
Wscript.echo pctfree
Next
save it into a file called drivespace.vbs
then set up a user parameter like this
UserParameter=percfree[C:],cscript //nologo c:\zabbix\diskspace.vbs
This will return a percentage with 2 decimal points. Somthing like: 43.78.
If you want to get % used, then relplace these lines
pctfree = Round((objitem.freespace/objitem.size)*100,2)
Wscript.echo pctfree
with these:
usedspace = objitem.size - objitem.freespace
pctused = Round((usedspace/objitem.size)*100,2)
Wscript.echo pctused
You can also set DeviceID to be another drive besides C: Alexei's new wildcard userparameter could be very usefull for this scenario.
Also, I believe disk% is scheduled to appear in agentd for windows. Alexei just doesnt have a windows box with VC++ installed right now, so he has not rebuilt win32 agentd for a while.
HTH
cooper
thanks i will try this monday now i am in week end :D
nobody knao can i have averga usage of the network connection on 1 5 and 15 minutes ????
you might want to try relpacing
Wscript.echo pctfree
with
wscript.stdout.write pctfree
I think it will work better with zabbix.
cooper
I can have information from perf_counter, first i suppose that the number a the end of line was the time (in seconde) use to do an average (i dreamed :D )but it seem to be an update time.
1°) how can i do to obtain; for exemple; average byte per seconde of the network interface for 1 min/ 5min / 15 min (such as processor use).
This might be what you are looking for
PerfCounter = NetIn01,"\Network Interface\Bytes Recieved/sec\You NIC instanace here",60
PerfCounter = NetIn05,"\Network Interface\Bytes Recieved/sec\You NIC instanace here",300
PerfCounter = NetIn15,"\Network Interface\Bytes Recieved/sec\You NIC instanace here",900
From zabbix_server query item NetInXX
This should give you the average bytes/sec for the last Minute (60 sec.), 5min (300) and 15 (900)
I think this is what you are looking for.
HTH
cooper