Here are some notes on how I got Zabbix Server and Agents to build on SUSE Linux 10. These are not meant to replace the default zabbix install instructions, but to supplement them.
Step 1. Get source and create confgiure script (don't build yet though)
cd to /usr/local/src
fetch zabbix-1.4.4.tar.gz source
In /usr/local/src, create a shell script named "config-zabbix.sh" with these lines and chmod it +x. Note that the text from "IKSEMEL_LIBS" through "./configure --prefix=/opt/zabbix \" is all on a single line, though it may be wrapped in the display of this post. Those "\" characters at the end of most of the lines are supposed to be there, and need to be there.
#!/bin/sh
IKSEMEL_LIBS=-L/usr/local/lib IKSEMEL_CFLAGS=-I/usr/local LDFLAGS="-L/usr/local -L/usr/lib" CPPFLAGS="-I/usr/local -I/usr" ./configure --prefix=/opt/zabbix \
--enable-server \
--enable-agent \
--with-mysql \
--with-net-snmp \
--with-jabber \
--with-libcurl \
--with-ldap
Step 2. Adjust environment / get prerequisites installed
Create the zabbix user:
useradd zabbix
By default, SLES10 is missing some needed config changes / packages.
Use YaST to install the following:
apache2-mod_php5,
curl, curl-devel,
fping,
gcc,
mysql, mysql-shared, mysql-client, mysql-devel,
net-snmp, net-snmp-devel,
openldap2-devel,
php5, php5-pdo, php5-zlib, php5-bcmath, php5-mysql, php5-openssl, php5-curl, php5-gd
Edit /etc/php5/apache2/php.ini and replace or add (if necessary) the following params:
max_execution_time = 300
memory_limit = 128M
Edit /etc/my.cnf and in the [myslqd] section, add this line (this forces mysqld to listen only on the localhost interface, which is a best practice for mysql, though not a requirement for it or zabbix):
bind-address=127.0.0.1
Edit /etc/sysconfig/apache2 and find the "APACHE_MODULES=" line which should have a bunch of modules in it already. Add to the end of the list of modules "mod_php5". The last part of my line looks like:
"...proxy_ajp mod_php5"
Step 3 web server config
My host dns name is "lemur.macalester.edu" and I will be running zabbix on here, but I want to leave the site pages at lemur.macalester.edu alone. I've added a DNS entry so zabbix.macalester.edu resolves to the same IP, but now need to configure named virtual hosting on the web server.
Edit /etc/apache2/listen.conf. It shows several commented out example "NameVirtualHost" lines. Add a single line at the end:
NameVirtualHost *:80
In /etc/apache2/vhosts.d, create two config files, one for each virtual host.
lemur.macalester.edu.conf
zabbix.macalester.edu.conf
lemur.macalester.edu.conf contains:
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName lemur.macalester.edu
DocumentRoot /srv/www/htdocs
DirectoryIndex index.html index.htm
ErrorLog /var/log/apache2/error_log
CustomLog /var/log/apache2/access_log combined
HostnameLookups Off
UseCanonicalName Off
ServerSignature On
Include /etc/opt/novell/httpd/conf.d/*.conf
</VirtualHost>
zabbix.macalester.edu.conf contains:
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName zabbix.macalester.edu
DocumentRoot /opt/zabbixwww
DirectoryIndex index.html index.htm index.php
ErrorLog /var/log/apache2/zabbix.macalester.edu-error_log
CustomLog /var/log/apache2/zabbix.macalester.edu-access_log combined
HostnameLookups Off
UseCanonicalName Off
ServerSignature On
<Directory "/opt/zabbixwww">
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Step 4. Prerequisite Software
Most of it can be obtained easily with YaST. However, I couldn't get the Jabber (iksemel) stuff via YaST. I also found that the gnutls package offered via YaST was too old. So I had to do the following:
Get libgpg-error from ftp://ftp.gnupg.org/gcrypt/libgpg-er...or-1.6.tar.bz2
Get libgcrypt from ftp://ftp.gnupg.org/gcrypt/libgcrypt...-1.4.0.tar.bz2
Get gnutls from ftp://ftp.gnutls.org/pub/crypto/gnut...-1.6.3.tar.bz2
Get iksemel source from http://ubuntu.osuosl.org/ubuntu/pool....2.orig.tar.gz
Then un-zip, configure, make and install each in this order:
tar -jxf libgpg-error-1.6.tar.bz2
tar -jxf libgcrypt-1.4.0.tar.bz2
tar -jxf gnutls-1.6.3.tar.bz2
tar -zxf libiksemel_1.2.orig.tar.gz
cd libgpg-error-1.6
./configure && make && make install
cd ../libgcrypt-1.4.0
./configure && make && make install
cd ../gnutls-1.6.3
./configure && make && make install
cd ../iksemel-1.2
./configure && make && make install
Step 5. Build Zabbix.
With any luck, everything is now almost in place to build zabbix. First though, you have to edit the zabbix configure script.
cd /usr/local/src/zabbix-1.4.4
Edit configure and go to line 10892 which untouched reads:
LIBS="-lnetsnmp $LIBS"
...change that line to:
LIBS="-lnetsnmp -lssl -lcrypto $LIBS"
OK, now you should be in /usr/local/src/zabbix-1.4.4. Do:
../config-zabbix.sh
If that completes successfully, do:
make && make install
mkdir /opt/zabbixwww
cp -r frontends/php/* /opt/zabbixwww
That will install the zabbix binaries in /opt/zabbix and the web interface in /opt/zabbixwww.
Then do:
cat /etc/apache2/uid.conf
That will show the user/group under which your Apache server runs, e.g.:
User wwwrun
Group www
Set the ownership of the zabbix web interface files to that user:
chown -R wwwrun:www /opt/zabbixwww
Step 6 Startup Scripts
A sample SUSE startup script is provided with the source in zabbix-1.4.4/misc/init.d/suse/9.3. It doesn't have a 'status' argument, and doesn't get the path to the zabbix binaries full path/filename right. Here is an updated version. Copy the original to /etc/init.d/, chmod it +x and apply the changes noted here.
--- /usr/local/src/zabbix-1.4.4/misc/init.d/suse/9.3/zabbix_server 2007-12-17 07:19:01.000000000 -0600
+++ zabbix_server 2008-01-30 10:37:15.000000000 -0600
@@ -27,8 +27,9 @@
exit 6
fi
-ZABBIX_BIN="/opt/zabbix/bin/zabbix_server"
+ZABBIX_BIN="/opt/zabbix/sbin/zabbix_server"
ZABBIX_PID="/var/tmp/zabbix_server.pid"
+PIDOF_BIN=/sbin/pidof
if [ ! -x ${ZABBIX_BIN} ] ; then
@@ -39,9 +40,24 @@
fi
-export PATH=$PATH:/opt/zabbix/bin
+export PATH=$PATH:/opt/zabbix/sbin
case "$1" in
+ status)
+ # NOTE: checkproc returns LSB compliant status values.
+ /sbin/checkproc $ZABBIX_BIN
+ if [ $? -eq 0 ]; then
+ PIDS=`$PIDOF_BIN $NAME`
+ echo "Zabbix Server running. ($PIDS)"
+ exit 0
+ else
+ echo "Zabbix Server NOT running."
+ exit 1
+ fi
+ # NOTE: rc_status knows that we called this init script with
+ # "status" option and adapts its messages accordingly.
+ #rc_status -v
+ ;;
start)
echo -n "Starting ${NAME} "
checkproc -p ${ZABBIX_PID} ${ZABBIX_BIN}
@@ -65,7 +81,7 @@
rc_status
;;
*)
- echo "Usage: $0 {start|stop|restart}"
+ echo "Usage: $0 {start|stop|restart|status}"
exit 1
;;
esac
Same goes for zabbix_agentd. Copy the original to /etc/init.d/, chmod it +x and apply the changes noted here.
--- /usr/local/src/zabbix-1.4.4/misc/init.d/suse/9.3/zabbix_agentd 2007-12-17 07:19:01.000000000 -0600
+++ zabbix_agentd 2008-01-30 10:41:03.000000000 -0600
@@ -26,9 +26,9 @@
exit 6
fi
-ZABBIX_BIN="/opt/zabbix/bin/zabbix_agentd"
+ZABBIX_BIN="/opt/zabbix/sbin/zabbix_agentd"
ZABBIX_PID="/var/tmp/zabbix_agentd.pid"
-
+PIDOF_BIN=/sbin/pidof
if [ ! -x ${ZABBIX_BIN} ] ; then
echo -n "${ZABBIX_BIN} not installed! "
@@ -38,9 +38,24 @@
fi
-export PATH=$PATH:/opt/zabbix/bin
+export PATH=$PATH:/opt/zabbix/sbin
case "$1" in
+ status)
+ # NOTE: checkproc returns LSB compliant status values.
+ /sbin/checkproc $ZABBIX_BIN
+ if [ $? -eq 0 ]; then
+ PIDS=`$PIDOF_BIN $NAME`
+ echo "Zabbix AgentD running. ($PIDS)"
+ exit 0
+ else
+ echo "Zabbix AgentD NOT running."
+ exit 1
+ fi
+ # NOTE: rc_status knows that we called this init script with
+ # "status" option and adapts its messages accordingly.
+ #rc_status -v
+ ;;
start)
echo -n "Starting ${NAME} "
checkproc -p ${ZABBIX_PID} ${ZABBIX_BIN}
@@ -64,7 +79,7 @@
rc_status
;;
*)
- echo "Usage: $0 {start|stop|restart}"
+ echo "Usage: $0 {start|stop|restart|status}"
exit 1
;;
esac
Set Zabbix server and agent to start at boot with these commands:
chkconfig -a zabbix_server
chkconfig -a zabbix_agentd
chkconfig --level 35 zabbix_server on
chkconfig --level 35 zabbix_agentd on
Step 7
Copy the sample config scripts into /etc/zabbix:
cd /usr/local/src/zabbix-1.4.4/misc/conf
cp zabbix_server.conf zabbix_agentd.conf /etc/zabbix/
Edit the files as necessary to match your db name, and db user/pass settings.
Step 1. Get source and create confgiure script (don't build yet though)
cd to /usr/local/src
fetch zabbix-1.4.4.tar.gz source
In /usr/local/src, create a shell script named "config-zabbix.sh" with these lines and chmod it +x. Note that the text from "IKSEMEL_LIBS" through "./configure --prefix=/opt/zabbix \" is all on a single line, though it may be wrapped in the display of this post. Those "\" characters at the end of most of the lines are supposed to be there, and need to be there.
#!/bin/sh
IKSEMEL_LIBS=-L/usr/local/lib IKSEMEL_CFLAGS=-I/usr/local LDFLAGS="-L/usr/local -L/usr/lib" CPPFLAGS="-I/usr/local -I/usr" ./configure --prefix=/opt/zabbix \
--enable-server \
--enable-agent \
--with-mysql \
--with-net-snmp \
--with-jabber \
--with-libcurl \
--with-ldap
Step 2. Adjust environment / get prerequisites installed
Create the zabbix user:
useradd zabbix
By default, SLES10 is missing some needed config changes / packages.
Use YaST to install the following:
apache2-mod_php5,
curl, curl-devel,
fping,
gcc,
mysql, mysql-shared, mysql-client, mysql-devel,
net-snmp, net-snmp-devel,
openldap2-devel,
php5, php5-pdo, php5-zlib, php5-bcmath, php5-mysql, php5-openssl, php5-curl, php5-gd
Edit /etc/php5/apache2/php.ini and replace or add (if necessary) the following params:
max_execution_time = 300
memory_limit = 128M
Edit /etc/my.cnf and in the [myslqd] section, add this line (this forces mysqld to listen only on the localhost interface, which is a best practice for mysql, though not a requirement for it or zabbix):
bind-address=127.0.0.1
Edit /etc/sysconfig/apache2 and find the "APACHE_MODULES=" line which should have a bunch of modules in it already. Add to the end of the list of modules "mod_php5". The last part of my line looks like:
"...proxy_ajp mod_php5"
Step 3 web server config
My host dns name is "lemur.macalester.edu" and I will be running zabbix on here, but I want to leave the site pages at lemur.macalester.edu alone. I've added a DNS entry so zabbix.macalester.edu resolves to the same IP, but now need to configure named virtual hosting on the web server.
Edit /etc/apache2/listen.conf. It shows several commented out example "NameVirtualHost" lines. Add a single line at the end:
NameVirtualHost *:80
In /etc/apache2/vhosts.d, create two config files, one for each virtual host.
lemur.macalester.edu.conf
zabbix.macalester.edu.conf
lemur.macalester.edu.conf contains:
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName lemur.macalester.edu
DocumentRoot /srv/www/htdocs
DirectoryIndex index.html index.htm
ErrorLog /var/log/apache2/error_log
CustomLog /var/log/apache2/access_log combined
HostnameLookups Off
UseCanonicalName Off
ServerSignature On
Include /etc/opt/novell/httpd/conf.d/*.conf
</VirtualHost>
zabbix.macalester.edu.conf contains:
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName zabbix.macalester.edu
DocumentRoot /opt/zabbixwww
DirectoryIndex index.html index.htm index.php
ErrorLog /var/log/apache2/zabbix.macalester.edu-error_log
CustomLog /var/log/apache2/zabbix.macalester.edu-access_log combined
HostnameLookups Off
UseCanonicalName Off
ServerSignature On
<Directory "/opt/zabbixwww">
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Step 4. Prerequisite Software
Most of it can be obtained easily with YaST. However, I couldn't get the Jabber (iksemel) stuff via YaST. I also found that the gnutls package offered via YaST was too old. So I had to do the following:
Get libgpg-error from ftp://ftp.gnupg.org/gcrypt/libgpg-er...or-1.6.tar.bz2
Get libgcrypt from ftp://ftp.gnupg.org/gcrypt/libgcrypt...-1.4.0.tar.bz2
Get gnutls from ftp://ftp.gnutls.org/pub/crypto/gnut...-1.6.3.tar.bz2
Get iksemel source from http://ubuntu.osuosl.org/ubuntu/pool....2.orig.tar.gz
Then un-zip, configure, make and install each in this order:
tar -jxf libgpg-error-1.6.tar.bz2
tar -jxf libgcrypt-1.4.0.tar.bz2
tar -jxf gnutls-1.6.3.tar.bz2
tar -zxf libiksemel_1.2.orig.tar.gz
cd libgpg-error-1.6
./configure && make && make install
cd ../libgcrypt-1.4.0
./configure && make && make install
cd ../gnutls-1.6.3
./configure && make && make install
cd ../iksemel-1.2
./configure && make && make install
Step 5. Build Zabbix.
With any luck, everything is now almost in place to build zabbix. First though, you have to edit the zabbix configure script.
cd /usr/local/src/zabbix-1.4.4
Edit configure and go to line 10892 which untouched reads:
LIBS="-lnetsnmp $LIBS"
...change that line to:
LIBS="-lnetsnmp -lssl -lcrypto $LIBS"
OK, now you should be in /usr/local/src/zabbix-1.4.4. Do:
../config-zabbix.sh
If that completes successfully, do:
make && make install
mkdir /opt/zabbixwww
cp -r frontends/php/* /opt/zabbixwww
That will install the zabbix binaries in /opt/zabbix and the web interface in /opt/zabbixwww.
Then do:
cat /etc/apache2/uid.conf
That will show the user/group under which your Apache server runs, e.g.:
User wwwrun
Group www
Set the ownership of the zabbix web interface files to that user:
chown -R wwwrun:www /opt/zabbixwww
Step 6 Startup Scripts
A sample SUSE startup script is provided with the source in zabbix-1.4.4/misc/init.d/suse/9.3. It doesn't have a 'status' argument, and doesn't get the path to the zabbix binaries full path/filename right. Here is an updated version. Copy the original to /etc/init.d/, chmod it +x and apply the changes noted here.
--- /usr/local/src/zabbix-1.4.4/misc/init.d/suse/9.3/zabbix_server 2007-12-17 07:19:01.000000000 -0600
+++ zabbix_server 2008-01-30 10:37:15.000000000 -0600
@@ -27,8 +27,9 @@
exit 6
fi
-ZABBIX_BIN="/opt/zabbix/bin/zabbix_server"
+ZABBIX_BIN="/opt/zabbix/sbin/zabbix_server"
ZABBIX_PID="/var/tmp/zabbix_server.pid"
+PIDOF_BIN=/sbin/pidof
if [ ! -x ${ZABBIX_BIN} ] ; then
@@ -39,9 +40,24 @@
fi
-export PATH=$PATH:/opt/zabbix/bin
+export PATH=$PATH:/opt/zabbix/sbin
case "$1" in
+ status)
+ # NOTE: checkproc returns LSB compliant status values.
+ /sbin/checkproc $ZABBIX_BIN
+ if [ $? -eq 0 ]; then
+ PIDS=`$PIDOF_BIN $NAME`
+ echo "Zabbix Server running. ($PIDS)"
+ exit 0
+ else
+ echo "Zabbix Server NOT running."
+ exit 1
+ fi
+ # NOTE: rc_status knows that we called this init script with
+ # "status" option and adapts its messages accordingly.
+ #rc_status -v
+ ;;
start)
echo -n "Starting ${NAME} "
checkproc -p ${ZABBIX_PID} ${ZABBIX_BIN}
@@ -65,7 +81,7 @@
rc_status
;;
*)
- echo "Usage: $0 {start|stop|restart}"
+ echo "Usage: $0 {start|stop|restart|status}"
exit 1
;;
esac
Same goes for zabbix_agentd. Copy the original to /etc/init.d/, chmod it +x and apply the changes noted here.
--- /usr/local/src/zabbix-1.4.4/misc/init.d/suse/9.3/zabbix_agentd 2007-12-17 07:19:01.000000000 -0600
+++ zabbix_agentd 2008-01-30 10:41:03.000000000 -0600
@@ -26,9 +26,9 @@
exit 6
fi
-ZABBIX_BIN="/opt/zabbix/bin/zabbix_agentd"
+ZABBIX_BIN="/opt/zabbix/sbin/zabbix_agentd"
ZABBIX_PID="/var/tmp/zabbix_agentd.pid"
-
+PIDOF_BIN=/sbin/pidof
if [ ! -x ${ZABBIX_BIN} ] ; then
echo -n "${ZABBIX_BIN} not installed! "
@@ -38,9 +38,24 @@
fi
-export PATH=$PATH:/opt/zabbix/bin
+export PATH=$PATH:/opt/zabbix/sbin
case "$1" in
+ status)
+ # NOTE: checkproc returns LSB compliant status values.
+ /sbin/checkproc $ZABBIX_BIN
+ if [ $? -eq 0 ]; then
+ PIDS=`$PIDOF_BIN $NAME`
+ echo "Zabbix AgentD running. ($PIDS)"
+ exit 0
+ else
+ echo "Zabbix AgentD NOT running."
+ exit 1
+ fi
+ # NOTE: rc_status knows that we called this init script with
+ # "status" option and adapts its messages accordingly.
+ #rc_status -v
+ ;;
start)
echo -n "Starting ${NAME} "
checkproc -p ${ZABBIX_PID} ${ZABBIX_BIN}
@@ -64,7 +79,7 @@
rc_status
;;
*)
- echo "Usage: $0 {start|stop|restart}"
+ echo "Usage: $0 {start|stop|restart|status}"
exit 1
;;
esac
Set Zabbix server and agent to start at boot with these commands:
chkconfig -a zabbix_server
chkconfig -a zabbix_agentd
chkconfig --level 35 zabbix_server on
chkconfig --level 35 zabbix_agentd on
Step 7
Copy the sample config scripts into /etc/zabbix:
cd /usr/local/src/zabbix-1.4.4/misc/conf
cp zabbix_server.conf zabbix_agentd.conf /etc/zabbix/
Edit the files as necessary to match your db name, and db user/pass settings.