Install Zabbix Server + CentOS 6.2 (64 bit)
[root@imonitor-lr ~]# rpm -Uvh http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/6/x86_64/epel-release-6-7.noarch.rpm
Retrieving http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/6/x86_64/epel-release-6-7.noarch.rpm
warning: /var/tmp/rpm-tmp.tFsRI4: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing... ########################################### [100%]
1:epel-release ########################################### [100%]
[root@imonitor-lr ~]#
- FROM EPEL Repos
# yum --enablerepo=epel -y install zabbix-server-mysql zabbix-agent zabbix-web-mysql
**** Do update /etc/my.cnf
innodb_file_per_table=1
Reason
[InnoDB tables currently store data and indexes into a shared tablespace (/var/lib/mysql/ibdata1). Due to the shared tablespace, data corruption for one InnoDB table can result in MySQL failing to start up on the entire machine. Repairing InnoDB corruption can be extremely difficult to perform and can result in data loss for tables that were not corrupted originally during that repair process.
Since MySQL 5.5 will be using InnoDB as the default storage engine, it is important to consider the consequences of continuing to utilize the shared tablespace in /var/lib/mysql/ibdata1
Changing to per-table tablespace with innodb_file_per_table
As an option to resolve the issue, MySQL has a configuration variable called innodb_file per_table. To use this variable, the following could be placed into /etc/my.cnf to convert InnoDB to a per table file for each InnoDB engine table:innodb_file_per_table=1 ]
#cd /usr/share/doc/zabbix-server-mysql-*/create/schema
# line 440: change to Zabbix recomended
max_execution_time =
600
# line 449: change to Zabbix recomended
max_input_time =
600
# line 457: change to Zabbix recomended
memory_limit =
256M
# line 729: change to Zabbix recomended
post_max_size =
32M
# line 878: change to Zabbix recomended
upload_max_filesize =
16M
# line 946: uncomment and add your timezone
date.timezone =
Asia/Calcutta # whatever your timezone is
[root@imonitor ~]#
/etc/rc.d/init.d/zabbix-server start
Starting ZABBIX server:
[ OK ]
[root@imonitor ~]#
/etc/rc.d/init.d/zabbix-agent start
Starting ZABBIX agent:
[ OK ]
[root@imonitor ~]#
/etc/rc.d/init.d/httpd restart
Stopping httpd:
[ OK ]
Starting httpd:
[ OK ]
[root@imonitor ~]#
chkconfig zabbix-server on
[root@imonitor ~]#
chkconfig zabbix-agent on
Install the Zabbix Agent only on CentOS 6.2 by YUM (On other Linux Hosts)
For 64 bit
rpm -Uvh http://mirror.cse.iitk.ac.in/fedora//epel/6/x86_64/epel-release-6-7.noarch.rpm
** if this does not work then browse/check the appropriate revision of epel-release-6-7.noarch.rpm on the site.
yum install zabbix-agent
For 32 Bit
rpm -Uvh http://mirror.cse.iitk.ac.in/fedora//epel/6/i386/epel-release-6-5.noarch.rpm
Install the Zabbix Agent only on CentOS 6.2 from Source
Download the Zabbix from the zabbix.com/download
# mkdir /etc/zabbix
wget http://prdownloads.sourceforge.net/zabbix/zabbix-1.8.11.tar.gz
tar -xzvf zabbix-1.8.11.tar.gz
cd zabbix-1.8.11
./configure --enable-agent
-------------------------------------------
Configuration:
Detected OS: linux-gnu
Install path: /usr/local
Compilation arch: linux
Compiler: gcc
Compiler flags: -g -O2
Enable server: no
Enable proxy: no
Enable agent: yes
Agent details:
Linker flags: -rdynamic
Libraries: -lm -lresolv
LDAP support: no
IPv6 support: no
***********************************************************
* Now run 'make install' *
* *
* Thank you for using Zabbix! *
* *
***********************************************************
-----------------------------------------------------
make install
make clean
#useradd -m -s /bin/bash zabbix
mkdir /etc/zabbix
cp misc/conf/zabbix_agentd.conf /etc/zabbix
vim /etc/zabbix/zabbix_agentd.conf
change the below two files as
Server=[IP address or Name of your zabbix Server]
Hostname=[Host Name of your agent machine]
cp misc/init.d/redhat/8.0/zabbix_agentd /etc/init.d/
vim /etc/init.d/zabbix_agentd
change the progdir to progdir=”/usr/local/sbin/”
#progdir="/usr/local/zabbix/bin/"
progdir="/usr/local/sbin/"
- Add the following lines in /etc/services:
#echo "zabbix_agent 10050/tcp" >> /etc/services
#chkconfig --add zabbix_agentd
#chkconfig --level 35 zabbix_agentd on
#chmod 755 /etc/init.d/zabbix_agentd
[root@ZagentMachine init.d]# service zabbix_agentd start
Starting zabbix_agentd: [ OK ]
Confirm if this is running
[root@ZagentMachine init.d]# ps -C zabbix_agentd
PID TTY TIME CMD
528 ? 00:00:00 zabbix_agentd
530 ? 00:00:00 zabbix_agentd
531 ? 00:00:00 zabbix_agentd
532 ? 00:00:00 zabbix_agentd
533 ? 00:00:00 zabbix_agentd
534 ? 00:00:00 zabbix_agentd
Now configure the Zabbix Server from the web for this agent...
Configuration>host>create host>
Name [name of the host you want to monitor]
Choose the group you want to put it in
Link it to the template Linux as this is agent installed on the linux box.
check the profile box and put some information about the machine , after this the machine will also be visible in the inventory tab.
Install a windows agent for zabbix
visit the below site and download the agent.
http://www.suiviperf.com/zabbix/index.php
Install them as per the architecture of your machine. [32 Bit or 64 Bit]
http://
Administration -> Media Types -> Email
Give it a name (Template_CentOS_HTTP)
In Templates group
Configuration -> Templates -> Template_CentOS_HTTP -> Items
Create Item
Host: Template_CentOS_HTTP
Description: HTTP Basic Check
Type: Simple_check
Key: http,80
Configuration -> Templates -> Template_CentOS_HTTP -> Triggers
Create Trigger
Name: "HTTP Trigger"
Expression: {Template_CentOS_HTTP:http,80.last(0)}#1
Severity: High
Configuration -> Actions ->
Create Action
name: Email notifications
Event source: triggers
Default Subject: add "{HOST.DNS}:" to the beginning
Default message: add "{HOST.DNS}:" to the beginning
Conditions: make host have to be from "Linux Servers" hostgroup, and Template_CentOS_HTTP:HTTP trigger" is not 1
Email affected users
Note:
/etc/my.cnf file sample
** Use tmpfs filesystem for Temporary Files
Using memory instead of local disks will allow a much faster creation of temporary tables on MySQL.
First, create the mountpoint:
mkdir /tmp/mysqltmp
Add this line in your /etc/fstab:
tmpfs /tmp/mysqltmp tmpfs rw,uid=mysql,gid=mysql,size=1G,nr_inodes=10k,mode=0700 0 0
Finally, you need to define this path in /etc/my.cnf and restart MySQL:
tmpdir = /tmp/mysqltmp
===========================
To find out if any item is supported by the zabbix or not use the zabbix_get command from the server
For example to calculate the percent disk space used by the c drive in windows , run the below command.
[aqua~]# zabbix_get -s -k vfs.fs.size[c:,pfree]
77.957042
note: while creating an item here choose "numeric float" instead of "numeric unassigned"
Or to know the free disk space in c drive
[root@aqua ~]# zabbix_get -s 10.10.10.33 -k vfs.fs.size[c:,free]
56677367296
[root@aqua ~]# zabbix_get -s 10.10.10.33 -k system.cpu.load[,avg15]
0.172222
[root@imonitor-lr ~]# rpm -Uvh http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/6/x86_64/epel-release-6-7.noarch.rpm
Retrieving http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/6/x86_64/epel-release-6-7.noarch.rpm
warning: /var/tmp/rpm-tmp.tFsRI4: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing... ########################################### [100%]
1:epel-release ########################################### [100%]
[root@imonitor-lr ~]#
- FROM EPEL Repos
# yum --enablerepo=epel -y install zabbix-server-mysql zabbix-agent zabbix-web-mysql
**** Do update /etc/my.cnf
innodb_file_per_table=1
Reason
[InnoDB tables currently store data and indexes into a shared tablespace (/var/lib/mysql/ibdata1). Due to the shared tablespace, data corruption for one InnoDB table can result in MySQL failing to start up on the entire machine. Repairing InnoDB corruption can be extremely difficult to perform and can result in data loss for tables that were not corrupted originally during that repair process.
Since MySQL 5.5 will be using InnoDB as the default storage engine, it is important to consider the consequences of continuing to utilize the shared tablespace in /var/lib/mysql/ibdata1
Changing to per-table tablespace with innodb_file_per_table
As an option to resolve the issue, MySQL has a configuration variable called innodb_file per_table. To use this variable, the following could be placed into /etc/my.cnf to convert InnoDB to a per table file for each InnoDB engine table:innodb_file_per_table=1 ]
#cd /usr/share/doc/zabbix-server-mysql-*/create/schema
shell> mysql -u'username' -p'password'
mysql> create database zabbix character set utf8;
mysql> quit;
shell> cd create/schema
shell> cat mysql.sql | mysql -u'username' -p'password' zabbix
shell> cd ../data
shell> cat data.sql | mysql -u'username' -p'password' zabbix
shell> cat images_mysql.sql | mysql -u'username' -p'password' zabbix
FLUSH PRIVILEGES;
in vim /etc/php.init
# line 440: change to Zabbix recomended
max_execution_time =
600
# line 449: change to Zabbix recomended
max_input_time =
600
# line 457: change to Zabbix recomended
memory_limit =
256M
# line 729: change to Zabbix recomended
post_max_size =
32M
# line 878: change to Zabbix recomended
upload_max_filesize =
16M
# line 946: uncomment and add your timezone
date.timezone =
Asia/Calcutta # whatever your timezone is
[root@imonitor ~]#
/etc/rc.d/init.d/zabbix-server start
Starting ZABBIX server:
[ OK ]
[root@imonitor ~]#
/etc/rc.d/init.d/zabbix-agent start
Starting ZABBIX agent:
[ OK ]
[root@imonitor ~]#
/etc/rc.d/init.d/httpd restart
Stopping httpd:
[ OK ]
Starting httpd:
[ OK ]
[root@imonitor ~]#
chkconfig zabbix-server on
[root@imonitor ~]#
chkconfig zabbix-agent on
Install the Zabbix Agent only on CentOS 6.2 by YUM (On other Linux Hosts)
For 64 bit
rpm -Uvh http://mirror.cse.iitk.ac.in/fedora//epel/6/x86_64/epel-release-6-7.noarch.rpm
** if this does not work then browse/check the appropriate revision of epel-release-6-7.noarch.rpm on the site.
yum install zabbix-agent
After Installing the zabbix agent it is a good idea for disable the EPEL repository
#perl -npi -e
's/enabled=1/enabled=0/'
/etc/yum.repos.d/epel.repo
For 32 Bit
rpm -Uvh http://mirror.cse.iitk.ac.in/fedora//epel/6/i386/epel-release-6-5.noarch.rpm
Install the Zabbix Agent only on CentOS 6.2 from Source
Download the Zabbix from the zabbix.com/download
# mkdir /etc/zabbix
wget http://prdownloads.sourceforge.net/zabbix/zabbix-1.8.11.tar.gz
tar -xzvf zabbix-1.8.11.tar.gz
cd zabbix-1.8.11
./configure --enable-agent
-------------------------------------------
Configuration:
Detected OS: linux-gnu
Install path: /usr/local
Compilation arch: linux
Compiler: gcc
Compiler flags: -g -O2
Enable server: no
Enable proxy: no
Enable agent: yes
Agent details:
Linker flags: -rdynamic
Libraries: -lm -lresolv
LDAP support: no
IPv6 support: no
***********************************************************
* Now run 'make install' *
* *
* Thank you for using Zabbix! *
*
***********************************************************
-----------------------------------------------------
make install
make clean
#useradd -m -s /bin/bash zabbix
mkdir /etc/zabbix
cp misc/conf/zabbix_agentd.conf /etc/zabbix
vim /etc/zabbix/zabbix_agentd.conf
change the below two files as
Server=[IP address or Name of your zabbix Server]
Hostname=[Host Name of your agent machine]
cp misc/init.d/redhat/8.0/zabbix_agentd /etc/init.d/
vim /etc/init.d/zabbix_agentd
change the progdir to progdir=”/usr/local/sbin/”
#progdir="/usr/local/zabbix/bin/"
progdir="/usr/local/sbin/"
- Add the following lines in /etc/services:
zabbix-agent 10050/tcp # Zabbix Agent
zabbix-agent 10050/udp # Zabbix Agent
zabbix-trapper 10051/tcp # Zabbix Trapper
zabbix-trapper 10051/udp # Zabbix Trapper
e.g
#echo "zabbix_agent 10050/tcp" >> /etc/services
#echo "zabbix_server 10051/tcp" >> /etc/services
#chkconfig --add zabbix_agentd
#chkconfig --level 35 zabbix_agentd on
#chmod 755 /etc/init.d/zabbix_agentd
[root@ZagentMachine init.d]# service zabbix_agentd start
Starting zabbix_agentd: [ OK ]
Confirm if this is running
[root@ZagentMachine init.d]# ps -C zabbix_agentd
PID TTY TIME CMD
528 ? 00:00:00 zabbix_agentd
530 ? 00:00:00 zabbix_agentd
531 ? 00:00:00 zabbix_agentd
532 ? 00:00:00 zabbix_agentd
533 ? 00:00:00 zabbix_agentd
534 ? 00:00:00 zabbix_agentd
Now configure the Zabbix Server from the web for this agent...
Configuration>host>create host>
Name [name of the host you want to monitor]
Choose the group you want to put it in
Link it to the template Linux as this is agent installed on the linux box.
check the profile box and put some information about the machine , after this the machine will also be visible in the inventory tab.
Install a windows agent for zabbix
visit the below site and download the agent.
http://www.suiviperf.com/zabbix/index.php
Install them as per the architecture of your machine. [32 Bit or 64 Bit]
http://
Administration -> Media Types -> Email
- Setup server, helo, email from address
- Setup each user who'll get notified, make sure they have media type "Email" added with their address
- In Linux Servers hostgroup
- Define dns name, ip, connect by IP
- If the machine is a simple networking device that will only be monitored using SNMP, add it to Template_SNMPv2_Device, and you're done.
Give it a name (Template_CentOS_HTTP)
In Templates group
Configuration -> Templates -> Template_CentOS_HTTP -> Items
Create Item
Host: Template_CentOS_HTTP
Description: HTTP Basic Check
Type: Simple_check
Key: http,80
Configuration -> Templates -> Template_CentOS_HTTP -> Triggers
Create Trigger
Name: "HTTP Trigger"
Expression: {Template_CentOS_HTTP:http,80.last(0)}#1
Severity: High
Configuration -> Actions ->
Create Action
name: Email notifications
Event source: triggers
Default Subject: add "{HOST.DNS}:" to the beginning
Default message: add "{HOST.DNS}:" to the beginning
Conditions: make host have to be from "Linux Servers" hostgroup, and Template_CentOS_HTTP:HTTP trigger" is not 1
Email affected users
Note:
/etc/my.cnf file sample
[mysqld]
# paths
datadir = /var/lib/mysql/data
tmpdir = /tmp/mysqltmp
# network
connect_timeout = 60
wait_timeout = 28800
max_connections = 2048
max_allowed_packet = 64M
max_connect_errors = 1000
# limits
tmp_table_size = 512M
max_heap_table_size = 256M
table_cache = 512
# logs
log_error = /var/log/mysql/mysql-error.log
slow_query_log_file = /var/log/mysql/mysql-slow.log
slow_query_log = 1
long_query_time = 20
# innodb
innodb_data_home_dir = /var/lib/mysql/data
innodb_data_file_path = ibdata1:128M;ibdata2:128M:autoextend:max:4096M
innodb_file_per_table = 1
innodb_status_file = 1
innodb_additional_mem_pool_size = 128M
innodb_buffer_pool_size = 14G
innodb_flush_method = O_DIRECT
innodb_io_capacity = 2000
innodb_flush_log_at_trx_commit = 2
innodb_support_xa = 0
innodb_log_file_size = 512M
innodb_log_buffer_size = 128M
# experimental
innodb_stats_update_need_lock = 0
# other stuff
event_scheduler = 1
query_cache_type = 0
** Use tmpfs filesystem for Temporary Files
Using memory instead of local disks will allow a much faster creation of temporary tables on MySQL.
First, create the mountpoint:
mkdir /tmp/mysqltmp
Add this line in your /etc/fstab:
tmpfs /tmp/mysqltmp tmpfs rw,uid=mysql,gid=mysql,size=1G,nr_inodes=10k,mode=0700 0 0
Finally, you need to define this path in /etc/my.cnf and restart MySQL:
tmpdir = /tmp/mysqltmp
===========================
To find out if any item is supported by the zabbix or not use the zabbix_get command from the server
For example to calculate the percent disk space used by the c drive in windows , run the below command.
[aqua~]# zabbix_get -s
77.957042
note: while creating an item here choose "numeric float" instead of "numeric unassigned"
Or to know the free disk space in c drive
[root@aqua ~]# zabbix_get -s 10.10.10.33 -k vfs.fs.size[c:,free]
56677367296
[root@aqua ~]# zabbix_get -s 10.10.10.33 -k system.cpu.load[,avg15]
0.172222