Install Zabbix Proxy 2.0 on CentOS 6

I recently ordered a VPS in Los Angeles for some testing - at $11 / month with 3 IP addresses, it came with CentOS 6. The testing is for some SIP stuff - but I'd like to know how the system performs. It is the first VPS I've used that uses openvz. For less than a carton of beer, I can get 3 months of testing on someone else's hardware!!

Prerequisites

You may want to set up the Administration->DM first for the Proxy in zabbix's web interface. Once this is done, configure the agent/host (for this blog post, lightswitch.mrvoip.com.au) - I have not configured the server - you will see similar configuration errors if you don't do this!! You have been warned.
My prerequisites are quite minimal - sqlite3 is fine for me, some SNMP and curl.

yum install net-snmp-devel curl-devel gcc make sqlite sqlite-devel

Configure Zabbix Proxy 2.0 & Zabbix Agent 2.0

This is a release candidate. I'm using all their RC for testing.

./configure --enable-proxy --enable-agent --with-libcurl --with-net-snmp --with-sqlite3  --prefix=/opt/zabbix
make
make install

Zabbix User and Permissions

Create a user and group for zabbix
groupadd zabbix
useradd -c 'Zabbix' -d /home/zabbix -g zabbix -s /bin/bash zabbix
chown -R zabbix:zabbix /opt/zabbix

Init Scripts

The source distribution comes with init scripts for most distros in misc/init.d/ - copy what you need and make slight changes. The proxy init script is just a copy of the agent init script - renamed.

cp misc/init.d/redhat/zabbix_agentd_ctl /etc/init.d/zabbix_agentd
cp misc/init.d/redhat/zabbix_agentd_ctl /etc/init.d/zabbix_proxy
 
In the proxy init script, just use sed to replace every instance of agentd with proxy

sed -i s/agentd/proxy/g /etc/init.d/zabbix_proxy
chmod a+x /etc/init.d/zabbix_proxy
chkconfig zabbix_proxy on
 
Also adjust the value for the PID file to your settings in the next section - otherwise when you go to stop the services they won't!

#INIT SCRIPT AGENT PID
PIDFILE=/opt/zabbix/log/zabbix_agentd.pid #INIT SCRIPT PROXY PID
PIDFILE=/opt/zabbix/log/zabbix_proxy.pid

Customisations of Zabbix Proxy - Secure Communications

Because this box will be relaying it's info from LA back to a machine in Sydney, it will use stunnel for a secure connection. Read the reference blog post on how to configure stunnel for secure proxy communication.
Some changes to the /opt/zabbix/etc/zabbix_proxy.conf file were

Server=127.0.0.1
ServerPort=10052
Hostname=LA Proxy
ListenPort=10051
LogFile=/opt/zabbix/log/zabbix_proxy.log
PidFile=/opt/zabbix/log/zabbix_proxy.pid
DBName=/opt/zabbix/zabbix.db
ListenIP=127.0.0.1

Start Zabbix Proxy

Without configuring stunnel, this is the output from the log - not the connection refused to 127.0.0.1:10052
 3683:20120429:161628.496 proxy #8 started [poller #5]
  3682:20120429:161628.515 proxy #7 started [poller #4]
  3680:20120429:161628.540 proxy #5 started [poller #2]
  3693:20120429:161628.556 proxy #18 started [discoverer #1]
  3684:20120429:161628.564 proxy #9 started [unreachable poller #1]
  3676:20120429:161628.575 Unable to connect to the server [127.0.0.1]:10052 [cannot connect to [[127.0.0.1]:10052]: [111] Connection refused]. Will retry every 120 second(s)
  3691:20120429:161628.626 Deleted 0 records from history [0.005586 seconds]

Configure stunnel

Read the references section for the stunnel HOWTO.
Then start zabbix_proxy

Zabbix Agentd 2.0

Having changed the proxy settings above to listen on 10051 and relay back to the server on 10052, the zabbix agentd configuration out of the box is nearly ready to go.
LogFile=/opt/zabbix/log/zabbix_agentd.log
PidFile=/opt/zabbix/log/zabbix_agentd.pid
Hostname=lightswitch.mrvoip.com.au
ListenIP=127.0.0.1

Start Zabbix Agentd 2.0

Start with the init script - out of the box it works!
chmod a+x /etc/init.d/zabbix_agentd.conf
chkconfig zabbix_agentd on
/etc/init.d/zabbix_agentd start
Here is what it looks like having NOT configured the server end (which should be expecting the zabbix agentd)
 3851:20120429:165044.795 Starting Zabbix Agent [lightswitch.mrvoip.com.au]. Zabbix 2.0.0rc3 (revision 26994).
  3852:20120429:165044.796 agent #0 started [collector]
  3853:20120429:165044.796 agent #1 started [listener]
  3854:20120429:165044.796 agent #2 started [listener]
  3855:20120429:165044.796 agent #3 started [listener]
  3856:20120429:165044.797 agent #4 started [active checks]
  3856:20120429:165044.798 No active checks on server: host [lightswitch.mrvoip.com.au] not found
Better go and configure the server!

Nhận xét

Bài đăng phổ biến từ blog này

CLEANING UP THE ZABBIX DATABASE

Configuring DHCP Relay service on the FortiGate unit

WAN link load balancing