Installing and Configuring Grafana on CentOS 7

Launch Terminal and login as root.

Step 1 – Disable SELinux

The first step is to check the SELinux status and disable it if it is enabled.getenforceModify SELinux configurations as follows:vim /etc/sysconfig/selinuxChange SELINUX=enforcing to SELINUX=disabledReboot system.rebootThere are few methods to install Grafana on RPM-based Linux Distributions like Centos /Fedora. In today’s tutorial, we are going to install from Grafana repository.

Step 2 – Installing Grafana via YUM Repository

Create a repo file.vim /etc/yum.repos.d/grafana.repoAdd the following contents to file:[grafana]name=grafanabaseurl=https://packages.grafana.com/oss/rpmrepo_gpgcheck=1enabled=1gpgcheck=1gpgkey=https://packages.grafana.com/gpg.keysslverify=1sslcacert=/etc/pki/tls/certs/ca-bundle.crt

Step 3 – Install Grafana

Enter the following command:sudo yum install grafana

Install Grafana

Completed Installation The Package does the following things:

  • Installs binary to /usr/sbin/grafana-server
  • Copies init.d script to /etc/init.d/grafana-server
  • Installs default file to /etc/sysconfig/grafana-server
  • Copies configuration file to /etc/grafana/grafana.ini
  • Installs systemd service (if systemd is available) name grafana-server.service
  • The default configuration uses a log file at /var/log/grafana/grafana.log

Step 4 – Install additional font packages

Continue with following commands to install the free type and urw fonts.yum install fontconfigyum install freetype*yum install urw-fonts

Step 5 – Enable Grafana Service

Check the status of the service.systemctl status grafana-serverIf service is not active, start it using the following command:systemctl start grafana-serverEnable Grafana service on system bootsystemctl enable grafana-server.service

Step 6 – Modify Firewall

Change firewall configuration to allow Grafana port. So run following command.firewall-cmd –zone=public –add-port=3000/tcp –permanentReload firewall service.firewall-cmd –reload

Step 7 – Browse Grafana

Use the following URL to access the Grafana web interface.http://Your Server IP or Host Name:3000/

Grafana Login Page Enter “admin” in the login and password fields for first-time use; then it should ask you to change the password.

Change Password It should redirect to the Dashboard.

Grafana Dashboard In the previous article, we learned how to install Zabbix. So here we are going to add Zabbix Plugin to Grafana.

Step 8 – Install Plugins

To Install Zabbix plugin run following command:grafana-cli plugins install alexanderzobnin-zabbix-appDefault plugin installation directory is /var/lib/grafana/plugins. Restart Grafana Service.systemctl restart grafana-serverRefresh Grafana Dashboard to see Zabbix plugin. Click “Enable Now.”

Zabbix Plugin The dashboard should show that the Zabbix plugin is up to date.

Step 9 – Configure Zabbix Plugin

Click on “Add data Source.”

Click Add Data Source from DashBoard You should see various kind of data sources. Select Zabbix from it.

Select Zabbix DataSource Next, you should see the configuration page.

Add Zabbix Server Details Under HTTP modify URL, add Zabbix Server User Name and Password under Zabbix API details:http://Your-Zabbix-ServerIP/zabbix/api_jsonrpc.phpEnable Trends. Click Save and Test.

Save and Test DataSource Go home clicking Dashboards -> Home.

Grafana Home

Step 10 – Create a Dashboard

Click on “New dashboard ” to create.

Home-Dashboard Click on “Add Query”.

New-Dashboard You should see the Query window.

Add Query Select Queries to “Zabbix”. Set Query Mode to “Metrics”.Select “Group”, “Host”, “Application”, “Item” from drop-down menu. (These data comes from Zabbix server).

Completed Query Window Click on Visualization to configure Graph. Select Visualization type from the drop-down menu.

Visualization Then click general and add a title to the dashboard.

Add Name to Panel Finally, you can save the Dashboard and give any name.

Save Dashboard You can view your newly created Graph!

Leave a comment

Your email address will not be published. Required fields are marked *