1. Download agent package,
#wget http://www.zabbix.com/downloads/1.8.5/zabbix_agents_1.8.5.linux2_6.amd64.tar.gz
2. Abstract agent package
#tar zxvf zabbix_agents_1.8.5.linux2_6.amd64.tar.gz
3. Copy files to destination directory
#cp bin/zabbix_get /usr/bin/
#cp bin/zabbix_sender /usr/bin/
#cp sbin/zabbix_agent /usr/sbin/
#cp sbin/zabbix_agentd /usr/sbin/
4. create zabbix folder
#mkdir /etc/zabbix
#cp conf/zabbix_agent* /etc/zabbix/
5. configure agent,
#vi /etc/zabbix/zabbix_agentd.conf
****************************
#LogFile=c:\win32\zabbix_agentd.log
LogFile=/tmp/zabbix_agentd.log
Hostname=mmot
Server=192.168.1.103
ServerPort=10051
ListenPort=10050
ListenIP=192.168.1.112
StartAgents=3
Timeout=3
****************************
6. create /etc/init.d/zabbix-agent
****************************
#! /bin/sh
### BEGIN INIT INFO
# Provides: zabbix-agent
# Required-Start: $local_fs $network
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start zabbix-agent daemon
### END INIT INFO
set -e
NAME=zabbix_agentd
DAEMON=/usr/sbin/$NAME
DESC="Zabbix agent"
test -x $DAEMON || exit 0
DIR=/var/run/zabbix-agent
PID=$DIR/$NAME.pid
RETRY=15
if test ! -d "$DIR"; then
mkdir "$DIR"
chown -R zabbix:zabbix "$DIR"
fi
export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"
# define LSB log_* functions.
. /lib/lsb/init-functions
case "$1" in
start)
log_daemon_msg "Starting $DESC" "$NAME"
start-stop-daemon --oknodo --start --pidfile $PID \
--exec $DAEMON >/dev/null 2>&1
case "$?" in
0) log_end_msg 0 ;;
*) log_end_msg 1; exit 1 ;;
esac
;;
stop)
log_daemon_msg "Stopping $DESC" "$NAME"
start-stop-daemon --oknodo --stop --exec $DAEMON --retry $RETRY
case "$?" in
0) log_end_msg 0 ;;
*) log_end_msg 1; exit 1 ;;
esac
;;
status)
ls -l /proc/`cat $PID`/exe &> /dev/null
if [ $? -eq 0 ]; then
echo "$DESC is running"
exit 0
else
echo "$DESC is NOT running"
exit 1
fi
;;
restart|force-reload)
$0 stop
$0 start
;;
*)
echo "Usage: /etc/init.d/$NAME {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0
****************************
7. start zabbix agent
#/etc/init.d/zabbix-agent start
8. Open iptables 10050 port, and restart iptables
The second way to install zabbix agent on ubuntu server
1. aptitude install zabbix-agent -y
2. alter following items of zabbix_agentd.conf under /etc/zabbix
Server=112.121.148.102 #change to your ip of zabbix server
ServerPort=10051 # zabbix server listening port
Hostname=ubuntu94 #hostname of zabbix agent
ListenPort=10050 #zabbix agent listening port
ListenIP=203.116.138.94 #local public ip of zabbix agent
ListenIP=203.116.138.94 #local public ip of zabbix agent
LogFile=/var/log/zabbix-agent/zabbix_agentd.log
3. restart zabbix agent
# /etc/init.d/zabbix-agent restart
4. open ip of zabbix server and port 10050 of iptables, and restart iptables
vi /etc/sysconfig/iptables
add following two lines:
-A INPUT -s 112.121.148.102 -p tcp -m tcp --dport 10050 -j ACCEPT
-A INPUT -s 112.121.148.102 -p udp -m udp --dport 10050 -j ACCEPT
-A INPUT -s 112.121.148.102 -p udp -m udp --dport 10050 -j ACCEPT
restart iptables
#/etc/init.d/iptables restart
Zabbix Agent installation on Windows server
1. Download zabbix agent package file from http://www.zabbix.com/download.php
2. Create a New Folder named Zabbix under D: , extract zabbix agent package to D:\Zabbix. (You can put everywhere what you want)
3. Setting config file zabbix_agentd.win.conf under D:\Zabbix\conf
Server=112.121.148.102
ListenPort=10050
Hostname=Windows host
4. Install Zabbix agent by running following commands in CMD
D:\Zabbix\bin\win64>zabbix_agentd.exe -c "D:\Zabbix\conf\zabbix_agentd.win.conf" --install
5. Add it to Windows serives
D:\Zabbix\bin\win64>zabbix_agentd.exe -c "D:\Zabbix\conf\zabbix_agentd.win.conf" -s
6. If you want to uninstall it from services, Can run following commands
D:\Zabbix\bin\win64>zabbix_agentd.exe -c "D:\Zabbix\conf\zabbix_agentd.win.conf" -x
D:\Zabbix\bin\win64>zabbix_agentd.exe -c "D:\Zabbix\conf\zabbix_agentd.win.conf" -d
#-c: assign the directory of config file
#-i: install zabbix agent
#-s: start zabbix agent
#-x: stop running of zabbix agent
#-d: uninstall zabbix agent
7. Start zabbix agent
D:\Zabbix\bin\win64>zabbix_agentd.exe -c "D:\Zabbix\conf\zabbix_agentd.win.conf" --start
8. Open both tcp and udp for 10050 of the server firewall
9. Add this server to Zabbix server monitoring.
No comments:
Post a Comment