While the things we learned about using Zabbix agents, creating items and yes, even user parameters are useful, there are some things that are specific to Windows system monitoring which we will look at now. For this section you will need a Windows machine that is accessible from the Zabbix server.
Installing Zabbix agent for Windows
To install the agent, it first has to be obtained. On Windows, compiling software is less common and most users get binary distributions, which is exactly what we will do now.
The Windows build of the Zabbix agent can be obtained from two official locations—either from the download page at http://www.zabbix.com/download.php, or from the source archive. This time it is suggested to use the one included inside the archive to make sure the versions match.The agent executable is located in the subdirectory bin/win32 or bin/win64—choose the one that is appropriate for your architecture and place it on some directory in the Windows machine.For simplicity, we’ll use C:zabbix this time, but you are free to use any other directory. We will also need the configuration file, so grab the example provided at misc/conf/zabbix_agentd.win.conf and place it in the same directory. Before we continue with the agent itself let’s figure out whether we need to alter the configuration in any way.Open C:zabbix_agentd.win.conf in your favorite text editor and look for any parameters we might want to change. Firstly, the log file location isn’t quite optimal—it’s set to c:zabbix_agentd.log, so let’s change it to read:
We have already learned that the server line, which currently reads Server=127.0.0.1, will have to be changed. Replace the 127.0.0.1 part with the IP address of your Zabbix server. As this is not a Zabbix server, replace the Hostname directive to read:
Now let’s try to start the agent up. Execute:
C:zabbix>zabbix_agentd.exe -c c:/zabbix/zabbix_agentd.win.conf
While the agent daemon does start up, it doesn’t like being started like that and prints a warning:
!!!ATTENTION!!! ZABBIX Agent started as a console application.
So what can we do to make it happier? First stop it by pressing Ctrl+C.The agent daemon executable on windows has additional options that can be passed to it, so execute in the command prompt (when located in the directory where zabbix_agentd.exe resides):
While the start of the output does not differ notably, we can see several additional parameters at the end of the help.
ZABBIX Agent Win32 (service) v1.8.1 (revision 9692) (27 January 2010)
usage: zabbix_agentd.exe [-Vhp] [-idsx] [-m] [-c
] [-t ]
Specify configuration file. Use absolute path
-h --help give this help
-V --version display version number
-p --print print supported metrics and exit
test specified metric and exit
Note that -t and -p switches do not work with user parameters. Use
-i --install install Zabbix agent as service
-d --uninstall uninstall Zabbix agent from service
-s --start start Zabbix agent service
-x --stop stop Zabbix agent service
-m --multiple-agents service name will include hostname
The Zabbix agent daemon for Windows includes functionality to install it as a standard Windows service, which is controlled by the last set of options. Unless you are simply doing some testing, you’ll want to properly install it, so let’s do that now.
C:zabbix>zabbix_agentd.exe -c c:/zabbix/zabbix_agentd.win.conf -i
The Zabbix agent daemon is installed as a Windows service using the configuration file, specified by the -c flag.
zabbix_agentd.exe : Service "ZABBIX Agent" installed
zabbix_agentd.exe : Event source "ZABBIX Agent" installed
You can verify in the Windows Control Panel, Services section, that the Zabbix service has indeed been installed:
While it has been set to start up automatically, it is stopped now. We can start it by either right clicking the Zabbix Agent service entry and choosing Start, or by using command line switch to zabbix_agentd.exe. Let’s try the latter method now:
C:zabbix>zabbix_agentd.exe -c c:/zabbix/zabbix_agentd.win.conf -s
Supposedly service was started successfully.
zabbix_agentd.exe : Service "ZABBIX Agent" started successfully.
Again, let’s verify in the services list that the Zabbix service has started up:
It looks like everything is fine on the monitored host, which we will now have to configure in the frontend. Open Configuration | Hosts, and click Create Host, then fill in the following values:
- Name: Enter Windows box.
- Groups: Select Windows servers in the Other Groups box, then click on the
- IP address: Enter the IP address of that host.
When you are done, click Save. Now select Windows servers in the Group dropdown and click on Items next to the Windows box, then click Create Item. Enter these values:
- Description: Enter CPU Load
- Key: Enter system.cpu.load
- Type of information: Select Numeric(float)
- Update interval: Enter 60
- Keep history: Enter 7
When you are done, click Save. We can now check out incoming data at Monitoring|Latest data—select Windows servers in the Group dropdown.
We have now successfully retrieved data on the CPU load for this Windows machine. Notice how the key syntax is the same as for Linux. This is true for several other keys, and you can check out the Zabbix documentation to determine which keys are supported on which platform.