Install Zabbix Agent on FreeBSD 8.2

Check FreeBSD version:
uname -a
Check if gcc compiler is installed:
pkg_info | grep gcc
gcc-4.6.3.20111111  GNU Compiler Collection 4.6
add zabbix user:
# adduser
 Username: zabbix
 Full name: zabbix agent
 Uid (Leave empty for default):
 Login group [zabbix]:
 Login group is zabbix. Invite zabbix into other groups? []:
 Login class [default]:
 Shell (sh csh tcsh bash rbash nologin) [sh]: bash
 Home directory [/home/zabbix]:
 Home directory permissions (Leave empty for default):
 Use password-based authentication? [yes]:
 Use an empty password? (yes/no) [no]:
 Use a random password? (yes/no) [no]:
 Enter password:
 Enter password again:
 Lock out the account after creation? [no]:
 Username   : zabbix
 Password   : *****
 Full Name  : zabbix agent
 Uid        : 1002
 Class      :
 Groups     : zabbix
 Home       : /home/zabbix
 Home Mode  :
 Shell      : /usr/local/bin/bash
 Locked     : no
 OK? (yes/no): yes
 adduser: INFO: Successfully added (zabbix) to the user database.
 Add another user? (yes/no): no
 Goodbye!
Download zabbix package from:https://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/

Use WinSCP to push package from windows to FreeBSD /root

Unpack archive:
tar zxvf zabbix-2.4.5.tar.gz
Move to source:
cd zabbix-2.4.5
Set zabbix-agent component as neccessary (this will take minute to complete):
./configure --enable-agent
At the end the output will say:
Configuration:

  Detected OS:           freebsd8.2
  Install path:          /usr/local
  Compilation arch:      freebsd

  Compiler:              gcc
  Compiler flags:        -g -O2   -I/usr/local/include

  Enable server:         no

  Enable proxy:          no

  Enable agent:          yes
  Agent details:
    Linker flags:           -L/usr/local/lib
    Libraries:             -lkvm -lm -ldevstat   -liconv

  Enable Java gateway:   no

  LDAP support:          no
  IPv6 support:          no

***********************************************************
*            Now run 'make install'                       *
*                                                         *
*            Thank you for using Zabbix!                  *
*              < https://www.zabbix.com >                 *
***********************************************************
Compile agent (this will take two minutes or so):
make
Install agent:
make install
Copy startup service:
cp ./misc/init.d/freebsd/zabbix_agentd /usr/local/etc/rc.d/zabbix_agentd
Set startup service executable:
chmod 755 /usr/local/etc/rc.d/zabbix_agentd
Modify few lines in zabbix_agentd.conf:
vi /usr/local/etc/zabbix_agentd.conf
PidFile=/var/run/zabbix_agentd.pid
LogFile=/var/log/zabbix_agentd.log
Server=here.goes.server.name
Enable zabbix agent:
vi /etc/rc.conf
zabbix_agentd_enable="YES"
Set up firewall rules:
vi /etc/services
zabbix_agent 10050/tcp
zabbix_trap 10051/tcp
Create pid and log file and assign permissions to zabbix:
touch /var/run/zabbix_agentd.pid
chown zabbix /var/run/zabbix_agentd.pid
touch /var/log/zabbix_agentd.log
chown zabbix /var/log/zabbix_agentd.log
Start zabbix agent:
/usr/local/etc/rc.d/zabbix_agentd start
Check if zabbix agent is running:
/usr/local/etc/rc.d/zabbix_agentd status
zabbix_agentd is running as pid 19288 19289 19290 19291 19292.
or:
ps aux | grep zabbix
zabbix 19288  0.0  0.0  4680  1812  ??  I     2:48PM   0:00.00 /usr/local/sbin/zabbix_agentd
zabbix 19289  0.0  0.0  4680  2060  ??  S     2:48PM   0:00.18 zabbix_agentd: collector [idle 1 sec] (zabbix_agentd)
zabbix 19290  0.0  0.0  4680  2080  ??  S     2:48PM   0:00.07 zabbix_agentd: listener #1 [waiting for connection] (zabbix_agentd)
zabbix 19291  0.0  0.0  4680  2036  ??  S     2:48PM   0:00.08 zabbix_agentd: listener #2 [waiting for connection] (zabbix_agentd)
zabbix 19292  0.0  0.0  4680  2048  ??  S     2:48PM   0:00.07 zabbix_agentd: listener #3 [waiting for connection] (zabbix_agentd)
Check is log is normal:
cat /var/log/zabbix_agentd.log
 19288:20150526:144832.655 Starting Zabbix Agent [www.catonrug.net]. Zabbix 2.4.5 (revision 53282).
 19288:20150526:144832.655 using configuration file: /usr/local/etc/zabbix_agentd.conf
 19288:20150526:144832.655 agent #0 started [main process]
 19289:20150526:144832.655 agent #1 started [collector]
 19290:20150526:144832.655 agent #2 started [listener #1]
 19291:20150526:144832.655 agent #3 started [listener #2]
 19292:20150526:144832.656 agent #4 started [listener #3]

No comments: