Compare commits

...

4 Commits

6 changed files with 72 additions and 7 deletions

View File

@ -3,6 +3,27 @@ VERSION=`xpath -q -e 'string(//PLUGIN/@version)' zabbix_agent.plg`
FILE="zabbix_agent-$VERSION.package.tgz"
echo "Version in plugin file: $VERSION"
echo "Generated file will be: $FILE"
if [ -e "$FILE" ]; then
echo "File already exists."
givenMD5=`xpath -q -e 'string(//PLUGIN/@packageMD5)' zabbix_agent.plg`
read currentMD5 _ < <(md5sum "$FILE")
if [ "$givenMD5" = "$currentMD5" ]; then
echo "MD5 value matches."
else
echo "MD5 value does not match!"
echo "unraid_zabbix.plg: $givenMD5"
echo "$FILE: $currentMD5"
fi
if [ "$1" != "--force" ]; then
echo "Stopping now. Call '$0 --force' to force recreating the file."
exit 1
fi
fi
echo "Is this correct? If yes, press Enter. If not, press Ctrl-C."
read
@ -12,3 +33,4 @@ tar -czvf "$FILE" files
echo
read md5 _ < <(md5sum "$FILE")
echo "MD5 of the resulting file for the plugin file: $md5"
echo "Run this tool again to validate the MD5 value from the plugin file."

View File

@ -27,3 +27,4 @@ UserParameter=unraid.disk[*],/usr/local/emhttp/plugins/zabbix_agent/scripts/disk
UserParameter=unraid.disks.totals,/usr/local/emhttp/plugins/zabbix_agent/scripts/disks.totals.sh
UserParameter=unraid.qemu.discovery,/usr/local/emhttp/plugins/zabbix_agent/scripts/qemu.discovery.sh
UserParameter=unraid.qemu[*],/usr/local/emhttp/plugins/zabbix_agent/scripts/qemu.sh "$1"
UserParameter=unraid.temperatures,/usr/local/emhttp/plugins/zabbix_agent/scripts/temperatures.sh

View File

@ -16,9 +16,10 @@ while IFS=":" read key value; do
[ "$key" = "Used memory" ] && echo -n ', "memory_used":'$((${value%KiB} * 1024))
done < <(virsh dominfo "$VM")
read interface _ < <(virsh domiflist "$VM" | head -n3 | tail -n1)
while read if key value; do
[ "$key" = "rx_bytes" ] && echo -n ', "network_bytes_in":'$value
[ "$key" = "tx_bytes" ] && echo -n ', "network_bytes_out":'$value
done < <(virsh domifstat "$VM" vnet0)
done < <(virsh domifstat "$VM" "$interface")
echo "}"

View File

@ -0,0 +1,37 @@
#!/bin/bash
result=$( sensors )
error="$?"
if [ "$error" -gt 0 ]; then
echo '{"error": "sensors is not installed"}'
exit 1
fi
echo -n "{"
# CPU temp
line=$( grep 'CPU Temp:' <<< "$result" )
error="$?"
echo -n '"cpu": '
if [ "$error" -eq 0 ]; then
read _ _ temp _ <<< "$line"
temp="${temp#+}"
temp="${temp%°C}"
echo -n "$temp"
else
echo -n "null"
fi
# MB
line=$(grep 'MB Temp:' <<< "$result" )
error="$?"
echo -n ', "mainboard": '
if [ "$error" -eq 0 ]; then
read _ _ temp _ <<< "$line"
temp="${temp#+}"
temp="${temp%°C}"
echo -n "$temp"
else
echo -n "null"
fi
echo "}"

View File

@ -6,25 +6,29 @@
<!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.07.16">
<!ENTITY version "2020.08.11">
<!ENTITY packageName "zabbix_agent-&version;.package.tgz">
<!ENTITY packageURL "&baseURL;/&packageName;">
<!ENTITY packageMD5 "2740e36b05204d8f9be5be853cc105cd">
<!ENTITY packageMD5 "dcf2e2bef5f4f88876ac52ed5ca1046c">
]>
<PLUGIN name="&name;" author="&author;" version="&version;" pluginURL="&pluginURL;">
<PLUGIN name="&name;" author="&author;" version="&version;" pluginURL="&pluginURL;" packageMD5="&packageMD5;">
<CHANGES>
##&name;
### 2020-07-16
### 2020.08.11
- Added system temperature metrics. Note: These will only work if you have the Dynamix System Temperature plugin installed.
- Fixed the virtual interface detection in unraid.qemu.
### 2020.07.16
- Package based installation process.
- Added a zabbix template file.
### 2020-07-15
### 2020.07.15
- More metrics
### 2020-07-14
### 2020.07.14
- Initial commit
</CHANGES>