Ad Widget

Collapse

Perf Counter Windows calculate and average values

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • themons
    Senior Member
    • Feb 2005
    • 110

    #1

    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 )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,....)
    Zabbix 1.8.3
    SLES 11 x64

    French Zabbix user
  • cooper
    Senior Member
    • Sep 2004
    • 110

    #2
    Originally posted by themons
    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.

    Originally posted by themons
    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:
    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
    Code:
    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
    Code:
    pctfree = Round((objitem.freespace/objitem.size)*100,2)
    Wscript.echo pctfree
    with these:
    Code:
    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
    Last edited by cooper; 11-03-2005, 17:37.

    Comment

    • themons
      Senior Member
      • Feb 2005
      • 110

      #3
      thanks i will try this monday now i am in week end
      nobody knao can i have averga usage of the network connection on 1 5 and 15 minutes ????
      Zabbix 1.8.3
      SLES 11 x64

      French Zabbix user

      Comment

      • cooper
        Senior Member
        • Sep 2004
        • 110

        #4
        you might want to try relpacing
        Code:
        Wscript.echo pctfree
        
        with
        
        wscript.stdout.write pctfree
        I think it will work better with zabbix.


        cooper

        Comment

        • cooper
          Senior Member
          • Sep 2004
          • 110

          #5
          Originally posted by themons

          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 )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
          Code:
          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

          Comment

          • themons
            Senior Member
            • Feb 2005
            • 110

            #6
            thanks it works.
            Zabbix 1.8.3
            SLES 11 x64

            French Zabbix user

            Comment

            Working...