ClearOS‎ > ‎


I recently installed ClearOS 5.1sp1 as a replacement to a gateway I had been managing.  I put zabbix 1.8.1 on it.  Here's how!
And just a shout-out: this is my first time using 1.8, and it looks like there's been a lot of positive change since 1.6!  Hooray for active development!

1) Install ClearOS, and do some basic config.  Add users, create PDC.  I'll have another page on this later.

2) SSH into the ClearOS box as root.  Or logon locally (use ctrl+f2 to get a terminal).  Clear uses LDAP for users, and they tend not to have shell access.  As such, clear promotes using root by default for shell access.  If you've been around *nix for a while, you'll know that this is never recommended.  But because Clear does so many other things so well, I'm willing to overlook this lapse of security.  You can enable shell access for clear users, though.  See this post.

3) Download zabbix.
cd /usr/src/
tar zxvf zabbix-1.8.1.tar.gz

4) yum groupinstall "Development Tools"
    This will put a compiler and some libraries on your ClearOS, making it possible to compile source packages.

5) RTFM to find out how to install this beast.  If you just run ./configure, you'll be missing components (such as the zabbix server)!  I've done this for you, and you should be able to skip this step if you follow along.  But if you have any trouble, this is the first place you should come back to.

6) Satisfy dependencies. Because this is a ClearOS, we're not going to just do this from the command line. We want to use Clear's GUI when possible.

6a) Log in to your ClearOS web GUI and browse to ClearCenter -> Software Modules.  Find "MySQL Database Server Module" and put a check by it.  Then click the corresponding 'go' button.  We also want to enable MySQL from the ClearOS admin portal.  Browse to server -> MySQL and turn on 'to auto' and click 'start.'  The first time you start the service, ClearOS will alert you to set the root password.  When complete, go back to your root console.

6b)Run the following commands from a root terminal.
yum install mysql-devel net-snmp net-snmp-devel gnutls-devel openldap-devel curl-devel

cd /usr/src
tar zxvf iksemel-1.4; cd iksemel-1.4
make && make install

7) Now we're ready to install Zabbix. The commands below will walk you through the process.  They build upon each other, and they need the previous steps above to have been completed successfully.  The commands below will install zabbix server and a local agentd.  They'll also set the agent and server to start automatically on boot.  I only guessed at numbering them S71 and S72, and assume you won't have a conflict.  Please note that the commands below are meant to be followed, and not simply cut/paste.  "mysql -p" will ask you for a password, and you'll need to enter it properly!
cd /usr/src/zabbix-1.8.1
mysql -p
create database zabbix character set utf8;
create user zabbix@ identified by '[db password]';
grant all privileges on zabbix.* to zabbix@ with grant option;
cd create/schema
cat mysql.sql | mysql -p zabbix
cd ../data
cat data.sql | mysql -p zabbix
cat images_mysql.sql | mysql -p zabbix
cd ../..
./configure --enable-server --enable-agent --with-mysql --with-net-snmp --with-jabber=/usr/local --with-libcurl --with-ldap
make install
echo "zabbix-agent    10050/tcp           #Zabbix-Agent" >>/etc/services
echo "zabbix-agent    10050/udp           #Zabbix-Agent" >>/etc/services
echo "zabbix-trapper  10051/tcp           #Zabbix-Trapper" >>/etc/services
echo "zabbix-trapper  10051/udp           #Zabbix-Trapper" >>/etc/services
cp misc/init.d/redhat/za* /etc/init.d/
ln -s ../init.d/zabbix_agentd_ctl /etc/rc.d/rc3.d/S71zabbix-agentd
ln -s ../init.d/zabbix_server_ctl /etc/rc.d/rc3.d/S72zabbix-server

8) Make a couple corrections to /etc/init.d/zabbix_agentd_ctl and /etc/init.d/zabbix_server_ctl.  Near the top of both files, they have a line that reads: BASEDIR=/opt/zabbix.  This line needs to be: BASEDIR=/usr/local And in each, just a couple lines later you'll see $BASEDIR/bin/zabbix_ and it needs to be: $BASEDIR/sbin/zabbix_

9) Now we'll configure the agent and server. Zabbix provided heavily commented files in /usr/src/zabbix-1.8.1/misc/conf which are a great reference.
 /etc/zabbix/zabbix_agentd.conf /etc/zabbix/zabbix_server.conf
 SourceIP=[IP of LAN adapter]
 Server=[IP of LAN adapter]
 DBPassword=[db password]
 ListenIP=[IP of LAN adapter]

10) I'm guessing this is a bug on zabbix's part, but rather than care I'll just try to work around it.  Despite our config before compile, zabbix is still looking in /usr/lib for the jabber library.  Let's just ln -s /usr/local/lib/ /usr/lib/

11)Zabbix will not run as root.  We must add the user through the clearOS admin portal.  If you simply useradd zabbix from the console, I've found that clear has the potential to come behind you and delete the user.  Nice of them to keep the system clean and guarantee the integrity of the web config, but also something that can create unanticipated consequences.
touch /var/log/zabbix_server.log
touch /var/log/zabbix_agentd.log
chown zabbix:allusers /var/log/zabbix*

12) Let's add in the webserver and php modules from ClearOS GUI if you don't already have them.  Go to Clear Center -> Software Modules.  Ensure you have "web server module" and "php module."  Browse to Server -> Web Server and click "to auto" and "start."  If your ClearOS is a gateway (not stand-alone), and you want to allow external access to zabbix, you'll need to add the "HTTP" service to your "incoming" firewall rules.  Now you can copy in the front-end.
cp -R /usr/src/zabbix-1.8.1/frontends/php/* /var/www/html/
mv /var/www/html/index.html /var/www/html/index.clear
you could browse to your zabbix install now by going to http://[IP|domainName of your ClearOS]/ but it wouldn't be worth it because we still need to resolve some things that would fail during zabbix's init checks.  Let's start by resolving a couple more dependencies:
yum install php-bcmath php-gd
Then let's edit /etc/php.ini
 Original /etc/php.ini line:Modified /etc/php.ini line:
 max_execution_time = 30
 memory_limit = 16M
 post_max_size = 8M
 ;date.timezone =
 mbstring.func_overload =
 max_execution_time = 600
 memory_limit = 256M
 post_max_size = 32M
 date.timezone = America/New_York
 mbstring.func_overload = 2
And then restart the web server from the ClearOS admin portal.  Now you should be good to walk through the zabbix initialization.  Pay attention during the process; all the hard stuff is done, but you still need to complete your configuration by answering the questions it asks!

13) Login and enable LDAP.  To enable LDAP, you'll need to add a user to zabbix, which will define their access rights to zabbix.  LDAP is only used for authentication purposes.  You just need to match up a few settings between Zabbix and ClearOS; all the information you need can be found under the Directory -> Domain and LDAP section.

14) GoogleTalk alerts.  Zabbix jabber integration does not look capable of communicating across google talk servers.  I found a relevant perl example that enables sending of messages from a gmail account (CANNOT originate from google apps account), and allows sending to any google account (gmail or apps).  The final limitation is that you must first login as the gmail user from which the jabbers will originate, and add people to whom you want to be able to send chats.  This process will prompt the recipient with an option allowing you to chat with them.  Here's the site:

Have Fun!  Zabbix is a fantastic utility.  It does take quite a bit of effort to configure a system properly, but once configured, it provides a efficient system for monitoring many details of PCs/Servers/devices that would otherwise likely be overlooked!