Ad Widget

Collapse

All about UserParameters on Windows

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tokind
    Member
    • May 2007
    • 47

    #1

    All about UserParameters on Windows

    Note: this script is probably not nessesary. See "VBScript hack not needed?", Below.

    I put together a little package to get useful information from Windows 2000, 2003 Servers and even XP workstations if you wish.

    The typeperf.exe command will show you a list of registered system objects, typically used in perfmon, the windows performance monitoring application. You may use the UserParameter section in zabbix_agentd.conf to query any of these values. The output of typeperf.exe contains several lines of information and will continue to output data until you cancel it with ^c. I wrote a crude VBScript that serves as a wrapper to return only a single sample (typically a float value) to the Zabbix agent.

    Note: Windows 2000 does not have typeperf.exe unless you get a copy of it and drop it into the Windows\System folder. This is perfectly safe to do. The program was once included in a Windows 2000 Server Resource kit which is no longer available from Microsoft. I was able to find a copy here. (I hit a major snag... this setup does not work on Windows 2000 as presented. The Syntax of the typeperf command is different, and the options are not present. See VBScript hack not needed?, below. )

    Windows 2003 server and Windows XP come with this program.

    You may download a copy of the VBScript and a sample zabbix_agend.conf here.

    For a list of system objects you may query on your Windows server, try the command typeperf -qx > typeperf.txt and then examine the contents of the output file.

    The UserParameter query format looks like this:
    Code:
    UserParameter=Zab_Object_Name,cscript //Nologo typeperf.vbs "object"
    You will use cscript.exe to load your VBScript script so that the program returns the output to the command instance, rather than pop it up in a window. The //Nologo parameter suppresses the standard banner output by cscript. The object you specify should be passed in quotes, because many of these object keys have spaces in them.

    Install the Zabbix agent on your windows server by placing the the ZabbixW32.exe, zabbix_agentd.conf, and Typeperf.vbs files on the server. I like to place these in a c:\zabbix folder.

    Zabbix_agend.conf
    Edit the Server= IP address to the address of your Zabbix server.
    Edit the Hostname= to the machine name of your server.
    Edit the ListenIP= to the ip address of this machine.
    I set DisableActive=1, as I only want to use passive mode.
    Edit LogFile=C:\Zabbix\zabbix_agentd.log

    From the command line, register the agent service and reference your configuration file.

    Code:
     ZabbixW32.exe --config c:\zabbix\zabbix_agentd.conf install
    You may then start the service, either by going to Start -> Administrative Tools -> Services, or by running:

    Code:
     ZabbixW32 start
    You must restart this service in case you make any changes to the configuration file.

    Testing with zabbix_get
    I find it useful to use zabbix_get to test the query you are running, to make sure that it functions as intended on the Windows server. Zabbix_get is located in /usr/local/bin/zabbix on my server. The syntax is:

    Code:
     zabbix_get -s[I]ip address[/I] -k[I]parameter name[/I]
    Use the result, and the Zabbix client log file on your Windows box, to troubleshoot any problems.

    Creating a monitored Item
    First create a host entry in the Zabbix Configuration area. Once you have created your host, click on its Items link and create a new Item. Give it a descriptive name, select Zabbix Agent as the Type. Enter the parameter name as the Key. Select Float as the Data Type. Configure the remaining parameters according to the type of data and your needs.
    Last edited by tokind; 11-06-2007, 17:30. Reason: Solution attained.
  • dratliff
    Member
    • May 2007
    • 40

    #2
    so nice

    typeperf -qx

    Thank you. What a great help. Much easier than what I was doing.

    Now to your question, I was just so enthralled with the cmd you posted.

    I am still fairly new with zabbix, but I have had to spend a lot of time with checking my agent config. The best way I found was to look at the log after restarting the service and doing a zabbix_get on the server.

    Usually when I was getting a not supported error, it was because I had some syntax wrong within the .conf file.
    Last edited by dratliff; 25-05-2007, 15:31.

    Comment

    • tokind
      Member
      • May 2007
      • 47

      #3
      I had not tried zabbix_get yet. I'll try it.

      It looks like I am going to have to write some VBScript wrapper to extract the value I want from the output of the typeperf command.

      VBScript is common to all Windows platforms, so it is a logical way to get this done. It would be ideal to write a script which supports parameters to format the various values returned by different typeperf queries.

      I guess I had better brush up on my VBScript.

      Comment

      • claytronic
        Member
        • Nov 2006
        • 52

        #4
        Wow. Thanks for posting the typeperf -qx command.

        --
        Claytonic

        Comment

        • tokind
          Member
          • May 2007
          • 47

          #5
          Here is a rudimentary VBScript for the purpose of returning just the float value of the desired parameter. Notes on use enclosed.



          I'll do something in the Wiki as I solidify this.

          Comment

          • tokind
            Member
            • May 2007
            • 47

            #6
            Is your target Windows 2000 Server? You will need to download the typeperf component of the Windows 2000 Server Resource Kit, apparently only available here: (Not @ Microsoft anymore):

            Comment

            • tronite
              Senior Member
              • Jun 2007
              • 147

              #7
              Originally posted by tokind
              I put together a little package to get useful information from Windows 2000, 2003 Servers and even XP workstations if you wish...

              ...f here...

              ...name[/I] as the Key. Select Float as the Data Type. Configure the remaining parameters according to the type of data and your needs.
              It's people like you that make zabbix such a powerful resource.

              Comment

              • tokind
                Member
                • May 2007
                • 47

                #8
                VBScript hack not needed?

                Last week I discovered that my search for solutions on monitoring Windows server items could have been addressed by documentation. The PerfCounter function is build into the ZabbixW32 agent. It's just not documented (not anywhere I have been able to find, until I found more in these forums.

                See:



                Some of these articles suggest that there may be problems on certain versions of the agent on 2003 servers. I used these articles as a reference to get data from the agent running on 2000 servers, where the perfmon.exe does not support and switches -- e.g. the "/sc 1" to specify one sample then exit. The script I wrote does not work on 2000, because the perfmon call does not complete. It will continue to return values at a specified interval, so the script never returns a value. I was not able to figure out how to terminate the perfmon program so that the script could complete. PerfCounter came to my rescue.

                In a nutshell: I used the PerfCounter agent function, but had to run the Perfmon (Start-> Programs-> Administrative tools-> Performance Monitor) and add counters in there, then look at the properties of the counters in order to get the object names. I then added the desired objects to zabbix_agentd.conf in the following manner:

                Code:
                  PerfCounter = CPU_Load,"\Processor(_Total)\%Processor Time",5
                I have tested this on Windows 2000 using the agent version 1.1 build Jun 5 2006. This is the agent included in the current stable version package 1.4.

                I only have two 2003 servers in my stable, and will test the PerfCounter function to replace the VBScript function I wrote ASAP.

                We could all benefit a great deal from having this documented in the Wiki, and eventually incorporated into the PDF documentation and Cookbook.
                Last edited by tokind; 11-06-2007, 17:27.

                Comment

                • KitWalker
                  Junior Member
                  • Jan 2006
                  • 17

                  #9
                  PerfCounter works quite well.

                  Also, it was documented on previous Zabbix versions. Maybe it got lost in last documentation?



                  I'm still using 1.1.7. Here are some Win2003 counters that I use:

                  PerfCounter = NetIn,"\Network Interface(BASP Virtual Adapter)\Bytes Received/sec",30
                  PerfCounter = NetOut,"\Network Interface(BASP Virtual Adapter)\Bytes Sent/sec",30
                  PerfCounter = vm.memory.size[used],"\Memory\Committed Bytes",30

                  You can use almost any PerfCounter data from the Windows PerfMon. Hope it helps!

                  Comment

                  • tokind
                    Member
                    • May 2007
                    • 47

                    #10
                    Now featured on the Wiki

                    Thanks for your feedback, now featured on the Wiki:
                    http://www.zabbix.com/wiki/doku.php?...oring_solution

                    Comment

                    Working...