I've been evaluating Zabbix for monitoring Red Hat Enterprise Linux servers. This is the spec file and associated patches I use to build for testing. All the files need to be renamed without the ".txt" extension before use. The spec file also uses the other patch I just posted for the available memory calculation, anybody wanting to build will need to either get that patch or remove the references from the spec file.
The spec creates RPMs for server, agent, and PHP frontend. The server is compiled with net-snmp and MySQL support. Installing the server or agent adds the zabbix user if necessary and installs init scripts. Config files are flagged in the spec to protect them through uninstalls and upgrades. It's not perfect, but it seems to work reasonably well.
The spec file is written for RHEL4, but I think it should work fine on RHEL3 as well. Older Red Hat releases used ucd-snmp instead of net-snmp and the spec file would have to be modified to reflect that.
Patch details:
zabbix_addons.patch - misc. additions, currently only has an include file for the Apache configuration.
zabbix_db.patch - change default DB username in config files from "root" to "zabbix". That's what I use, plus I can give the packages to somebody else and they won't wonder if it actually needs to connect to MySQL as root.
zabbix_paths.patch - change paths to fit better in to Red Hat systems. This is a rather large patch which does the following:
1. Change DB creation scripts to load images from where my package puts them.
2. Set default PID file location to /var/run/zabbix/ (created by RPM as mode 0750, owned by zabbix:zabbix).
3. Set default log location to /var/log/zabbix/ (created by RPM as mode 0750, owned by zabbix:zabbix).
4. Set default script path to /var/lib/zabbix/ (created by RPM as mode 0750, owned by root:zabbix).
5. Set appropriate paths in init scripts and snmptrap.sh.
6. Move temp files from /tmp/ to /var/run/zabbix/. This prevents local users from overwriting files with the permissions of the zabbix user.
7. Change config file names from /etc/zabbix/zabbix_prog.conf to /etc/zabbix/prog.conf. It just seemed redundant to have "zabbix" in there twice. I did the same with the log and pid files, since I put them in their own directories.
The spec creates RPMs for server, agent, and PHP frontend. The server is compiled with net-snmp and MySQL support. Installing the server or agent adds the zabbix user if necessary and installs init scripts. Config files are flagged in the spec to protect them through uninstalls and upgrades. It's not perfect, but it seems to work reasonably well.
The spec file is written for RHEL4, but I think it should work fine on RHEL3 as well. Older Red Hat releases used ucd-snmp instead of net-snmp and the spec file would have to be modified to reflect that.
Patch details:
zabbix_addons.patch - misc. additions, currently only has an include file for the Apache configuration.
zabbix_db.patch - change default DB username in config files from "root" to "zabbix". That's what I use, plus I can give the packages to somebody else and they won't wonder if it actually needs to connect to MySQL as root.
zabbix_paths.patch - change paths to fit better in to Red Hat systems. This is a rather large patch which does the following:
1. Change DB creation scripts to load images from where my package puts them.
2. Set default PID file location to /var/run/zabbix/ (created by RPM as mode 0750, owned by zabbix:zabbix).
3. Set default log location to /var/log/zabbix/ (created by RPM as mode 0750, owned by zabbix:zabbix).
4. Set default script path to /var/lib/zabbix/ (created by RPM as mode 0750, owned by root:zabbix).
5. Set appropriate paths in init scripts and snmptrap.sh.
6. Move temp files from /tmp/ to /var/run/zabbix/. This prevents local users from overwriting files with the permissions of the zabbix user.
7. Change config file names from /etc/zabbix/zabbix_prog.conf to /etc/zabbix/prog.conf. It just seemed redundant to have "zabbix" in there twice. I did the same with the log and pid files, since I put them in their own directories.