unraid-zabbix_agent/zabbix_agent.plg

78 lines
2.2 KiB
XML

<?xml version='1.0' standalone='yes'?>
<!DOCTYPE PLUGIN [
<!ENTITY name "zabbix_agent">
<!ENTITY author "fabianonline">
<!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 packageName "zabbix_agent-&version;.package.tgz">
<!ENTITY packageURL "&baseURL;/&packageName;">
<!ENTITY packageMD5 "2740e36b05204d8f9be5be853cc105cd">
]>
<PLUGIN name="&name;" author="&author;" version="&version;" pluginURL="&pluginURL;">
<CHANGES>
##&name;
### 2020-07-16
- Package based installation process.
- Added a zabbix template file.
### 2020-07-15
- More metrics
### 2020-07-14
- Initial commit
</CHANGES>
<FILE Run="/bin/bash"><INLINE>
echo "Installation of zabbix_agent plugin started."
if [ -e /boot/config/plugins/zabbix_agent/&packageName; ]; then
echo "Package already exists."
else
echo "Current &packageName; not found; removing old packages (if existing)."
rm /boot/config/plugins/zabbix_agent/*.package.tgz
echo "Downloading current package..."
fi
</INLINE></FILE>
<FILE Name="/boot/config/plugins/zabbix_agent/&packageName;">
<URL>&packageURL;</URL>
<MD5>&packageMD5;</MD5>
</FILE>
<FILE Run="/bin/bash"><INLINE>
if [ -x /etc/rc.d/rc.zabbix_agentd ]; then
echo "Stopping old zabbix agent..."
/etc/rc.d/rc.zabbix_agentd stop
fi
echo "Extracting support files..."
tar -xzvf /boot/config/plugins/zabbix_agent/&packageName; --strip=1 -C /
/etc/rc.d/rc.zabbix_agentd start
</INLINE></FILE>
<!--- Uninstall -->
<FILE Run="/bin/bash" Method="remove"><INLINE>
echo "Removal of zabbix_agent plugin started."
echo "Stopping zabbix_agentd..."
/etc/rc.d/rc.zabbix_agentd stop
echo "Deleting /usr/sbin/zabbix_agentd..."
rm /usr/sbin/zabbix_agentd
echo "Deleting /etc/rc.d/rc.zabbix_agentd..."
rm /etc/rc.d/rc.zabbix_agentd
echo "Deleting /boot/config/plugins/zabbix_agent/..."
rm -rf /boot/config/plugins/zabbix_agent/
echo "Deleting /usr/local/emhttp/plugins/zabbix_agent/..."
rm -rf /usr/local/emhttp/plugins/zabbix_agent/
echo "Removal of zabbix_agent plugin completed."
</INLINE></FILE>
</PLUGIN>