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:
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.
You may then start the service, either by going to Start -> Administrative Tools -> Services, or by running:
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:
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.
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"
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
Code:
ZabbixW32 start
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]
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.
Comment