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 3, 2020
1 parent 8caaf58 commit 8fba840
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 18 deletions.
4 changes: 2 additions & 2 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-02-17T07:56:44Z</date>
<date>2020-03-02T12:56:26Z</date>
<groups>
<group>
<name>Templates Users</name>
Expand Down Expand Up @@ -150,7 +150,7 @@
<preprocessing>
<step>
<type>REGEX</type>
<params>[Ss]erial [Nn]umber:\s+([\d-\w]+)+
<params>[Ss]erial [Nn]umber:\s+([\d\w-]+)
\1</params>
</step>
</preprocessing>
Expand Down
21 changes: 13 additions & 8 deletions smartctl-storage-discovery.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<#
.VERSION
0.1
0.2
.DESCRIPTION
Author: Nikitin Maksim
Expand Down Expand Up @@ -74,15 +74,20 @@ foreach ($device in $smart_scan) {
if ($d) {
$storage_model = $d.Trim()
} else {
$p = (($info | Select-String "Product:") -replace "Product:")
if ($p) {
$storage_model = $p.Trim()
$m = (($info | Select-String "Model Number:") -replace "Model Number:")
if ($m) {
$storage_model = $m.Trim()
} else {
$v = (($info | Select-String "Vendor:") -replace "Vendor:")
if ($v) {
$storage_model = $v.Trim()
$p = (($info | Select-String "Product:") -replace "Product:")
if ($p) {
$storage_model = $p.Trim()
} else {
$storage_model = "Not find"
$v = (($info | Select-String "Vendor:") -replace "Vendor:")
if ($v) {
$storage_model = $v.Trim()
} else {
$storage_model = "Not find"
}
}
}
}
Expand Down
21 changes: 13 additions & 8 deletions smartctl-storage-discovery.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
#
# .VERSION
# 0.1
# 0.2
#
# .DESCRIPTION
# Author: Nikitin Maksim
Expand Down Expand Up @@ -66,15 +66,20 @@ LLDSmart()
if [ -n $d ]; then
storage_model=$d
else
p=$(/bin/echo $temp_info | grep "Product:" | cut -f2 -d":" | sed -e 's/^\s*//')
if [ -n $p ]; then
storage_model=$p
m=$(/bin/echo $temp_info | grep "Model Number:" | cut -f2 -d":" | sed -e 's/^\s*//')
if [ -n $m ]; then
storage_model=$m
else
v=$(/bin/echo $temp_info | grep "Vendor:" | cut -f2 -d":" | sed -e 's/^\s*//')
if [ -n $v ]; then
storage_model=$v
p=$(/bin/echo $temp_info | grep "Product:" | cut -f2 -d":" | sed -e 's/^\s*//')
if [ -n $p ]; then
storage_model=$p
else
storage_model="Not find"
v=$(/bin/echo $temp_info | grep "Vendor:" | cut -f2 -d":" | sed -e 's/^\s*//')
if [ -n $v ]; then
storage_model=$v
else
storage_model="Not find"
fi
fi
fi
fi
Expand Down

0 comments on commit 8fba840

Please sign in to comment.