Tot een eind geleden was mijn Qnap TS 589 mijn hoofd-nas. Nu gebruik ik die alleen nog voor Backups. Dus heb ik de disks volledig gewist en ben opnieuw begonnen. Zoveel mogelijk services uitgeschakeld behalve RRTR (en de noodzakelijke services). Maar het is toch wel interessant om die NAS nog steeds te volgen via de Zabbix monitoring. Maar helaas; IPKG wordt niet meer ondersteund. Dus moest ik het wel doen via Entware.
Hierbij de procedure voor installatie van een Zabbix Agent 4.0.14
Installatie van Entware
cd /share/MD0_DATA/
wget --no-check-certificate "http://entware-3x.zyxmon.org/binaries/other/Entware-3x_1.00std.qpkg"
sh Entware-3x_1.00std.qpkg
# note if next command replies with opkg not found. close your shell and start again.
opkg update
opkg upgrade
Installeer enkele packages
opkg install busybox ldd make gawk sed
opkg install gcc
opkg install gawk
opkg install make
opkg upgrade tar
opkg install libpcre2
De laatste instructie is misschien niet nodig. Maar het is wel PCRE die zorgt voor moeilijkheden.
Het bestand pcre.h is niet te vinden op de NAS en die heeft het configure script van Zabbix wel nodig.
We gaan dit dan wat forceren door die op de juiste plaats te gaan zetten.
Op datum van schrijven was 8.43 de laatste versie van PCRE. Kijk na welke versie Entware heeft geïnstalleerd met: opkg list-installed
Pas in onderstaande script de versie aan.
Copieer pcre.h naar bestemming
wget "ftp://ftp.pcre.org/pub/pcre/pcre-8.43.tar.gz"
tar -xzvf pcre-8.43.tar.gz
cd pcre-8.43
configure --disable-cpp
make
cp pcre.h /opt/include/
#make install
Make install werkt niet, maar ondertussen hebben we wel al wat we nodig hebben. Ondertussen staat het ‘header” bestand op /opt/include
Configure script voor Zabbix Agent
cd /share/MD0_DATA/
# wget http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/3.2.6/zabbix-3.2.6.tar.gz/download --no-check-certificate --secure-protocol=TLSv1.2
# We can't use wget anymore since the wget from BusyBox does not support SSL
curl -v --tlsv1.2 https://netcologne.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/4.0.14/zabbix-4.0.14.tar.gz -o Public/zabbix-4.0.14.tar.gz
tar -xzvf Public/zabbix-4.0.14.tar.gz
rm zabbix-4.0.14.tar.gz
cd zabbix-4.0.14
./configure --enable-agent --with-libpcre=/opt/lib --with-libpcre-include=/opt/include
Als extra argumenten werd dus de locatie van de pcre files mee gegeven.
Make en start
make install
addgroup zabbix
adduser -G zabbix zabbix
#Start zabbix_agentd
zabbix_agentd
Als extra start ik de zabbix agent bij het opstarten op een vrij lakse manier, maar het werkt.
Maak een bestand om Zabbix agent de maken (configure && make) en voer dit uit via een cronjob
Script voor configure, make en start
touch /share/MD0_DATA/zabbix-4.0.14/zabbix.sh
chmod +x /share/MD0_DATA/zabbix-4.0.14/zabbix.sh
vi /share/MD0_DATA/zabbix-4.0.14/zabbix.sh
#!/bin/bash PATH=/opt/bin:$PATH export PATH c=$(cat /usr/local/etc/zabbix_agentd.conf | grep Nas1ZAgent) if [ "$c" != "Hostname=Nas1ZAgent" ] then cd /share/MD0_DATA/zabbix-4.0.14 $(/share/MD0_DATA/zabbix-4.0.14/configure --enable-agent >> /tmp/configure.log) make install # pas config aan van zabbix_agent sed -i -e 's/Server=127.0.0.1/Server=zproxyintranet.reynaert.be/g' /usr/local/etc/zabbix_agentd.conf sed -i -e 's/ServerActive=127.0.0.1/ServerActive=zproxyintranet.reynaert.be/g' /usr/local/etc/zabbix_agentd.conf sed -i -e 's/Hostname=Zabbix server/Hostname=Nas1ZAgent/g' /usr/local/etc/zabbix_agentd.conf # Start zabbix_agentd zabbix_agentd fi
vi /etc/config/crontab
*/5 * * * * /share/MD0_DATA/zabbix-4.0.14/zabbix.sh