109 lines
3.2 KiB
XML
109 lines
3.2 KiB
XML
<?xml version='1.0' standalone='yes'?>
|
|
|
|
<!DOCTYPE PLUGIN [
|
|
<!ENTITY name "zabbix_agent">
|
|
<!ENTITY author "fabianonline">
|
|
<!ENTITY plgauthor "fabianonline">
|
|
<!ENTITY agent_version "5.0.2">
|
|
<!ENTITY baseURL "https://git.schle.nz/fabian/unraid-zabbix_agent/raw/branch/main">
|
|
<!ENTITY pluginURL "&baseURL;/zabbix_agent.plg">
|
|
<!ENTITY agentURL "&baseURL;/zabbix_agentd-&agent_version;">
|
|
<!ENTITY version "2020-07-14">
|
|
]>
|
|
|
|
<PLUGIN name="&name;" author="&author;" version="&version;" pluginURL="&pluginURL;">
|
|
|
|
<CHANGES>
|
|
##&name;
|
|
|
|
### 2020-07-14
|
|
- Initial commit
|
|
</CHANGES>
|
|
|
|
<FILE Run="/bin/bash"><INLINE>
|
|
echo "Installation of zabbix_agent plugin started."
|
|
mkdir -p /boot/config/plugins/zabbix_agent/scripts
|
|
if [ -e /boot/config/plugins/zabbix_agent/zabbix_agentd-&agent_version; ]; then
|
|
echo "Agent already exists. Using local files."
|
|
else
|
|
echo "zabbix_agent version &agent_version; not found."
|
|
echo "Removing old files..."
|
|
rm /boot/config/plugins/zabbix_agent/zabbix_agentd-*
|
|
rm /boot/config/plugins/zabbix_agent/rc.zabbix_agentd
|
|
rm /boot/config/plugins/zabbix_agent/zabbix_agentd.conf
|
|
rm /boot/config/plugins/zabbix_agent/scripts/*
|
|
echo "Downloading &agentURL;..."
|
|
wget "&agentURL;" -O /boot/config/plugins/zabbix_agent/zabbix_agentd-&agent_version;
|
|
fi
|
|
</INLINE></FILE>
|
|
|
|
<FILE Name="/boot/config/plugins/zabbix_agent/rc.zabbix_agentd"><INLINE>
|
|
<![CDATA[
|
|
{{{ rc.zabbix_agentd }}}
|
|
]]>
|
|
</INLINE></FILE>
|
|
|
|
<FILE Name="/boot/config/plugins/zabbix_agent/zabbix_agentd.conf"><INLINE>
|
|
<![CDATA[
|
|
{{{ zabbix_agentd.conf }}}
|
|
]]>
|
|
</INLINE></FILE>
|
|
|
|
<FILE Name="/boot/config/plugins/zabbix_agent/scripts/disks.discovery.sh"><INLINE>
|
|
<![CDATA[
|
|
{{{ scripts/disks.discovery.sh }}}
|
|
]]>
|
|
</INLINE></FILE>
|
|
|
|
<FILE Name="/boot/config/plugins/zabbix_agent/scripts/disk.sh"><INLINE>
|
|
<![CDATA[
|
|
{{{ scripts/disk.sh }}}
|
|
]]>
|
|
</INLINE></FILE>
|
|
|
|
<FILE Name="/boot/config/plugins/zabbix_agent/scripts/qemu.discovery.sh"><INLINE>
|
|
<![CDATA[
|
|
{{{ scripts/qemu.discovery.sh }}}
|
|
]]>
|
|
</INLINE></FILE>
|
|
|
|
<FILE Name="/boot/config/plugins/zabbix_agent/scripts/qemu.sh"><INLINE>
|
|
<![CDATA[
|
|
{{{ scripts/qemu.sh }}}
|
|
]]>
|
|
</INLINE></FILE>
|
|
|
|
<FILE Run="/bin/bash"><INLINE>
|
|
cp /boot/config/plugins/zabbix_agent/rc.zabbix_agentd /etc/rc.d/rc.zabbix_agentd
|
|
chmod +x /etc/rc.d/rc.zabbix_agentd
|
|
|
|
mkdir -p /usr/local/emhttp/plugins/zabbix_agent/scripts
|
|
cp -R /boot/config/plugins/zabbix_agent/scripts/* /usr/local/emhttp/plugins/zabbix_agent/scripts/
|
|
chmod +x /usr/local/emhttp/plugins/zabbix_agent/scripts/*
|
|
|
|
/etc/rc.d/rc.zabbix_agentd stop
|
|
|
|
cp /boot/config/plugins/zabbix_agent/zabbix_agentd-&agent_version; /usr/sbin/zabbix_agentd
|
|
chmod +x /usr/sbin/zabbix_agentd
|
|
|
|
/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 /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>
|