自転車を組み立てて、Windowsハードウェアの物理的な状態を監視するときです。 私がZabbixに出会った瞬間から、既成のソリューションを見つけることはできませんでした。 そしてさらにそれは...エレガントか何かでした。 個人的には、そのようなことでも、調和と最大限の機能性を見たいです。 そのため、以下ではLLDとPowerShellのみが考慮されます。 そしてもちろん、フリーソフトウェアのみです。
したがって、監視対象は次のとおりです。
- SMARTドライブ(情報、一般的なステータス、選択したインジケータ)
- 温度、電圧、冷却速度( お好み )
そして、次のようになります。
必要な合計:
- smartmontools
- Openhardwaremonitor
- NSSM
- 以下のPSの2つのスクリプト
- パターン
模様
ネタバレの下に現在のテンプレートがあります。 コンテンツをxml形式で保存し、Zabbixにインポートするだけです。
模様
<?xml version="1.0" encoding="UTF-8"?> | |
<zabbix_export> | |
<version>3.2</version> | |
<date>2017-03-01T13:35:09Z</date> | |
<groups> | |
<group> | |
<name>Templates</name> | |
</group> | |
</groups> | |
<templates> | |
<template> | |
<template>Hardware - Windows</template> | |
<name>Hardware - Windows</name> | |
<description> : | |
smartmontools ( Path), OHM ( ) | |
| |
: | |
windows.hard.ps1 -> C:\System\Zabbix\Scripts\ | |
| |
UserParameter=ZScript[*],powershell C:\System\Zabbix\Scripts\windows.$1.ps1 "$2" "$3"</description> | |
<groups> | |
<group> | |
<name>Templates</name> | |
</group> | |
</groups> | |
<applications> | |
<application> | |
<name> </name> | |
</application> | |
<application> | |
<name></name> | |
</application> | |
</applications> | |
<items> | |
<item> | |
<name> BIOS</name> | |
<type>0</type> | |
<snmp_community/> | |
<multiplier>0</multiplier> | |
<snmp_oid/> | |
<key>ZScript[hard,VBAT]</key> | |
<delay>300</delay> | |
<history>90</history> | |
<trends>365</trends> | |
<status>0</status> | |
<value_type>0</value_type> | |
<allowed_hosts/> | |
<units>V</units> | |
<delta>0</delta> | |
<snmpv3_contextname/> | |
<snmpv3_securityname/> | |
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |
<snmpv3_authpassphrase/> | |
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |
<snmpv3_privpassphrase/> | |
<formula>1</formula> | |
<delay_flex/> | |
<params/> | |
<ipmi_sensor/> | |
<data_type>0</data_type> | |
<authtype>0</authtype> | |
<username/> | |
<password/> | |
<publickey/> | |
<privatekey/> | |
<port/> | |
<description/> | |
<inventory_link>0</inventory_link> | |
<applications> | |
<application> | |
<name></name> | |
</application> | |
</applications> | |
<valuemap/> | |
<logtimefmt/> | |
</item> | |
</items> | |
<discovery_rules> | |
<discovery_rule> | |
<name> </name> | |
<type>0</type> | |
<snmp_community/> | |
<snmp_oid/> | |
<key>ZScript[hard,discovery,fan]</key> | |
<delay>7200</delay> | |
<status>0</status> | |
<allowed_hosts/> | |
<snmpv3_contextname/> | |
<snmpv3_securityname/> | |
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |
<snmpv3_authpassphrase/> | |
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |
<snmpv3_privpassphrase/> | |
<delay_flex/> | |
<params/> | |
<ipmi_sensor/> | |
<authtype>0</authtype> | |
<username/> | |
<password/> | |
<publickey/> | |
<privatekey/> | |
<port/> | |
<filter> | |
<evaltype>0</evaltype> | |
<formula/> | |
<conditions/> | |
</filter> | |
<lifetime>3</lifetime> | |
<description/> | |
<item_prototypes> | |
<item_prototype> | |
<name> {#NAME}</name> | |
<type>0</type> | |
<snmp_community/> | |
<multiplier>0</multiplier> | |
<snmp_oid/> | |
<key>ZScript[hard,{#ID},fan]</key> | |
<delay>300</delay> | |
<history>90</history> | |
<trends>365</trends> | |
<status>0</status> | |
<value_type>3</value_type> | |
<allowed_hosts/> | |
<units/> | |
<delta>0</delta> | |
<snmpv3_contextname/> | |
<snmpv3_securityname/> | |
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |
<snmpv3_authpassphrase/> | |
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |
<snmpv3_privpassphrase/> | |
<formula>1</formula> | |
<delay_flex/> | |
<params/> | |
<ipmi_sensor/> | |
<data_type>0</data_type> | |
<authtype>0</authtype> | |
<username/> | |
<password/> | |
<publickey/> | |
<privatekey/> | |
<port/> | |
<description/> | |
<inventory_link>0</inventory_link> | |
<applications> | |
<application> | |
<name></name> | |
</application> | |
</applications> | |
<valuemap/> | |
<logtimefmt/> | |
<application_prototypes/> | |
</item_prototype> | |
</item_prototypes> | |
<trigger_prototypes> | |
<trigger_prototype> | |
<expression>{Hardware - Windows:ZScript[hard,{#ID},fan].avg(#3)}<150</expression> | |
<recovery_mode>0</recovery_mode> | |
<recovery_expression/> | |
<name> {#NAME} {HOST.NAME}</name> | |
<correlation_mode>0</correlation_mode> | |
<correlation_tag/> | |
<url/> | |
<status>0</status> | |
<priority>3</priority> | |
<description/> | |
<type>0</type> | |
<manual_close>0</manual_close> | |
<dependencies/> | |
<tags/> | |
</trigger_prototype> | |
</trigger_prototypes> | |
<graph_prototypes/> | |
<host_prototypes/> | |
</discovery_rule> | |
<discovery_rule> | |
<name> </name> | |
<type>0</type> | |
<snmp_community/> | |
<snmp_oid/> | |
<key>ZScript[hard,discovery,temperature]</key> | |
<delay>7200</delay> | |
<status>0</status> | |
<allowed_hosts/> | |
<snmpv3_contextname/> | |
<snmpv3_securityname/> | |
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |
<snmpv3_authpassphrase/> | |
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |
<snmpv3_privpassphrase/> | |
<delay_flex/> | |
<params/> | |
<ipmi_sensor/> | |
<authtype>0</authtype> | |
<username/> | |
<password/> | |
<publickey/> | |
<privatekey/> | |
<port/> | |
<filter> | |
<evaltype>0</evaltype> | |
<formula/> | |
<conditions/> | |
</filter> | |
<lifetime>3</lifetime> | |
<description/> | |
<item_prototypes> | |
<item_prototype> | |
<name> {#NAME}</name> | |
<type>0</type> | |
<snmp_community/> | |
<multiplier>0</multiplier> | |
<snmp_oid/> | |
<key>ZScript[hard,{#ID},temperature]</key> | |
<delay>120</delay> | |
<history>90</history> | |
<trends>365</trends> | |
<status>0</status> | |
<value_type>3</value_type> | |
<allowed_hosts/> | |
<units>°C</units> | |
<delta>0</delta> | |
<snmpv3_contextname/> | |
<snmpv3_securityname/> | |
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |
<snmpv3_authpassphrase/> | |
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |
<snmpv3_privpassphrase/> | |
<formula>1</formula> | |
<delay_flex/> | |
<params/> | |
<ipmi_sensor/> | |
<data_type>0</data_type> | |
<authtype>0</authtype> | |
<username/> | |
<password/> | |
<publickey/> | |
<privatekey/> | |
<port/> | |
<description/> | |
<inventory_link>0</inventory_link> | |
<applications> | |
<application> | |
<name></name> | |
</application> | |
</applications> | |
<valuemap/> | |
<logtimefmt/> | |
<application_prototypes/> | |
</item_prototype> | |
</item_prototypes> | |
<trigger_prototypes> | |
<trigger_prototype> | |
<expression>{Hardware - Windows:ZScript[hard,{#ID},temperature].last(#3)}>60</expression> | |
<recovery_mode>0</recovery_mode> | |
<recovery_expression/> | |
<name> {#NAME} {HOST.NAME}!</name> | |
<correlation_mode>0</correlation_mode> | |
<correlation_tag/> | |
<url/> | |
<status>0</status> | |
<priority>4</priority> | |
<description/> | |
<type>0</type> | |
<manual_close>0</manual_close> | |
<dependencies/> | |
<tags/> | |
</trigger_prototype> | |
<trigger_prototype> | |
<expression>{Hardware - Windows:ZScript[hard,{#ID},temperature].last(#3)}>70</expression> | |
<recovery_mode>0</recovery_mode> | |
<recovery_expression/> | |
<name> {#NAME} {HOST.NAME}!</name> | |
<correlation_mode>0</correlation_mode> | |
<correlation_tag/> | |
<url/> | |
<status>0</status> | |
<priority>5</priority> | |
<description/> | |
<type>0</type> | |
<manual_close>0</manual_close> | |
<dependencies/> | |
<tags/> | |
</trigger_prototype> | |
</trigger_prototypes> | |
<graph_prototypes/> | |
<host_prototypes/> | |
</discovery_rule> | |
<discovery_rule> | |
<name> </name> | |
<type>0</type> | |
<snmp_community/> | |
<snmp_oid/> | |
<key>ZScript[hard,discovery,voltage]</key> | |
<delay>7200</delay> | |
<status>0</status> | |
<allowed_hosts/> | |
<snmpv3_contextname/> | |
<snmpv3_securityname/> | |
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |
<snmpv3_authpassphrase/> | |
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |
<snmpv3_privpassphrase/> | |
<delay_flex/> | |
<params/> | |
<ipmi_sensor/> | |
<authtype>0</authtype> | |
<username/> | |
<password/> | |
<publickey/> | |
<privatekey/> | |
<port/> | |
<filter> | |
<evaltype>0</evaltype> | |
<formula/> | |
<conditions/> | |
</filter> | |
<lifetime>3</lifetime> | |
<description/> | |
<item_prototypes> | |
<item_prototype> | |
<name> {#NAME}</name> | |
<type>0</type> | |
<snmp_community/> | |
<multiplier>0</multiplier> | |
<snmp_oid/> | |
<key>ZScript[hard,{#ID},voltage]</key> | |
<delay>300</delay> | |
<history>90</history> | |
<trends>365</trends> | |
<status>0</status> | |
<value_type>0</value_type> | |
<allowed_hosts/> | |
<units>V</units> | |
<delta>0</delta> | |
<snmpv3_contextname/> | |
<snmpv3_securityname/> | |
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |
<snmpv3_authpassphrase/> | |
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |
<snmpv3_privpassphrase/> | |
<formula>1</formula> | |
<delay_flex/> | |
<params/> | |
<ipmi_sensor/> | |
<data_type>0</data_type> | |
<authtype>0</authtype> | |
<username/> | |
<password/> | |
<publickey/> | |
<privatekey/> | |
<port/> | |
<description/> | |
<inventory_link>0</inventory_link> | |
<applications> | |
<application> | |
<name></name> | |
</application> | |
</applications> | |
<valuemap/> | |
<logtimefmt/> | |
<application_prototypes/> | |
</item_prototype> | |
</item_prototypes> | |
<trigger_prototypes/> | |
<graph_prototypes/> | |
<host_prototypes/> | |
</discovery_rule> | |
<discovery_rule> | |
<name> </name> | |
<type>0</type> | |
<snmp_community/> | |
<snmp_oid/> | |
<key>ZScript[hdd,discovery]</key> | |
<delay>7200</delay> | |
<status>0</status> | |
<allowed_hosts/> | |
<snmpv3_contextname/> | |
<snmpv3_securityname/> | |
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |
<snmpv3_authpassphrase/> | |
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |
<snmpv3_privpassphrase/> | |
<delay_flex/> | |
<params/> | |
<ipmi_sensor/> | |
<authtype>0</authtype> | |
<username/> | |
<password/> | |
<publickey/> | |
<privatekey/> | |
<port/> | |
<filter> | |
<evaltype>0</evaltype> | |
<formula/> | |
<conditions/> | |
</filter> | |
<lifetime>3</lifetime> | |
<description/> | |
<item_prototypes> | |
<item_prototype> | |
<name> {#DISKID} - SMART - Spin-Up Time [3]</name> | |
<type>0</type> | |
<snmp_community/> | |
<multiplier>0</multiplier> | |
<snmp_oid/> | |
<key>ZScript[hdd,{#DISKID},3]</key> | |
<delay>3600</delay> | |
<history>90</history> | |
<trends>365</trends> | |
<status>0</status> | |
<value_type>3</value_type> | |
<allowed_hosts/> | |
<units/> | |
<delta>0</delta> | |
<snmpv3_contextname/> | |
<snmpv3_securityname/> | |
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |
<snmpv3_authpassphrase/> | |
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |
<snmpv3_privpassphrase/> | |
<formula>1</formula> | |
<delay_flex/> | |
<params/> | |
<ipmi_sensor/> | |
<data_type>0</data_type> | |
<authtype>0</authtype> | |
<username/> | |
<password/> | |
<publickey/> | |
<privatekey/> | |
<port/> | |
<description/> | |
<inventory_link>0</inventory_link> | |
<applications> | |
<application> | |
<name> </name> | |
</application> | |
</applications> | |
<valuemap/> | |
<logtimefmt/> | |
<application_prototypes/> | |
</item_prototype> | |
<item_prototype> | |
<name> {#DISKID} - SMART - Reallocated Sectors Count [5]</name> | |
<type>0</type> | |
<snmp_community/> | |
<multiplier>0</multiplier> | |
<snmp_oid/> | |
<key>ZScript[hdd,{#DISKID},5]</key> | |
<delay>3600</delay> | |
<history>90</history> | |
<trends>365</trends> | |
<status>0</status> | |
<value_type>3</value_type> | |
<allowed_hosts/> | |
<units/> | |
<delta>0</delta> | |
<snmpv3_contextname/> | |
<snmpv3_securityname/> | |
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |
<snmpv3_authpassphrase/> | |
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |
<snmpv3_privpassphrase/> | |
<formula>1</formula> | |
<delay_flex/> | |
<params/> | |
<ipmi_sensor/> | |
<data_type>0</data_type> | |
<authtype>0</authtype> | |
<username/> | |
<password/> | |
<publickey/> | |
<privatekey/> | |
<port/> | |
<description/> | |
<inventory_link>0</inventory_link> | |
<applications> | |
<application> | |
<name> </name> | |
</application> | |
</applications> | |
<valuemap/> | |
<logtimefmt/> | |
<application_prototypes/> | |
</item_prototype> | |
<item_prototype> | |
<name> {#DISKID} - SMART - Seek Error Rate [7]</name> | |
<type>0</type> | |
<snmp_community/> | |
<multiplier>0</multiplier> | |
<snmp_oid/> | |
<key>ZScript[hdd,{#DISKID},7]</key> | |
<delay>3600</delay> | |
<history>90</history> | |
<trends>365</trends> | |
<status>0</status> | |
<value_type>3</value_type> | |
<allowed_hosts/> | |
<units/> | |
<delta>0</delta> | |
<snmpv3_contextname/> | |
<snmpv3_securityname/> | |
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |
<snmpv3_authpassphrase/> | |
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |
<snmpv3_privpassphrase/> | |
<formula>1</formula> | |
<delay_flex/> | |
<params/> | |
<ipmi_sensor/> | |
<data_type>0</data_type> | |
<authtype>0</authtype> | |
<username/> | |
<password/> | |
<publickey/> | |
<privatekey/> | |
<port/> | |
<description/> | |
<inventory_link>0</inventory_link> | |
<applications> | |
<application> | |
<name> </name> | |
</application> | |
</applications> | |
<valuemap/> | |
<logtimefmt/> | |
<application_prototypes/> | |
</item_prototype> | |
<item_prototype> | |
<name> {#DISKID} - SMART - Power-on Time Count [9] ()</name> | |
<type>0</type> | |
<snmp_community/> | |
<multiplier>0</multiplier> | |
<snmp_oid/> | |
<key>ZScript[hdd,{#DISKID},9]</key> | |
<delay>3600</delay> | |
<history>90</history> | |
<trends>365</trends> | |
<status>0</status> | |
<value_type>3</value_type> | |
<allowed_hosts/> | |
<units/> | |
<delta>0</delta> | |
<snmpv3_contextname/> | |
<snmpv3_securityname/> | |
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |
<snmpv3_authpassphrase/> | |
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |
<snmpv3_privpassphrase/> | |
<formula>1</formula> | |
<delay_flex/> | |
<params/> | |
<ipmi_sensor/> | |
<data_type>0</data_type> | |
<authtype>0</authtype> | |
<username/> | |
<password/> | |
<publickey/> | |
<privatekey/> | |
<port/> | |
<description/> | |
<inventory_link>0</inventory_link> | |
<applications> | |
<application> | |
<name> </name> | |
</application> | |
</applications> | |
<valuemap/> | |
<logtimefmt/> | |
<application_prototypes/> | |
</item_prototype> | |
<item_prototype> | |
<name> {#DISKID} - SMART - Spin-Up Retry Count [10]</name> | |
<type>0</type> | |
<snmp_community/> | |
<multiplier>0</multiplier> | |
<snmp_oid/> | |
<key>ZScript[hdd,{#DISKID},10]</key> | |
<delay>3600</delay> | |
<history>90</history> | |
<trends>365</trends> | |
<status>0</status> | |
<value_type>3</value_type> | |
<allowed_hosts/> | |
<units/> | |
<delta>0</delta> | |
<snmpv3_contextname/> | |
<snmpv3_securityname/> | |
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |
<snmpv3_authpassphrase/> | |
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |
<snmpv3_privpassphrase/> | |
<formula>1</formula> | |
<delay_flex/> | |
<params/> | |
<ipmi_sensor/> | |
<data_type>0</data_type> | |
<authtype>0</authtype> | |
<username/> | |
<password/> | |
<publickey/> | |
<privatekey/> | |
<port/> | |
<description/> | |
<inventory_link>0</inventory_link> | |
<applications> | |
<application> | |
<name> </name> | |
</application> | |
</applications> | |
<valuemap/> | |
<logtimefmt/> | |
<application_prototypes/> | |
</item_prototype> | |
<item_prototype> | |
<name> {#DISKID} - SMART - G-sense error rate [191]</name> | |
<type>0</type> | |
<snmp_community/> | |
<multiplier>0</multiplier> | |
<snmp_oid/> | |
<key>ZScript[hdd,{#DISKID},191]</key> | |
<delay>3600</delay> | |
<history>90</history> | |
<trends>365</trends> | |
<status>0</status> | |
<value_type>3</value_type> | |
<allowed_hosts/> | |
<units/> | |
<delta>0</delta> | |
<snmpv3_contextname/> | |
<snmpv3_securityname/> | |
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |
<snmpv3_authpassphrase/> | |
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |
<snmpv3_privpassphrase/> | |
<formula>1</formula> | |
<delay_flex/> | |
<params/> | |
<ipmi_sensor/> | |
<data_type>0</data_type> | |
<authtype>0</authtype> | |
<username/> | |
<password/> | |
<publickey/> | |
<privatekey/> | |
<port/> | |
<description/> | |
<inventory_link>0</inventory_link> | |
<applications> | |
<application> | |
<name> </name> | |
</application> | |
</applications> | |
<valuemap/> | |
<logtimefmt/> | |
<application_prototypes/> | |
</item_prototype> | |
<item_prototype> | |
<name> {#DISKID} - SMART - [194]</name> | |
<type>0</type> | |
<snmp_community/> | |
<multiplier>0</multiplier> | |
<snmp_oid/> | |
<key>ZScript[hdd,{#DISKID},194]</key> | |
<delay>300</delay> | |
<history>90</history> | |
<trends>365</trends> | |
<status>0</status> | |
<value_type>3</value_type> | |
<allowed_hosts/> | |
<units>°C</units> | |
<delta>0</delta> | |
<snmpv3_contextname/> | |
<snmpv3_securityname/> | |
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |
<snmpv3_authpassphrase/> | |
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |
<snmpv3_privpassphrase/> | |
<formula>1</formula> | |
<delay_flex/> | |
<params/> | |
<ipmi_sensor/> | |
<data_type>0</data_type> | |
<authtype>0</authtype> | |
<username/> | |
<password/> | |
<publickey/> | |
<privatekey/> | |
<port/> | |
<description/> | |
<inventory_link>0</inventory_link> | |
<applications> | |
<application> | |
<name> </name> | |
</application> | |
</applications> | |
<valuemap/> | |
<logtimefmt/> | |
<application_prototypes/> | |
</item_prototype> | |
<item_prototype> | |
<name> {#DISKID} - SMART - Reallocation Event Count [196]</name> | |
<type>0</type> | |
<snmp_community/> | |
<multiplier>0</multiplier> | |
<snmp_oid/> | |
<key>ZScript[hdd,{#DISKID},196]</key> | |
<delay>3600</delay> | |
<history>90</history> | |
<trends>365</trends> | |
<status>0</status> | |
<value_type>3</value_type> | |
<allowed_hosts/> | |
<units/> | |
<delta>0</delta> | |
<snmpv3_contextname/> | |
<snmpv3_securityname/> | |
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |
<snmpv3_authpassphrase/> | |
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |
<snmpv3_privpassphrase/> | |
<formula>1</formula> | |
<delay_flex/> | |
<params/> | |
<ipmi_sensor/> | |
<data_type>0</data_type> | |
<authtype>0</authtype> | |
<username/> | |
<password/> | |
<publickey/> | |
<privatekey/> | |
<port/> | |
<description/> | |
<inventory_link>0</inventory_link> | |
<applications> | |
<application> | |
<name> </name> | |
</application> | |
</applications> | |
<valuemap/> | |
<logtimefmt/> | |
<application_prototypes/> | |
</item_prototype> | |
<item_prototype> | |
<name> {#DISKID} - SMART - Current Pending Sector Count [197]</name> | |
<type>0</type> | |
<snmp_community/> | |
<multiplier>0</multiplier> | |
<snmp_oid/> | |
<key>ZScript[hdd,{#DISKID},197]</key> | |
<delay>3600</delay> | |
<history>90</history> | |
<trends>365</trends> | |
<status>0</status> | |
<value_type>3</value_type> | |
<allowed_hosts/> | |
<units/> | |
<delta>0</delta> | |
<snmpv3_contextname/> | |
<snmpv3_securityname/> | |
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |
<snmpv3_authpassphrase/> | |
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |
<snmpv3_privpassphrase/> | |
<formula>1</formula> | |
<delay_flex/> | |
<params/> | |
<ipmi_sensor/> | |
<data_type>0</data_type> | |
<authtype>0</authtype> | |
<username/> | |
<password/> | |
<publickey/> | |
<privatekey/> | |
<port/> | |
<description/> | |
<inventory_link>0</inventory_link> | |
<applications> | |
<application> | |
<name> </name> | |
</application> | |
</applications> | |
<valuemap/> | |
<logtimefmt/> | |
<application_prototypes/> | |
</item_prototype> | |
<item_prototype> | |
<name> {#DISKID} - SMART - Uncorrectable Sector Count [198]</name> | |
<type>0</type> | |
<snmp_community/> | |
<multiplier>0</multiplier> | |
<snmp_oid/> | |
<key>ZScript[hdd,{#DISKID},198]</key> | |
<delay>3600</delay> | |
<history>90</history> | |
<trends>365</trends> | |
<status>0</status> | |
<value_type>3</value_type> | |
<allowed_hosts/> | |
<units/> | |
<delta>0</delta> | |
<snmpv3_contextname/> | |
<snmpv3_securityname/> | |
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |
<snmpv3_authpassphrase/> | |
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |
<snmpv3_privpassphrase/> | |
<formula>1</formula> | |
<delay_flex/> | |
<params/> | |
<ipmi_sensor/> | |
<data_type>0</data_type> | |
<authtype>0</authtype> | |
<username/> | |
<password/> | |
<publickey/> | |
<privatekey/> | |
<port/> | |
<description/> | |
<inventory_link>0</inventory_link> | |
<applications> | |
<application> | |
<name> </name> | |
</application> | |
</applications> | |
<valuemap/> | |
<logtimefmt/> | |
<application_prototypes/> | |
</item_prototype> | |
<item_prototype> | |
<name> {#DISKID} - SMART - UltraDMA CRC Error Count [199]</name> | |
<type>0</type> | |
<snmp_community/> | |
<multiplier>0</multiplier> | |
<snmp_oid/> | |
<key>ZScript[hdd,{#DISKID},199]</key> | |
<delay>3600</delay> | |
<history>90</history> | |
<trends>365</trends> | |
<status>0</status> | |
<value_type>3</value_type> | |
<allowed_hosts/> | |
<units/> | |
<delta>0</delta> | |
<snmpv3_contextname/> | |
<snmpv3_securityname/> | |
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |
<snmpv3_authpassphrase/> | |
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |
<snmpv3_privpassphrase/> | |
<formula>1</formula> | |
<delay_flex/> | |
<params/> | |
<ipmi_sensor/> | |
<data_type>0</data_type> | |
<authtype>0</authtype> | |
<username/> | |
<password/> | |
<publickey/> | |
<privatekey/> | |
<port/> | |
<description/> | |
<inventory_link>0</inventory_link> | |
<applications> | |
<application> | |
<name> </name> | |
</application> | |
</applications> | |
<valuemap/> | |
<logtimefmt/> | |
<application_prototypes/> | |
</item_prototype> | |
<item_prototype> | |
<name> {#DISKID} - </name> | |
<type>0</type> | |
<snmp_community/> | |
<multiplier>0</multiplier> | |
<snmp_oid/> | |
<key>ZScript[hdd,{#DISKID},capacity]</key> | |
<delay>3600</delay> | |
<history>7</history> | |
<trends>0</trends> | |
<status>0</status> | |
<value_type>1</value_type> | |
<allowed_hosts/> | |
<units/> | |
<delta>0</delta> | |
<snmpv3_contextname/> | |
<snmpv3_securityname/> | |
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |
<snmpv3_authpassphrase/> | |
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |
<snmpv3_privpassphrase/> | |
<formula>1</formula> | |
<delay_flex/> | |
<params/> | |
<ipmi_sensor/> | |
<data_type>0</data_type> | |
<authtype>0</authtype> | |
<username/> | |
<password/> | |
<publickey/> | |
<privatekey/> | |
<port/> | |
<description/> | |
<inventory_link>0</inventory_link> | |
<applications> | |
<application> | |
<name> </name> | |
</application> | |
</applications> | |
<valuemap/> | |
<logtimefmt/> | |
<application_prototypes/> | |
</item_prototype> | |
<item_prototype> | |
<name> {#DISKID} - </name> | |
<type>0</type> | |
<snmp_community/> | |
<multiplier>0</multiplier> | |
<snmp_oid/> | |
<key>ZScript[hdd,{#DISKID},family]</key> | |
<delay>3600</delay> | |
<history>7</history> | |
<trends>0</trends> | |
<status>0</status> | |
<value_type>1</value_type> | |
<allowed_hosts/> | |
<units/> | |
<delta>0</delta> | |
<snmpv3_contextname/> | |
<snmpv3_securityname/> | |
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |
<snmpv3_authpassphrase/> | |
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |
<snmpv3_privpassphrase/> | |
<formula>1</formula> | |
<delay_flex/> | |
<params/> | |
<ipmi_sensor/> | |
<data_type>0</data_type> | |
<authtype>0</authtype> | |
<username/> | |
<password/> | |
<publickey/> | |
<privatekey/> | |
<port/> | |
<description/> | |
<inventory_link>0</inventory_link> | |
<applications> | |
<application> | |
<name> </name> | |
</application> | |
</applications> | |
<valuemap/> | |
<logtimefmt/> | |
<application_prototypes/> | |
</item_prototype> | |
<item_prototype> | |
<name> {#DISKID} - FW</name> | |
<type>0</type> | |
<snmp_community/> | |
<multiplier>0</multiplier> | |
<snmp_oid/> | |
<key>ZScript[hdd,{#DISKID},fw]</key> | |
<delay>3600</delay> | |
<history>7</history> | |
<trends>0</trends> | |
<status>0</status> | |
<value_type>1</value_type> | |
<allowed_hosts/> | |
<units/> | |
<delta>0</delta> | |
<snmpv3_contextname/> | |
<snmpv3_securityname/> | |
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |
<snmpv3_authpassphrase/> | |
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |
<snmpv3_privpassphrase/> | |
<formula>1</formula> | |
<delay_flex/> | |
<params/> | |
<ipmi_sensor/> | |
<data_type>0</data_type> | |
<authtype>0</authtype> | |
<username/> | |
<password/> | |
<publickey/> | |
<privatekey/> | |
<port/> | |
<description/> | |
<inventory_link>0</inventory_link> | |
<applications> | |
<application> | |
<name> </name> | |
</application> | |
</applications> | |
<valuemap/> | |
<logtimefmt/> | |
<application_prototypes/> | |
</item_prototype> | |
<item_prototype> | |
<name> {#DISKID} - </name> | |
<type>0</type> | |
<snmp_community/> | |
<multiplier>0</multiplier> | |
<snmp_oid/> | |
<key>ZScript[hdd,{#DISKID},model]</key> | |
<delay>3600</delay> | |
<history>7</history> | |
<trends>0</trends> | |
<status>0</status> | |
<value_type>1</value_type> | |
<allowed_hosts/> | |
<units/> | |
<delta>0</delta> | |
<snmpv3_contextname/> | |
<snmpv3_securityname/> | |
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |
<snmpv3_authpassphrase/> | |
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |
<snmpv3_privpassphrase/> | |
<formula>1</formula> | |
<delay_flex/> | |
<params/> | |
<ipmi_sensor/> | |
<data_type>0</data_type> | |
<authtype>0</authtype> | |
<username/> | |
<password/> | |
<publickey/> | |
<privatekey/> | |
<port/> | |
<description/> | |
<inventory_link>0</inventory_link> | |
<applications> | |
<application> | |
<name> </name> | |
</application> | |
</applications> | |
<valuemap/> | |
<logtimefmt/> | |
<application_prototypes/> | |
</item_prototype> | |
<item_prototype> | |
<name> {#DISKID} - </name> | |
<type>0</type> | |
<snmp_community/> | |
<multiplier>0</multiplier> | |
<snmp_oid/> | |
<key>ZScript[hdd,{#DISKID},serial]</key> | |
<delay>3600</delay> | |
<history>7</history> | |
<trends>0</trends> | |
<status>0</status> | |
<value_type>1</value_type> | |
<allowed_hosts/> | |
<units/> | |
<delta>0</delta> | |
<snmpv3_contextname/> | |
<snmpv3_securityname/> | |
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |
<snmpv3_authpassphrase/> | |
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |
<snmpv3_privpassphrase/> | |
<formula>1</formula> | |
<delay_flex/> | |
<params/> | |
<ipmi_sensor/> | |
<data_type>0</data_type> | |
<authtype>0</authtype> | |
<username/> | |
<password/> | |
<publickey/> | |
<privatekey/> | |
<port/> | |
<description/> | |
<inventory_link>0</inventory_link> | |
<applications> | |
<application> | |
<name> </name> | |
</application> | |
</applications> | |
<valuemap/> | |
<logtimefmt/> | |
<application_prototypes/> | |
</item_prototype> | |
<item_prototype> | |
<name> {#DISKID} - SMART</name> | |
<type>0</type> | |
<snmp_community/> | |
<multiplier>0</multiplier> | |
<snmp_oid/> | |
<key>ZScript[hdd,{#DISKID},status]</key> | |
<delay>300</delay> | |
<history>7</history> | |
<trends>0</trends> | |
<status>0</status> | |
<value_type>1</value_type> | |
<allowed_hosts/> | |
<units/> | |
<delta>0</delta> | |
<snmpv3_contextname/> | |
<snmpv3_securityname/> | |
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |
<snmpv3_authpassphrase/> | |
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |
<snmpv3_privpassphrase/> | |
<formula>1</formula> | |
<delay_flex/> | |
<params/> | |
<ipmi_sensor/> | |
<data_type>0</data_type> | |
<authtype>0</authtype> | |
<username/> | |
<password/> | |
<publickey/> | |
<privatekey/> | |
<port/> | |
<description/> | |
<inventory_link>0</inventory_link> | |
<applications> | |
<application> | |
<name> </name> | |
</application> | |
</applications> | |
<valuemap/> | |
<logtimefmt/> | |
<application_prototypes/> | |
</item_prototype> | |
</item_prototypes> | |
<trigger_prototypes> | |
<trigger_prototype> | |
<expression>{Hardware - Windows:ZScript[hdd,{#DISKID},status].regexp(^PASSED$)}=1</expression> | |
<recovery_mode>0</recovery_mode> | |
<recovery_expression/> | |
<name>SMART {HOST.NAME}</name> | |
<correlation_mode>0</correlation_mode> | |
<correlation_tag/> | |
<url/> | |
<status>0</status> | |
<priority>4</priority> | |
<description/> | |
<type>0</type> | |
<manual_close>0</manual_close> | |
<dependencies/> | |
<tags/> | |
</trigger_prototype> | |
<trigger_prototype> | |
<expression>{Hardware - Windows:ZScript[hdd,{#DISKID},194].last()}>55</expression> | |
<recovery_mode>0</recovery_mode> | |
<recovery_expression/> | |
<name> {HOST.NAME}</name> | |
<correlation_mode>0</correlation_mode> | |
<correlation_tag/> | |
<url/> | |
<status>0</status> | |
<priority>3</priority> | |
<description/> | |
<type>0</type> | |
<manual_close>0</manual_close> | |
<dependencies/> | |
<tags/> | |
</trigger_prototype> | |
<trigger_prototype> | |
<expression>{Hardware - Windows:ZScript[hdd,{#DISKID},194].last()}>60</expression> | |
<recovery_mode>0</recovery_mode> | |
<recovery_expression/> | |
<name> {HOST.NAME}</name> | |
<correlation_mode>0</correlation_mode> | |
<correlation_tag/> | |
<url/> | |
<status>0</status> | |
<priority>4</priority> | |
<description/> | |
<type>0</type> | |
<manual_close>0</manual_close> | |
<dependencies/> | |
<tags/> | |
</trigger_prototype> | |
</trigger_prototypes> | |
<graph_prototypes/> | |
<host_prototypes/> | |
</discovery_rule> | |
</discovery_rules> | |
<httptests/> | |
<macros/> | |
<templates/> | |
<screens/> | |
</template> | |
</templates> | |
<triggers> | |
<trigger> | |
<expression>{Hardware - Windows:ZScript[hard,VBAT].last(#3)}<2.9</expression> | |
<recovery_mode>0</recovery_mode> | |
<recovery_expression/> | |
<name> BIOS {HOST.NAME}</name> | |
<correlation_mode>0</correlation_mode> | |
<correlation_tag/> | |
<url/> | |
<status>0</status> | |
<priority>3</priority> | |
<description/> | |
<type>0</type> | |
<manual_close>0</manual_close> | |
<dependencies/> | |
<tags/> | |
</trigger> | |
</triggers> | |
</zabbix_export> |
このテンプレートはZabbixバージョン3.2で作成されたもので、以前のバージョンでも機能する場合があります。 キーは標準であり、 ZScript [script_name、parameter1、..、parameterN]という形式を持っています 。 パラメータは、スクリプト自体に直接渡されます。
テンプレートができる限りシンプルで簡単であることを願っています。
PSスクリプト
以下は必要なスクリプトです。 内部には、個々の要素の検出とクエリの両方がすでに配置されています。 XP SP3から2016までのWindowsで作業がテストされました。もちろん、 実行ポリシーに関する決定はあなた次第です。
windows.hdd.ps1-> smartmontoolsの場合
# 2017/04/12 AcidVenom v3 | |
# Zabbix | |
param($1,$2) | |
# | |
# : discovery | |
if ($1 -eq "discovery") { | |
try { | |
$items = smartctl-nc --scan-open | where {$_ -match "/dev/sd"} | |
write-host -NoNewline "{" | |
write-host -NoNewline "`"data`":[" | |
$n = 0 | |
foreach ($obj in $items) { | |
if ((smartctl-nc -i $obj.substring(0,8) | where {$_ -match "SMART support is: Enabled"}) -ne $null) { | |
$n = $n + 1 | |
If ($n -gt 1) {write-host -NoNewline ","} | |
$line = "{`"{#DISKID}`":`"" + ($obj.substring(5,3)) + "`"}" | |
write-host -NoNewline $line | |
} | |
} | |
write-host -NoNewline "]" | |
write-host -NoNewline "}" | |
} | |
catch {exit} | |
} | |
# | |
# : | |
else { | |
try { | |
if ($2 -eq "status") { | |
$obj = smartctl-nc -H /dev/$1 | where {$_ -match "result:"} | |
$obj = $obj.substring(50) | |
} | |
elseif ($2 -eq "model") { | |
$obj = smartctl-nc -i /dev/$1 | where {$_ -match "Device Model:"} | |
$obj = $obj.substring(18) | |
} | |
elseif ($2 -eq "family") { | |
$obj = smartctl-nc -i /dev/$1 | where {$_ -match "Model Family:"} | |
$obj = $obj.substring(18) | |
} | |
elseif ($2 -eq "fw") { | |
$obj = smartctl-nc -i /dev/$1 | where {$_ -match "Firmware Version:"} | |
$obj = $obj.substring(18) | |
} | |
elseif ($2 -eq "serial") { | |
$obj = smartctl-nc -i /dev/$1 | where {$_ -match "Serial Number:"} | |
$obj = $obj.substring(18) | |
} | |
elseif ($2 -eq "capacity") { | |
$obj = smartctl-nc -i /dev/$1 | where {$_ -match "User Capacity:"} | |
if ($obj -match "User Capacity:") { | |
$obj = $obj.Substring($obj.IndexOf("[")+1,$obj.IndexOf("]")-$obj.IndexOf("[")-1) | |
} | |
else { | |
$obj = "N/A" | |
}} | |
# SMART | |
# | |
else { | |
$obj = smartctl-nc -A /dev/$1 | where {$_ -match "^ *$2"} | |
try {$obj = $obj.Substring(87,$obj.IndexOf("(")-87)} | |
catch {$obj = $obj.Substring(87)} | |
}} | |
catch {$obj = ""} | |
Write-Output $obj | |
} |
SMARTが有効になっているドライブのみが検出されます。 パラメーターは「RAW_VALUE」列から要求されます。 別のパラメーターをモニターしたいですか? その番号を入力するだけです。 デフォルトでは、括弧とその内容は破棄されます。 必要なディスクがパラメーターを返さない場合、空のフィールドが返されます。
windows.hard.ps1-> OHMの場合
# 2017/02/13 AcidVenom v2 | |
# Zabbix | |
param($1,$2) | |
# , , | |
# : discovery temperature/voltage/fan | |
if ($1 -eq "discovery") { | |
$items = Get-WmiObject -Namespace Root\OpenHardwareMonitor -Class sensor | Where-Object {$_.SensorType -eq "$2" -and $_.Name -notmatch "#|VBAT" -and $_.Parent -notmatch "hdd"} | |
write-host -NoNewline "{" | |
write-host -NoNewline "`"data`":[" | |
$n = 0 | |
foreach ($obj in $items) { | |
$n = $n + 1 | |
$line = "{`"{#ID}`":`"" + $obj.InstanceId + "`", `"{#NAME}`":`"" + $obj.Name + "`"}" | |
If ($n -lt $items.Count) { $line = "$line,"} | |
write-host -NoNewline $line | |
} | |
write-host -NoNewline "]" | |
write-host -NoNewline "}" | |
} | |
# | |
# : VBAT | |
elseif ($1 -eq "VBAT") { | |
$obj = (Get-WmiObject -Namespace Root\OpenHardwareMonitor -Class sensor | Where-Object {$_.Name -eq "$1"}).Value -replace(",",".") | |
Write-Host -NoNewline $obj | |
} | |
# InstaceId discovery | |
# | |
else { | |
if ((Get-WmiObject -Namespace Root\OpenHardwareMonitor -Class sensor | Where-Object {$_.InstanceId -eq "$1"}).SensorType -eq "Voltage") { | |
$obj = (Get-WmiObject -Namespace Root\OpenHardwareMonitor -Class sensor | Where-Object {$_.InstanceId -eq "$1"}).Value -replace(",",".")} | |
else {$obj = (Get-WmiObject -Namespace Root\OpenHardwareMonitor -Class sensor | Where-Object {$_.InstanceId -eq "$1"}).Value -replace(",.*","")} | |
Write-Host -NoNewline $obj | |
} |
デフォルトでは、スクリプトは#を持つセンサーの名前を検出しません。 必要なものについては、以下を参照してください。
1つのセンサー名も予約されています-Vbat。 これはBIOSバッテリーの電圧です。 その値は、トリガーの個別の要素に取り出されます(2.9V未満の場合に機能します)。
出力でのクーラーの温度と回転の値は整数であり、電圧値はそのまま送信されます。
理論的には、他のインジケータ(負荷、周波数など)を検出できます。 これには、キーの対応する2番目のパラメーターを使用します。 たとえば、 ZScript [hard、discovery、load]です。
Zabbixエージェントの準備
最大限の統合のために、スクリプトには次の唯一のパラメーターを使用します。
UserParameter=ZScript[*],powershell C:\System\Zabbix\Scripts\windows.$1.ps1 "$2" "$3"
これにより、最大限の柔軟性と均一性が得られます。 スクリプトにさらにパラメーターを追加する必要がある場合は、引用符で変数を追加するだけです。 現在実行中のスクリプトには影響しません。 念のために、 Windowsプレフィックスを使用しています 。識別を保証するためにテンプレートを保存するのは非常に便利です。
smartmontools
Smartmontools(執筆時のバージョン6.5)は、ディスクの状態を監視するために使用されます。 ソフトウェアをインストールすると、デフォルトでsmartctl-ncがインストールされます。これは、サーバーの寿命を延ばすためにスクリプトで使用されます。 また、可変環境のbinフォルダーに書き込む必要があります。
セミコロンを介してPath変数の最後にパスを追加するだけです。 デフォルトはC:\ Program Files \ smartmontools \ bin
Openhardwaremonitor
センサーには、OHMが使用されます。 ソフトウェアは無料のオープンソースです。 インストールは簡単ですが、すべての作業を行うには、プログラムをサービスとして実行する必要があります。 そのようなことにはNSSMがありますが、 最新のビルドをダウンロードすることをお勧めします。 そして、 ここで構文を見ることができます。
センサーの約束された選択は、センサーの名前を変更できるという事実によって保証されます! 名前を読みやすい名前に変更し(要素名で使用されます)、不要なセンサー#についてコメントします。
プログラム/サービスを再起動して、名前の変更を適用してください。
合計
結果は、優れた監視ツールです。 希望する人は、必要な要素のプロトタイプにトリガーをかけることができます。 または、テンプレートを完全に作り直します。
2017/07/05更新 :windows.hdd.ps1のバグが修正されました-JSONの最初にカンマが表示されなくなりました。