is required to install on all remote systems needs to be monitor through Zabbix server. The Zabbix Agent collects resource utilization data and applications data on client system and provide such information to Zabbix server on their requests.

There are two types of checks between Zabbix Server and Client.

  • Passive Check : Zabbix Agent sent data to server on their request.
  • Active Check : Zabbix Agent sends data periodically to Server.

After installing zabbix server on your server, Now we are moving to install agent on remote system’s. This article will help you to install zabbix agent on CentOS/RHEL 7/6/5 systems. After completing this step go to next article add Host in Zabbix Server.

Installing Zabbix Agent

Follow the below instructions to install Zabbix Agent on CentOS, RHEL 7/6/5 systems.

Step 1 – Add Required Repository

Before installing Zabbix Agent first configure zabbix yum repository using following commands as per your required version and operating system.

# rpm -ivh http://repo.zabbix.com/zabbix/2.4/rhel/6/x86_64/zabbix-release-2.4-1.el6.noarch.rpm

Step 2 – Install Zabbix Agent

After installing yum repository packages in our system. Now use following command to install Zabbix agent on your Linux system.

# yum install zabbix zabbix-agent

Step 3 – Edit Zabbix Agent Configuration

As zabbix agent has been successfully installed on our remote system. Now we just need to configure zabbix agent by adding zabbix server ip in its configuration file

vim /etc/zabbix/zabbix_agentd.conf

Server=[IP of Zabbix Server]
ServerActive=[IP of Zabbix Server]
Hostname=[use the FQDN of the node where the agent runs]

Step 4 – Restarting Zabbix Agent

After adding zabbix server ip in configuration file, now restart agent service using below command.

# /etc/init.d/zabbix-agent start
# netstat -tulpn|grep zabbix

Step 5 – Test

Finally, in order to test if you can reach Zabbix Agent from Zabbix Server, use Telnet command from Zabbix server machine to the IP addresses of the machines that run the agents:

# telnet zabbix_agent_IP 10050

Step 6 – Add Zabbix Agent Monitored Host to Zabbix Server

read

1. First install Mysql:

vim install_mysql

Insert the following lines:

groupadd mysql
useradd -s /sbin/nologin -g mysql -M mysql
tail -1 /etc/passwd
id mysql
wget ftp://mysql.inspire.net.nz/mysql/Downloads/MySQL-5.5/mysql-5.5.53-linux2.6-x86_64.tar.gz    
tar xf mysql-5.5.53-linux2.6-x86_64.tar.gz
mkdir -p /application/
mv mysql-5.5.53-linux2.6-x86_64 /application/mysql-5.5.53
ln -s /application/mysql-5.5.53/ /application/mysql
ls -l /application/
cd /application/mysql/
ls -l support-files/*.cnf
/bin/cp support-files/my-medium.cnf /etc/my.cnf
mkdir -p /application/mysql/data
chown -R mysql.mysql /application/mysql/
/application/mysql/scripts/mysql_install_db --basedir=/application/mysql --datadir=/application/mysql/data/ --user=mysql
/bin/cp support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld


sed -i 's#/usr/local/mysql#/application/mysql#g' /application/mysql/bin/mysqld_safe /etc/init.d/mysqld

/etc/init.d/mysqld start
netstat -lntup|grep mysql


chkconfig --add mysqld
chkconfig mysqld on
chkconfig --list mysqld

echo 'export PATH=/application/mysql/bin:$PATH' >> /etc/profile
tail -1 /etc/profile
source /etc/profile
echo $PATH

Running command:

source install_mysql
/application/mysql/bin/mysql_secure_installation

2. Installing repository configuration package

Zabbix 2.4 for RHEL6, Oracle Linux 6, CentOS 6:
# rpm -ivh http://mirrors.aliyun.com/epel/6/x86_64/epel-release-6-8.noarch.rpm

rpm -ivh http://repo.zabbix.com/zabbix/2.4/rhel/6/x86_64/zabbix-release-2.4-1.el6.noarch.rpm

Installing Zabbix packages

# yum install zabbix-server-mysql zabbix-web-mysql

Creating initial database

shell> mysql -uroot -p
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
mysql> quit;

Import initial schema and data.

# cd /usr/share/doc/zabbix-server-mysql-2.4.8/create
# mysql -uroot -p zabbix < schema.sql
# mysql -uroot -p zabbix < images.sql
# mysql -uroot -p zabbix < data.sql

Starting Zabbix server process

Edit database configuration in zabbix_server.conf

# vim /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
DBSocket=/tmp/mysql.sock

Start Zabbix server process.

service zabbix-server start

Editing PHP configuration for Zabbix frontend

Apache configuration file for Zabbix frontend is located in /etc/httpd/conf.d/zabbix.conf. Some PHP settings are already configured.

# vim /etc/httpd/conf.d/zabbix.conf
php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
php_value date.timezone Asia/Shanghai

It’s necessary to uncomment the “date.timezone” setting and set the right timezone for you. After changing the configuration file restart the apache web server.

# service httpd restart

Zabbix frontend is available at http://zabbix-frontend-hostname/zabbix in the browser. Default username/password is Admin/zabbix.

3. Troubleshooting

mkdir -p /var/lib/mysql; ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock


1
2
3
4
5
6
7
8
vim /etc/sysconfig/clock

ZONE="Aisa/Shanghai"

ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
echo '#time sync by stan zhou at `date`'>> /var/spool/cron/root
echo '*/5 * * * * /usr/sbin/ntpdate 3.cn.pool.ntp.org > /dev/null 2>&1' >> /var/spool/cron/root
reboot

read more Changing the Time Zone

checking for mysql_config… /usr/bin/mysql_config
checking for main in -lmysqlclient… no
configure: error: Not found mysqlclient library

#yum -y install mysql-devel

ASW ec2 init setup

Managing User Accounts on Your Linux Instance

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[ec2-user@ip-172-31-17-193 ~]$ sudo -i
[root@ip-172-31-17-193 ~]# adduser stan
[root@koopa ~]# passwd stan
[root@ip-172-31-17-193 ~]# su - stan
[stan@ip-172-31-17-193 ~]$ mkdir .ssh
[stan@ip-172-31-17-193 ~]$ chmod 700 .ssh
[stan@ip-172-31-17-193 ~]$ vim .ssh/authorized_keys
[stan@ip-172-31-17-193 ~]$ chmod 600 .ssh/authorized_keys
[root@ip-172-31-17-193 ~]# groupadd auegg
[root@ip-172-31-17-193 ~]# usermod -a -G auegg stan
[root@ip-172-31-17-193 ~]# visudo
#add the following line

%auegg ALL=(ALL) ALL
[root@ip-172-31-17-193 ~]# service sshd restart

ssh to aws without key pairs

1
2
3
4
vim /etc/ssh/sshd_config
PasswordAuthentication yes
Reload ssh daemon
service sshd reload

set root login

1
2
3
4
vi /root/.ssh/authorized_keys
Delete the lines at the begining of the file until you get to the words ssh-rsa
vim /etc/ssh/sshd_config
PermitRootLogin yes

the 5 pillars of aws weel-architected framework

  1. Operationa Excellence
    Design Principles:
  • Perform operations as code
  • Annotate documentation
  • Make frequent, small, reversible changes
  • Refine operations procedures frequently
  • Anticipate failure
  • Learn from all operation failures
    Best practices:
    Operations teams need to understand their business and customer needs so they can support business outcomes.
    Ops creates and uses procedures to repond to operational events, and validates their effectiveness to support
    business needs. Ops also collects metrics that are used to measure the achievement of desired business outcomes.
  1. Security
    Design Principles:
  • Implement a strong identity foundation
  • Enable traceability
  • Apply security at all layers
  • Automate security best practices
  • Protect data in transfit and at rest
  • Prepare for security events

The AWS Shared Responsibility Model enables organizations to achieve
security and compliance goals.

  1. Reliability
    Design Principles:
  • Test recovery procedures
  • Automatically recover from failure
  • Gtop guessing capacity
  • Manage change in automation
  1. Performance efficiency
    Design principles:
  • Democratize advanced technologies
  • Go global in minutes
  • Use serverless architectures
  • Experiment more often
  • Mechanical sympathy
  1. Cost optimization
  • Adopt a consumption model
  • Measure overall efficiency
  • Stop spending monty on data center operations
  • Analyze and attribute expenditure
  • Use managed services to reduce cost of ownership

Identity and access management

IAM overview
AWS API
Access ID + secret key

CLI, SDKs and Management console call API.

Users

  • Are created and exist within IAM service
  • Login to management console
  • Can have long-term access keys

Elastic Load Balancer (ELB)

Spread traffic algorithmically

  • Evenly
  • Unbalanced on purpose

    Types

  1. Application Load Balancers
  • Application Layer
    • HTTP/HTTP traffic
  • Two appealing features
    1. Dynamic host port mapping
    • Docker containers listening on the same port
    • Set hostPort to 0
      • Host picks ports in ephemeral port range
    1. Path-based routing
      image
  1. Classic Load Balancers

Issue 1:

Solve:

vim /tomcat home dir/bin/catalina.sh
add the following line:

JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server -Xms1024m -Xmx1024m -XX:NewSize=512m -XX:MaxNewSize=512m -XX:PermSize=512m -XX:MaxPermSize=512m"


Issue 2:

`SEVERE: The web application [/name] appears to have started a thread named [Prototyper] but has failed to stop it. This is very likely to create a memory leak.`

Solve:

tomcat did not shutdown properly

vim /tomcat home dir/bin/catalina.sh
add the following line after PRGDIR=dirname "$PRG":

1
2
3
4
if [ -z "$CATALINA_PID" ]; then
CATALINA_PID=$PRGDIR/CATALINA_PID
cat $CATALINA_PID
fi

==============================bin/shutdown.sh
exec "$PRGDIR"/"$EXECUTABLE" stop -force "$@" #add -force