Compare commits

...

4 Commits

4 changed files with 49 additions and 4 deletions

View File

@ -9,7 +9,7 @@ while read line; do
if [ $found = 1 ]; then
[ $fsFree -ge 0 ] && [ $fsSize -ge 0 ] && fsUsed=$(( $fsSize - $fsFree ))
echo -n '{"device":"'$device'", "name":"'$name'", "status":"'$status'", "temp":'$temp', "size":'$size', "num_reads":'$num_reads', '
echo -n '"num_writes":'$num_writes', "num_errors":'$num_errors', "type":"'$type'", "fs_size":'$fsSize', "fs_free":'$fsFree', "fs_used":'$fsUsed', '
echo -n '"num_writes":'$num_writes', "num_errors":'$num_errors', "type":"'$type'", "fs_size":'$fsSize', "fs_free":'$fsFree', "fs_used":'$fsUsed', "running":'$running', '
break
else
device=''
@ -24,6 +24,7 @@ while read line; do
fsSize=-1
fsFree=-1
fsUsed=-1
running=-1
fi
else
while IFS="=" read key value; do
@ -41,6 +42,12 @@ while read line; do
[ $key = "type" ] && type="$value"
[ $key = "fsSize" ] && fsSize=$(( $value * 1024 ))
[ $key = "fsFree" ] && fsFree=$(( $value * 1024 ))
if [ $key = "color" ]; then
case "$value" in
green-on) running=1;;
green-blink) running=0;;
esac
fi
done <<< "$line"
fi
done < <(cat /var/local/emhttp/disks.ini ; echo "[empty]")

View File

@ -6,10 +6,10 @@
<!ENTITY plgauthor "fabianonline">
<!ENTITY baseURL "https://git.schle.nz/fabian/unraid-zabbix_agent/raw/branch/main">
<!ENTITY pluginURL "&baseURL;/zabbix_agent.plg">
<!ENTITY version "2020.08.22.1">
<!ENTITY version "2020.09.05.1">
<!ENTITY packageName "zabbix_agent-&version;-x86_64-1.txz">
<!ENTITY packageURL "&baseURL;/&packageName;">
<!ENTITY packageMD5 "1aae2b12fb6827c934d1e70c9c7ab15a">
<!ENTITY packageMD5 "14e3dd2d08af436deafc8f924b61e958">
]>
<PLUGIN name="&name;" author="&author;" version="&version;" pluginURL="&pluginURL;" packageMD5="&packageMD5;">

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>5.0</version>
<date>2020-08-28T19:01:50Z</date>
<date>2020-09-05T12:40:25Z</date>
<groups>
<group>
<name>Templates</name>
@ -592,6 +592,29 @@
<key>unraid.disk[{#ID}]</key>
</master_item>
</item_prototype>
<item_prototype>
<name>Disk {#ID} running</name>
<type>DEPENDENT</type>
<key>unraid.disk[{#ID},running]</key>
<delay>0</delay>
<applications>
<application>
<name>Disks</name>
</application>
</applications>
<valuemap>
<name>Yes/No</name>
</valuemap>
<preprocessing>
<step>
<type>JSONPATH</type>
<params>$.running</params>
</step>
</preprocessing>
<master_item>
<key>unraid.disk[{#ID}]</key>
</master_item>
</item_prototype>
<item_prototype>
<name>Disk {#ID} size</name>
<type>DEPENDENT</type>
@ -903,4 +926,19 @@ return j.cpu_time / j.cpus * 100;</params>
</discovery_rules>
</template>
</templates>
<value_maps>
<value_map>
<name>Yes/No</name>
<mappings>
<mapping>
<value>0</value>
<newvalue>No</newvalue>
</mapping>
<mapping>
<value>1</value>
<newvalue>Yes</newvalue>
</mapping>
</mappings>
</value_map>
</value_maps>
</zabbix_export>