Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
nikimaxim authored Mar 13, 2020
1 parent 8fba840 commit 2d51257
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
27 changes: 24 additions & 3 deletions Template smartmonitor.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>4.4</version>
<date>2020-03-02T12:56:26Z</date>
<date>2020-03-13T05:49:23Z</date>
<groups>
<group>
<name>Templates Users</name>
Expand All @@ -21,9 +21,30 @@
<name>SMART monitoring (smartctl)</name>
</application>
</applications>
<items>
<item>
<name>Smartctl version</name>
<key>smartctl.version</key>
<delay>1h</delay>
<trends>0</trends>
<value_type>CHAR</value_type>
<applications>
<application>
<name>SMART monitoring (smartctl)</name>
</application>
</applications>
<triggers>
<trigger>
<expression>{change()}=1</expression>
<name>Version of smartctl was changed on {HOST.NAME}</name>
<priority>INFO</priority>
</trigger>
</triggers>
</item>
</items>
<discovery_rules>
<discovery_rule>
<name>smartctl-storage-discovery</name>
<name>Smartctl storage discovery</name>
<key>storage.discovery</key>
<delay>1d;1h/1-7,08:00-21:00</delay>
<filter>
Expand All @@ -37,7 +58,7 @@
</filter>
<item_prototypes>
<item_prototype>
<name>{#STORAGE.NAME}: smartctl</name>
<name>{#STORAGE.NAME}: Smartctl</name>
<key>storage.get[&quot;{#STORAGE.CMD}&quot;]</key>
<delay>1h;10m/1-7,08:00-21:00</delay>
<history>30d</history>
Expand Down
4 changes: 3 additions & 1 deletion zabbix_agentd.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Windows smartctl monitor
UserParameter=storage.get[*],for /F "tokens=* usebackq" %a in (`""C:\Program Files\smartmontools\bin\smartctl.exe" -i -H -A -l error -l background $1"`) do @echo %a
UserParameter=storage.discovery[*],powershell -NoProfile -ExecutionPolicy Bypass -File "C:\service\zabbix_agent\smartctl-storage-discovery.ps1"
UserParameter=storage.discovery[*],powershell -NoProfile -ExecutionPolicy Bypass -File "C:\service\smartctl-storage-discovery.ps1"
UserParameter=smartctl.version,powershell -NoProfile -ExecutionPolicy Bypass -Command "(((& 'C:\Program Files\smartmontools\bin\smartctl.exe' --version | Where-Object {$_ -match '^smartctl\s\d'}) -ireplace 'smartctl\s') -ireplace '\s\[.+$').Trim()"

# Linux smartctl monitor
UserParameter=storage.get[*],sudo smartctl -i -H -A -l error -l background $1
UserParameter=storage.discovery[*],sudo /opt/zabbix_s/smartctl-storage-discovery.sh
UserParameter=smartctl.version,smartctl --version | grep -Eo "^smartctl\s[0-9\.[:space:]\r-]+" | sed -e 's/^smartctl\s//'

0 comments on commit 2d51257

Please sign in to comment.