Skip to content

Commit

Permalink
bump v1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
v-zhuravlev committed Apr 24, 2019
1 parent 855f5b0 commit a513bf7
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ Defaults!SMARTCTL !logfile, !syslog, !pam_session
Defaults!SMARTCTL_DISCOVERY !logfile, !syslog, !pam_session
```

Add the following lines in zabbix_agentd.conf file:
Copy zabbix_smartctl.conf to /etc/zabbix/zabbix_agentd.d/zabbix_smartctl.conf with the following contents:

```text
#############SMARTMONTOOLS
#############ZBX-SMARTCTL V1.4
### DEPRECATED. USE for 2.x-3.2 templates
UserParameter=uHDD[*],sudo smartctl -A $1 | awk '$$0 ~ /$2/ { print $$10 }'
UserParameter=uHDD.value[*],sudo smartctl -A $1 | awk '$$0 ~ /$2/ { print $$4 }'
Expand All @@ -82,11 +82,11 @@ UserParameter=uHDD.model.[*],sudo smartctl -i $1 | awk -F ': +' '$$0 ~ /Device M
UserParameter=uHDD.sn.[*],sudo smartctl -i $1 | awk -F ': +' '$$0 ~ /Serial Number/ { print $$2 }'
UserParameter=uHDD.health.[*],sudo smartctl -H $1 | awk -F ': +' '$$0 ~ /test/ { print $$2 }'
UserParameter=uHDD.errorlog.[*],sudo smartctl -l error $1 |grep -i "ATA Error Count"| cut -f2 -d: |tr -d " " || true
### DEPRECATED. The following were used in the first version of template for 3.4
### DEPRECATED. The following were used in the first version of the template for 3.4
UserParameter=uHDD.A[*],sudo smartctl -A $1
UserParameter=uHDD.i[*],sudo smartctl -i $1
UserParameter=uHDD.health[*],sudo smartctl -H $1 || true
### With the latest template you only need these:
### With the latest 3.4 template you only need these:
UserParameter=uHDD.get[*],sudo smartctl -i -H -A -l error -l background $1 || true
UserParameter=uSSD.get[*],sudo smartctl -i -H -A -l error -l background $1 || true
UserParameter=uHDD.discovery[*],sudo /etc/zabbix/scripts/smartctl-disks-discovery.pl $1
Expand Down Expand Up @@ -122,7 +122,7 @@ You should receive JSON object in the output.
- Add the following lines in zabbix_agentd.conf file (note the path to smartctl.exe):

```text
#############SMARTMON
#############ZBX-SMARTCTL V1.4
###DEPRECATED. USE for 2.x-3.2 templates
UserParameter=uHDD[*], for /F "tokens=10 usebackq" %a in (`""%ProgramFiles%\smartmontools\bin\smartctl.exe" -A $1 | find "$2""`) do @echo %a
UserParameter=uHDD.value[*], for /F "tokens=4 usebackq" %a in (`""%ProgramFiles%\smartmontools\bin\smartctl.exe" -A $1 | find "$2""`) do @echo %a
Expand All @@ -131,11 +131,11 @@ UserParameter=uHDD.health.[*], for /F "tokens=6 usebackq" %a in (`""%ProgramFile
UserParameter=uHDD.model.[*],for /F "tokens=3* usebackq" %a in (`""%ProgramFiles%\smartmontools\bin\smartctl.exe" -i $1 | find "Device Model""`) do @echo %a %b
UserParameter=uHDD.sn.[*],for /F "tokens=3 usebackq" %a in (`""%ProgramFiles%\smartmontools\bin\smartctl.exe" -i $1 | find "Serial Number""`) do @echo %a
UserParameter=uHDD.errorlog.[*], for /F "tokens=4 usebackq" %a in (`""%ProgramFiles%\smartmontools\bin\smartctl.exe" -l error $1 | find "ATA Error Count""`) do @echo %a
### DEPRECATED. The following were used in the first version of template for 3.4
### DEPRECATED. The following were used in the first version of the template for 3.4
UserParameter=uHDD.A[*], for /F "tokens=* usebackq" %a in (`""%ProgramFiles%\smartmontools\bin\smartctl.exe" -A $1"`) do @echo %a
UserParameter=uHDD.i[*], for /F "tokens=* usebackq" %a in (`""%ProgramFiles%\smartmontools\bin\smartctl.exe" -i $1"`) do @echo %a
UserParameter=uHDD.health[*], for /F "tokens=* usebackq" %a in (`""%ProgramFiles%\smartmontools\bin\smartctl.exe" -H $1"`) do @echo %a
### With the latest template you only need these:
### With the latest 3.4 template you only need these:
UserParameter=uHDD.get[*], for /F "tokens=* usebackq" %a in (`""%ProgramFiles%\smartmontools\bin\smartctl.exe" -i -H -A -l error -l background $1"`) do @echo %a
UserParameter=uHDD.discovery[*],powershell -NoProfile -ExecutionPolicy Bypass -File "C:\Program Files (x86)\Zabbix Agent\smartctl-disks-discovery.ps1"
UserParameter=uSSD.get[*], for /F "tokens=* usebackq" %a in (`""%ProgramFiles%\smartmontools\bin\smartctl.exe" -i -H -A -l error -l background $1"`) do @echo %a
Expand Down
3 changes: 2 additions & 1 deletion Template_3.4_HDD_SMARTMONTOOLS_2_WITH_LLD.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
<template>Template_HDD_SMARTMONTOOLS_2_WITH_LLD</template>
<name>Template_HDD_SMARTMONTOOLS_2_WITH_LLD</name>
<description>https://github.com/v-zhuravlev/zbx-smartctl&#13;
3.4 version with dependent items. Please check your UserParameters.</description>
3.4 version with dependent items. Please check your UserParameters.
Template version: v1.4</description>
<groups>
<group>
<name>Templates</name>
Expand Down
2 changes: 1 addition & 1 deletion discovery-scripts/nix/smartctl-disks-discovery.pl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use strict;

#must be run as root
my $VERSION = 1.0;
my $VERSION = 1.4;

#add path if needed into $smartctl_cmd
my $smartctl_cmd = "/usr/sbin/smartctl";
Expand Down
1 change: 1 addition & 0 deletions discovery-scripts/windows/smartctl-disks-discovery.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# VERSION = 1.4
$smartctl = "C:\Program Files\smartmontools\bin\smartctl.exe"

if ((Get-Command $smartctl -ErrorAction SilentlyContinue) -eq $null)
Expand Down
6 changes: 3 additions & 3 deletions zabbix_smartctl.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#############SMARTMONTOOLS
#############ZBX-SMARTCTL V1.4
### DEPRECATED. USE for 2.x-3.2 templates
UserParameter=uHDD[*],sudo smartctl -A $1 | awk '$$0 ~ /$2/ { print $$10 }'
UserParameter=uHDD.value[*],sudo smartctl -A $1 | awk '$$0 ~ /$2/ { print $$4 }'
Expand All @@ -7,11 +7,11 @@ UserParameter=uHDD.model.[*],sudo smartctl -i $1 | awk -F ': +' '$$0 ~ /Device M
UserParameter=uHDD.sn.[*],sudo smartctl -i $1 | awk -F ': +' '$$0 ~ /Serial Number/ { print $$2 }'
UserParameter=uHDD.health.[*],sudo smartctl -H $1 | awk -F ': +' '$$0 ~ /test/ { print $$2 }'
UserParameter=uHDD.errorlog.[*],sudo smartctl -l error $1 |grep -i "ATA Error Count"| cut -f2 -d: |tr -d " " || true
### DEPRECATED. The following were used in the first version of template for 3.4
### DEPRECATED. The following were used in the first version of the template for 3.4
UserParameter=uHDD.A[*],sudo smartctl -A $1
UserParameter=uHDD.i[*],sudo smartctl -i $1
UserParameter=uHDD.health[*],sudo smartctl -H $1 || true
### With the latest template you only need these:
### With the latest 3.4 template you only need these:
UserParameter=uHDD.get[*],sudo smartctl -i -H -A -l error -l background $1 || true
UserParameter=uSSD.get[*],sudo smartctl -i -H -A -l error -l background $1 || true
UserParameter=uHDD.discovery[*],sudo /etc/zabbix/scripts/smartctl-disks-discovery.pl $1
Expand Down

0 comments on commit a513bf7

Please sign in to comment.