User Tools

Site Tools


networking:monitoring:zabbix

Zabbix NMS Notes

Install Server

sudo apt-get update
sudo apt-get install apache2 mysql-server php5 php5-cli php5-common php5-mysql snmp snmp-mibs-downloader \
  smistrip nmap traceroute

reboot
vim /etc/php5/apache2/php.ini

date.timezone = 'America/Phoenix'
wget http://repo.zabbix.com/zabbix/2.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_2.4-1+trusty_all.deb
sudo dpkg -i zabbix-release_2.4-1+trusty_all.deb
sudo apt-get update
sudo apt-get install zabbix-server-mysql zabbix-frontend-php zabbix-agent
echo "zabbix ALL=(ALL:ALL) NOPASSWD:/usr/bin/nmap" >> /etc/sudoers
sudo service apache2 restart && sudo service zabbix-server restart
http://<hostname or IP>/zabbix

:!: For the database step, use the dbname, username and password you created during install (e.g. zabbix, zabbix and the password you created).

:!: The default credentials are admin and zabbix. Change the admin password!

Firewall

Zabbix communications are all TCP based by default. They are configurable in the zabbix_agentd.conf, for the Agent, and zabbix_server.conf for the server.

:!: If you change the port in the zabbix_agentd.conf file, you will also need to change the specific host entries in the UI.

Port Note
162 For Server, SNMP, Server Inbound
161 For Server, SNMP, Server Outbound
10050 For Agent, Server To Agent port, Server Outbound
10051 For Server, Agent To Server port, Server Inbound

:!: The server runs an agent too, so we allow both.

IPtables Firewall

Server

vim /etc/sysconfig/iptables

-A INPUT -p udp -m udp --dport 162 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 10051 -j ACCEPT

Agent

vim /etc/sysconfig/iptables

-A INPUT -m state --state NEW -m tcp -p tcp --dport 10050 -j ACCEPT
service iptables restart

CSF Firewall

Zabbix Server

Zabbix Agent

csf.allow
tcp|in|d=10050|s=10.10.1.100   # From Zabbix Server
tcp|out|d=10051|d=10.10.1.100  # To Zabbix Server

Agents

For normal communications (not 'active'), you must forward port 10050 on the remote NAT firewall device to the monitored host.
If you have multiple monitored hosts behind a remote NAT firewall, you must use Active mode on the agent or (on the remote NAT firewall device) forward additional ports (10051, etc.) in to port 10050 of the additional monitored hosts and adjust the ports defined for the additional monitored hosts in the Zabbix web interface.

Active Agents

https://support.opennodecloud.com/wiki/doku.php?id=usrdoc:os:zabbix

  • Active agents initiate all communications to server
  • No port forwarding required at client
  • Multiple monitored hosts behind remote NAT firewall
  • Lower resource utilization on server
  • Modify the host on server
    • IP address must be set to 0.0.0.0
    • All Items must be configured as Zabbix Agent (active)
      • Generally by cloning templates
        • See link above
  • The configuration file is slightly different
    • Set ServerActive to the IP address of the Zabbix server

Install Agents

:!: Install the zabbix-agent on the Zabbix server as well.

Modify the firewall to allow incoming tcp/10050 and edit the agent configuration file before starting the service.

Modify the agent configuration file:

vim /etc/zabbix/zabbix_agentd.conf

Server=<Zabbix Server IP>
#ServerActive=127.0.0.1
Hostname=<Monitored Host ID>

Configure the agent to auto-start, start the service and check the firewall:

chkconfig zabbix-agent on
service zabbix-agent start

ps ax|grep zabbix
netstat -tapn|grep 1005
iptables -nL |grep 1005

Windows

http://tecadmin.net/install-zabbix-agent-windows-system/

http://www.zabbix.com/downloads/2.4.4/zabbix_agents_2.4.4.win.zip

Download and extract the Windows agent to C:\Support.

:!: You can use Wordpad as the editor, but turn word-wrap off. Use Notepad thereafter.

Edit C:\Support\zabbix_agents_2.4.4.win\conf\zabbix_agentd.win.conf:

Server=<Zabbix Server IP>
#ServerActive=127.0.0.1
Hostname=<exact-Zabbix-host-name>

In an administrative (elevated) command prompt (not PowerShell):

cd C:\Support\zabbix_agents_2.4.4.win\bin\win64
.\zabbix_agentd.exe --config C:\support\zabbix_agents_2.4.4.win\conf\zabbix_agentd.win.conf --install
net start "Zabbix Agent"
sc config "Zabbix Agent" start= auto
netsh advfirewall firewall add rule name="Zabbix Agent" dir=in action=allow protocol=TCP localport=10050
Uninstall
net stop "Zabbix Agent"
cd C:\Support\zabbix_agents_2.4.4.win\bin\win64
.\zabbix_agentd.exe --config C:\support\zabbix_agents_2.4.4.win\conf\zabbix_agentd.win.conf -d
netsh advfirewall firewall delete rule name="Zabbix Agent"

Ubuntu

CentOS

CentOS 5 x86
rpm -Uvh http://repo.zabbix.com/zabbix/2.4/rhel/5/i386/zabbix-release-2.4-1.el5.noarch.rpm
yum install zabbix zabbix-agent
CentOS 6 x64
rpm -Uvh http://repo.zabbix.com/zabbix/2.4/rhel/6/x86_64/zabbix-release-2.4-1.el6.noarch.rpm
yum install zabbix zabbix-agent

:!: Modify the firewall, edit the config file then start the agent service.

SME Server

SME 9 x64 (CentOS 6 Base)
config set zabbix-agent service TCPPort 10050 access public status enabled
signal-event remoteaccess-update

rpm -Uvh http://repo.zabbix.com/zabbix/2.4/rhel/6/x86_64/zabbix-release-2.4-1.el6.noarch.rpm
mv /etc/yum.repos.d/zabbix.repo /etc/yum.smerepos.d/

yum install zabbix zabbix-agent

chkconfig zabbix-agent on

/etc/init.d/zabbix-agent start
If you have problems getting the agent to auto-start after a reboot, a quick way to fix is to add a line to rc.local.
vim /etc/rc.local

/etc/rc4.d/S86zabbix-agent start
SME 8 x64 (CentOS 5 Base)
config set zabbix-agent service TCPPort 10050 access public status enabled
signal-event remoteaccess-update

rpm -Uvh http://repo.zabbix.com/zabbix/2.4/rhel/5/x86_64/zabbix-release-2.4-1.el5.noarch.rpm
mv /etc/yum.repos.d/zabbix.repo /etc/yum.smerepos.d/

yum install zabbix zabbix-agent

chkconfig zabbix-agent on
ln -s /etc/rc.d/init.d/zabbix-agent /etc/rc7.d/S87zabbix-agent

service zabbix-agent start

Add a Host to Monitor

SNMP

http://www.zabbix.org/wiki/Start_with_SNMP_traps_in_Zabbix

  • Listening port is usually 161/UDP
  • Use SNMP version 2c if possible
    • Will show more info
  • Template SNMP Device will often suffice
  • Set the community string per host
    • Like a password
    • Defined with macro {$SNMP_COMMUNITY}

Test Access

:!: 2c is SNMP version.

snmpwalk -v 2c -c <community> <remoteIP> .

Add Host

:!: Set the SNMP community string (like a password) for each host by adding a macro {$SNMP_COMMUNITY} with the value being the community string for the host to be monitored.

Add SNMP Host

Mikrotik

https://github.com/YSmetana/zabbix-mikrotik-snmp

  1. In Zabbix, Add a Host
    1. Add a host group too, if not already created
    2. Use UDP port 161
  2. Assign the SNMP IP address and community string
    1. 'public' may be OK if no external access
    2. Otherwise, assign another community string
      1. A community string is a bit like a 'password'

Troubleshooting

This test should connect, then close when you hit <enter>:

telnet <IP of agent> 10050

:!: When importing templates, be sure to import the 'raw' or pure XML file, not an HTML file from a web page.

Zimbra

networking/monitoring/zabbix.txt · Last modified: 2016/09/29 15:00 by gcooper