Zabbix: LLD-monitoring of iron under Windows PowerShell

Changelog

It's time for me to collect my bike to monitor the physical condition of Windows-iron. Ready-made solutions or at least more or less working not been able to find since my acquaintance with Zabbix, which is more than 3 years. And even more that it was... elegant. I personally even such things want to see harmony and maximum functionality. It is therefore further considered only LLD and PowerShell. And of course only free SOFTWARE.

Thus, the monitoring of which will be:

the
    the
  • S. M. A. R. T. disks (information, General condition and individual indicators)
  • the
  • Temperature, voltage, speed of a cooler (your choice)

And it will all look like this:



In total you will need:

    the
  1. smartmontools
  2. the
  3. OpenHardwareMonitor
  4. the
  5. NSSM
  6. the
  7. 2 PS script below
  8. the
  9. template

the

Template


Under the spoiler is the actual template. Just save the contents in xml format and import to your Zabbix.

Template


Created a template in Zabbix version 3.2, may work in earlier versions. The keys are standard and are of the form ZScript[script-name, parameter1,.., параметрN]. Parameters are passed directly to the script itself.

I hope the template is to be maximally simple and clear.

the

PS Scripts


Below are the required scripts. Inside are already and detection, and query individual elements. Working tested on Windows XP SP3 until 2016. Of course, the solution with Policy Execution.

windows.hdd.ps1 -> For smartmontools


Found only discs involved SmarTeam. Parameters are queried from the column "RAW_VALUE". Want to monitor a different parameter? Just give the number. By default, the brackets and their contents are discarded. If you need the option disk does not give, it returns a blank field.

windows.hard.ps1 -> OHM


By default the script does not detect the names of the sensors that have #. What is it, see below.

Also reserved one-sensor name — Vbat. Is the battery in the BIOS. Its value in a separate item to trigger (triggered if less than 2.9 V).

Temperatures and rpm of the coolers at the outlet of integer type, the stress values are passed as is.

Theoretically, it is possible to find other parameters (load, frequency,..). Use the appropriate second parameter in the key. For example: ZScript[hard,discovery,load].

the

Preparation Zabbix-agent


For maximum unification, I use the following and the only option for their scripts:

the
UserParameter=ZScript[*],powershell C:\System\Zabbix\Scripts\windows.$1.ps1 "$2" "$3"

This gives maximum flexibility and monotony. If you need to add more parameters to any scripts, you can simply add the variables in quotes. The current running script is not affected. The prefix windows I use, just in case, I'm so easy to store templates for guaranteed identification.

the

smartmontools


For monitoring disk used smartmontools (version 6.5 at the time of writing). When you install the default setting of the utility smartctl-nc — it is used in the script to make life easier for your server. You will also need to specify the path to the directory bin in variable environments.



A path is simply appended to the end of the Path variable using a semicolon. The default is C:\Program Files\smartmontools\bin


the

OpenHardwareMonitor


For sensors used OHM. Software free open source software. Installation is trivial, but to complete the work necessary to run the program as a service. For such things there is NSSM, I would still advise you to rock latest build. And here you can see the syntax.
The promised choice of sensors is assured by the fact that the names of the sensors can edit! Change the names to human readable (they will be used in element names), and unnecessary sensors comment #.

Don't forget to restart the program/service to apply the rename.



the

total


The result was a good tool for monitoring. Anyone can hang your triggers on the desired prototype elements. Or completely rework the template.

2017/07/05 UPDATE: fixed a bug in windows.hdd.ps1 — now in JSON there is a semicolon at the beginning.
Article based on information from habrahabr.ru

Комментарии

Популярные сообщения из этого блога

Wikia Search — first impressions

Emulator data from GNSS receiver NMEA

mSearch: search + filter for MODX Revolution