Skip to main content

Secure nginx with Let's Encrypt on Ubuntu 18.04

Configure Zabbix Server and Agent

Zabbix is an open source software, where you can monitor your network and server infra. You can monitor your remote host with zabbix agent. In this article we will install and configure zabbix server and zabbix host on remote server and monitor it. We will use Ubuntu 16.04 for this project.

Install Apache, MysQl and PHP.



You will have to install LAMP in your Zabbix server. So first we will install Apache, Php and MysQl in zabbix server.

apt-get update
apt-get install apache2
apt-get install mysql-server
apt-get install php php-mbstring php-gd php-xml php-bcmath php-ldap php-mysql

After install php we will have to change and configure local timezon in php configuration file.


vim /etc/php/PHP_VERSION/apache2/php.ini


[Date]
; http://php.net/date.timezone
date.timezone = 'Asia/Kolkata'

We will have to enable require APT repository to install Zabbix.


For Ubuntu 16.04 LTS:


wget http://repo.zabbix.com/zabbix/3.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.4-1+xenial_all.deb


dpkg -i zabbix-release_3.4-1+xenial_all.deb

Now we can install Zabbix server and Zabbix client on server host.


apt-get update
apt-get install zabbix-server-mysql zabbix-frontend-php

Now we will have to create Database schema for zabbix. Login to mysql and create and configure database and user for zabbix.


Mysql> create database zabbix;
Mysql> GRANT ALL on zabbix.* to zabbix@localhost IDENTIFIED BY 'yourpassword';
Mysql> FLUSH PRIVILEGES;
Mysql> quit;

Now we will have to import zabbix database schema in to our database.


cd /usr/share/doc/zabbix-server-mysql
zcat create.sql.gz | mysql -u root -p redhat [your mysql root password]


Now we have to define database username and password in zabbix server conf file.


vim  /etc/zabbix/zabbix_server.conf
 DBHost=localhost
 DBName=zabbix
 DBUser=zabbix
 DBPassword=password


Restart apache server and zabbix service .


service apache2 restart
service zabbix-server restart


Now zabbx server installed and we have to open it from browse and configure it's web interface.
http://your_zabbix_server_ip_address/zabbix/

                                                    Click next to configure Zabbix.





All require packages are showing ok. click next.







                                     Enter database details which we have created above.




                                        You need to define Host and port details.




                                It will show you summary of you have configured all settings.




                                                           Click next to install. 

Login with User admin and default password is zabbix.



Zabbix Dashboard after successful login.


Congratulations, We have successfully installed Zabbix server on our Ubuntu machine. 


Now we have ready server for monitor host. So now we have to install and configure Zabbix host for monitoring.


How To Install Zabbix Agent on Ubuntu 16.04/

Zabiix agent is require to install on every host system, So that we can monitor that host from zabbix server.

To install zabbix agent we have to enable Apt Repository on cline machine.

$wget http://repo.zabbix.com/zabbix/3.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.4-1+xenial_all.deb

$dpkg -i zabbix-release_3.4-1+xenial_all.deb


After adding Apt repository you will able to install zabbix agent, first we have to update our repository by apt update then we will install zabbix agent package.

apt-get update
apt-get install zabbix-agent


After installing zabbix agent on local machine we have to configure agent setting.

vim /etc/zabbix/zabbix_agentd.conf 

Server=your server ip
Hostname=slaveserver


Now restart zabbix agent.

$service zabbix-agent start

So now we have succesfuly install zabbix agent . Now we have to add this agent host to zabbix server for monitoring. To add new host first you have to login in to your zabbix server.

Click on Configuration.
Click on Host in submenu.
And click on create host.




Now we will have to add require details of remote host which we have to monitor.

enter hostname.
Enter visible name
Enter group infor [Select linux servers if you have linux instance]
Enter host ip in agent interface 




Now switch on templates 




select template which you want not monitor.we will select Templet OS linux and Http for monitor Linux os and httpd.select below template

Template App HTTP Service
Template OS Linux

Click on add button and save. So now we have succesfully added Linux host to zabbix server, Now we can monitor that client host from Zabbiz server. we will able to monitor host machine and httpd service.




How to view graph in Zabbix server.




Congratulations,,,, Now you can monitor your host from zabbix server. one most IMP past is to Configure and enable Triggers and Email Notification, So in next article i will explain you to how to configure zabbix email service for notification errors.



Comments

Popular posts from this blog

Another instance of Certbot is already running - Solved - Linux guru

Error : Another instance of Certbot is already runningcertbot --server https://acme-v02.api.letsencrypt.org/directory --manual --preferred-challenges dns --installer nginx -d *.vishalvyas.com Another instance of Certbot is already running Reason : when you run certbot form your machine and unexpectedly stop the command, Then cert bot is not running but it left some .certbot.lock files behind.You need to kill the certbot instance form your machine. Solution : Run the below command to find killed certbot.find / -type f -name ".certbot.lock" You can see result of the command, If there are, you can remove them. Run below command to remove them.find / -type f -name ".certbot.lock" -exec rm {} \; And try again.

Install Apache Using Ansible Playbooks

Ansible is a automation tool which is widely used, you can install and install, configure and manage number of system and services remotely. you can install software and manage services and tasks without needing manually log in to each servers. you have to install ansible in one machine and use ssh to communicate host each other.



Ansible uses Playbooks which is written in YAML format. it's uses module base format. with playbook can run multiple tasks at time and provide more advance functionality, YAML file always start with "---" syntax. In this article we will see how to install and configure apahce2 using ansible YAML script. Master server : 10.80.253.11 [Ansible server, ] Slave 1 : 10.80.253.12 [need to install apache2 in slave 1] Slave 2 : 10.80.253.13 [need to install apache2 in slave 2] We need to configure slave server info in our ansible configuration file, click here to know how to add client machine to ansible. Let's update our apache2.yml file and install…

Create aws s3 bucket using cli

In this article i will explain you to how to manage s3 bucket and objects using AWS cli command line interface. for that you will have to configure AWS cli interface to your local linux machine. You can configure cli from. HERE.




After configured aws cli to your local machine, you can run all below commands. How to create bucket using AWS Cli.root@master:~# aws s3 mb s3://linuxgurubucket make_bucket: linuxgurubucket Listing Bucket : To list all bucket : root@master:~# aws s3 ls 2018-05-01 15:28:37 linuxgurubucket To list all objects from bucket :root@master:~# aws s3 ls s3://linuxgurubucket 2018-05-01 15:32:16 71515 vishal.jpg How to copy local file to s3 using aws cp command :root@master:~# aws s3 cp ansible.sh s3://linuxgurubucket/ upload: ./ansible.sh to s3://linuxgurubucket/ansible.sh To check it's upload or not :root@master:~# aws s3 ls s3://linuxgurubucket/ 2018-05-01 15:34:19 82 ansible.sh 2018-05-01 15:32:16 71515 vishal.jpg To remove file from s3 bucket using cli: