How to Install and Use Zabbix
Try this article using a ServerMania Cloud server starting a $5 per month.
Whether you’re launching a single server e-commerce site, or you’re a growing SaaS startup with new servers being deployed daily – we all have one thing in common. We need a reliable way to see the health of our servers at a glance and to receive notifications when something goes wrong.
In this article, we’ll outline your options when it comes to server monitoring, and show you how to deploy your own server monitoring platform using Zabbix for those who want to go that route.
See Also: (Live Webinar) Meet ServerMania: Transform Your Server Hosting Experience
Server Monitoring Options
There are three main options to consider when setting up a server or website uptime monitoring system for your business.
1, Use A Server Monitoring Service
There are a variety of services available which will monitor the health and connectivity of your servers and notify you via phone, email, or push notification in the event that the service is unable to reach your services. Some popular examples include:
These services may be the right option for you if you prefer to simply install a monitoring agent on each of your servers, and rely on another platform to manage the monitoring platform for a monthly fee. If you are looking for PagerDuty alternatives though, keep reading.
2, Purchase Server Management Monitoring
The second option when considering the best server monitoring option for your needs is to purchase a server management plan which will monitor your servers and intervene in the event of an outage. This is the ideal choice if you do not have staff online 24×7, or you don’t want to be woken up in the middle of the night during an outage.
Server management plans start at $39.99 per month and include 5 minute response times to any detected outage.
3, Setup Your Own Server Monitoring Platform
If you would prefer to manage server monitoring yourself without any additional monthly fees, you can also setup your own monitoring server (outside of your primary network, of course) which will monitor the uptime and health of all of your servers in one central location.
While this option takes more work, it allows you to maintain greater access and control of services accessing your server and also allows you to restrict monitoring access to only those inside of your private network.
What is Zabbix?
Zabbix is an open source monitoring platform. The control panel software is isntalled on one server, and each server you want to monitor has a monitoring daemon installed. You can then visit your Zabbix control panel homepage and see the status of all servers at a glance as well as receive notificaitons in the event of an outage.
How much does Zabbix cost?
Zabbix is a completely free open source software. You can use it on an unlimited number of servers without any licensing cost. You will need a web server to host the control panel, though.
Zabbix System Requirements
In order to run the Zabbix control panel, you will need a linux server with a recommend 2 CPU cores and 2GB of memory for a medium sized monitoring instance. The server will need a database software such as MySQL and Apache with PHP 5.4 or greater.
What You’ll Need
- A Cloud or Dedicated Server which will be used to run the monitoring software
- Latest version of Debian, although Zabbix will run on any version of Linux
How to Install Zabbix
We’re now going to walk you through how to install Zabbix, an open-source monitoring software on a linux Hybrid or Dedicated Server. Zabbix is completely free to use on an unlimited number of hosts, and has been a trusted software platform for many years in the hosting industry.
Step 1: Connect to SSH on the Monitoring Server
Start by connecting to SSH on the server you wish to host the monitoring software on:
ssh root@ip-address
Step 2: Download the Zabbix Installation Files
Next, we’ll download the required repositories:
wget https://repo.zabbix.com/zabbix/4.2/debian/pool/main/z/zabbix-release/zabbix-release_4.2-1+stretch_all.debdpkg -i zabbix-release_4.2-1+stretch_all.debapt update
Step 2: Install Zabbix Server
We can now install the Zabbix Server and Zabbix Frontend, which includes MySQL:
apt install -y zabbix-server-mysql zabbix-frontend-php
Step 3: Create the MySQL Database
Zabbix needs a MySQL database to operate, so we can create it now:
mysql -urootcreate database zabbix character set utf8 collate utf8_bin;grant all privileges on zabbix.* to zabbix@localhost identified by ‘password‘;quit;
Step 4: Import MySQL Data
We can now import the required database data into our newly created database:
zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql -uzabbix -p zabbix
Step 5: Update Database Information
Update the Zabbix Server configuration file with the database password which you previously set:
nano /etc/zabbix/zabbix_server.confDBHost=localhostDBName=zabbixDBUser=zabbixDBPassword=<password>
Step 5: Start the Server
The monitoring server can now be started, and we’ll set it to run at startup as well:
service zabbix-server startupdate-rc.d zabbix-server enable
Step 6: Set Timezone and Restart Apache
Finally, we’ll need to set our timezone in the Zabbix configuration file:
Nano /etc/apache2/conf-enabled/zabbix.conf
Save the file and restart Apache:
service apache2 restart
Installing the Front End of Zabbix
Step 1: Visit the admin interface in your browser
Visit http://server-IP/zabbix in your browser.
Click Next Step if all pre-requisites are met.
Enter the database information and click Next Step.
Click Next Step.
Confirm all details and click Next Step:
You may now login with the username Admin and password zabbix. This information is case sensitive. Make sure to change the login credentials once logged in.
Installing the Zabbix Monitoring Agent
We can now install the monitoring agent on each server we wish to monitor.
Step 1: Login via SSH to the Server
ssh root@IP-Address
Step 2: Install the Zabbix Agent
apt install -y zabbix-agent
Step 3: Update the Configuration File
We’ll edit our Zabbix Agent configuration file with the IP address of our master monitoring server:
nano /etc/zabbix/zabbix_agentd.conf
Set the option for server to be the IP address of your monitoring server. Replace 127.0.0.01 with your monitoring server IP.
Server=IP-Address
Save and close the FIle
Step 4: Start the Agent
service zabbix-agent restart
Step 5: Add the New Host into Zabbix
In the Zabbix administration panel, click on Configuration > Hosts
Click Create Host in the top right hand corner:
Enter the server hostname, IP address, and select a host group to monitor the server in.
In the Templates tab, select Linux OS Template and click Add
Click the blue Add button to add the host. The host will appear as ZBX available in a few minutes if the process was completed properly:
Configuring Server Monitoring Notifications
Begin by setting up the mail server settings in Administration > Media Types:
This page will allow you to configure the mail server settings of your pre-existing mail server that will send notifications:
Once the mail server settings have been updated and tested, you can configure email on the relevant users.
To configure email notifications, click on Administration > Users
Select the user you wish to edit, and under the Media tab, you can enter an email and outline which alerts to send email notifications about.
SMS
There are some github projects created which allow you to integrate with an SMS provider like Twillio to send SMS notifications in the event of a server outage.
Setting Up Monitoring Screens
Zabbix has a variety of completely customizable dashboards, screens, and graphs that can be used to have an at a glance view of your entire server fleet’s health. We recommend spending some time setting up these screens based on your particular needs.
Next Steps
You now have a fully configured Zabbix monitoring center where you can see complete server information about your entire server fleet as well as receive notifications about any issues that may arise.
You can visit the Zabbix Documentation for any questions that may arise, or leave a comment below!