Deploying Grafana to access Zabbix in Alibaba Cloud ECS

本文涉及的产品
可观测可视化 Grafana 版,10个用户账号 1个月
简介: Learn how to deploy Grafana to access Zabbix.

API_plan_Dynamic_Table

Abstract: Learn how to deploy Grafana to access Zabbix

This article shows you how to deploy Grafana on Alibaba Cloud ECS to access Zabbix. Zabbix is an open-source monitoring software for networks and applications while Grafana is an open-source, full-featured dashboard and graph editor for Graphite, InfluxDB, and OpenTSDB. In this tutorial, we will be running CentOS 7.2 on an Alibaba Cloud ECS instance. We will also be using Nginx version 1.9.15 as our web server. Without further ado, let’s look at how we can implement this on our ECS instance.

1. Purchase ECS:

You should have an ECS instance with CentOS 7.2. Other configurations, such as region, do not matter much for our purposes.

2. Install Nginx

Install dependency packages for Nginx on your ECS instance.

yum -y install gcc gcc-c++ autoconf automake zlib zlib-devel o
penssl openssl-devel pcre* make gd-devel libjpeg-devel libpng-
devel libxml2-devel bzip2-devel libcurl-devel

Create an Nginx user after installing the dependency packages:

useradd nginx -s /sbin/nologin -M

Download Nginx software package and enter the directory:

wget http://nginx.org/download/nginx-1.9.15.tar.gz && tar xvf 
nginx-1.9.15.tar.gz && cd nginx-1.9.15

Compile:

./configure --prefix=/usr/local/product/nginx1.9.14 --user=ngi
nx --group=nginx --with-http_ssl_module --with-http_v2_module
--with-http_stub_status_module --with-pcre

make && make install

ln -s /usr/local/product/nginx1.9.14 /usr/local/nginx    ==>cr
eate soft link

The list below describes the arguments we used when compiling the code:

--with-http_stub_status_module: This argument enables Nginx state query
--with-http_ssl_module: This arguments enables https support
--with-http_spdy_module: This argument provides support for SPDY, which in turn must be supported by ssl (You can find more information about SPDY online)
--with-pcre: prce must be configured in order to support the rewrite function

3. Install Grafana

After successfully installing Nginx, we need to install Grafana.
Grafana’s amazing visualization capabilities, combined with Zabbix’s powerful monitoring tools, greatly simplifies network management.
Grafana provides a plug-in for Zabbix, making the combination of these two software extremely convenient. To install Grafana, input the following commands.

mkdir /opt/grafana && cd /opt/grafana
wget https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-4.3.2.linux-x64.tar.gz
tar -zxvf grafana-4.3.2.linux-x64.tar.gz
mv grafana-4.3.2 grafana
cd grafana/bin/
# View installable plug-ins
./grafana-cli plugins list-remote
# Install zabbix plug-in
./grafana-cli plugins install alexanderzobnin-zabbix-app
# Install pie chart plug-in
./grafana-cli plugins install grafana-piechart-panel
# Launch, and run in background
./grafana-server -homepath /opt/grafana/grafana &

4. Manage Website Configuration (Nginx) with Grafana

Now that we have Grafana installed, we can edit Nginx web hosting as follows:

[root@grafana conf]# mkdir extra
[root@grafana conf]# cd extra/
[root@grafana extra]# vim grafana.conf
server {
    listen       80;
    server_name  grafana.dtstack.com;
    access_log /data/logs/zabbix/grafana.dtstack.com.access.log main;
    location / {
        index  index.html;
    proxy_pass http://127.0.0.1:3000;
    proxy_set_header   Host             $host;
    proxy_set_header   X-Real-IP        $remote_addr;
    proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
    }
}

Edit the configuration file ngix.conf:

[root@grafana conf]# cat nginx.conf

user nginx;
worker_processes 1;

#error_log logs/error.log warning;
#error_log logs/error.log notice;
#error_log logs/error.log info;

pid logs/nginx.pid;

events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                    '$status $body_bytes_sent "$http_referer" '
                    '"$http_user_agent" "$http_x_forwarded_for"';
    access_log  logs/access.log  main;
    sendfile        on;
    #tcp_nopush     on;
    #keepalive_timeout  0;
    keepalive_timeout  65;
    #gzip  on;
    include extra/*.conf;
}

Add file /etc/hosts:
192.168.119.140 grafana.dtstack.com
Access Grafana
Access http://grafana.dtstack.com admin/admin

5. Add a data source.

Finally, we require a data source for the Zabbix plug-in to work correctly.

Enable zabbix plug-in
Data Source Configuration - Data Source
    Name:      zabbix
    Default:   ️
    Type:      Zabbix
    ## Http settings
    URL:     http://zabbix.dtstack.com/api_jsonrpc.php
    Access:  proxy
    ## Zabbix API details
    Username: xxxxxx
    Password: xxxxxx

And there you have it! You should now be able to access Zabbix using Grafana to monitor and manage your website or application.

目录
相关文章
|
1月前
|
数据采集 监控 数据库
请问OceanBase社区版能否通过zabbix监控,然后将报错信息展现到grafana?
【2月更文挑战第25天】请问OceanBase社区版能否通过zabbix监控,然后将报错信息展现到grafana?
25 2
|
2月前
|
监控 JavaScript 前端开发
Grafana 系列 - 统一展示 -6-Zabbix 仪表板
Grafana 系列 - 统一展示 -6-Zabbix 仪表板
|
2月前
|
监控 Cloud Native 关系型数据库
使用 Grafana 统一监控展示 - 对接 Zabbix
使用 Grafana 统一监控展示 - 对接 Zabbix
|
8月前
|
SQL 运维 监控
【运维知识进阶篇】Zabbix5.0稳定版详解11(在Grafana中使用Zabbix插件:安装Grafana+安装Zabbix插件+添加数据源+Grafana直连MySQL数据库取值)(下)
【运维知识进阶篇】Zabbix5.0稳定版详解11(在Grafana中使用Zabbix插件:安装Grafana+安装Zabbix插件+添加数据源+Grafana直连MySQL数据库取值)(下)
116 1
|
8月前
|
运维 监控 数据可视化
【运维知识进阶篇】Zabbix5.0稳定版详解11(在Grafana中使用Zabbix插件:安装Grafana+安装Zabbix插件+添加数据源+Grafana直连MySQL数据库取值)(上)
【运维知识进阶篇】Zabbix5.0稳定版详解11(在Grafana中使用Zabbix插件:安装Grafana+安装Zabbix插件+添加数据源+Grafana直连MySQL数据库取值)
243 0
|
8月前
|
存储 监控 关系型数据库
|
监控
zabbix利用grafana自定义监控图形展现(十一)
zabbix利用grafana实现监控图形展现 1.修改已有的system load监控图像 下面这张图是现在已经有的系统负载监控图,可以看到只有15分钟的负载并没有1分钟和5分钟的负载,我们现在修改一下图形,让他支持1分钟和5分钟的系统负载
944 0
zabbix利用grafana自定义监控图形展现(十一)
|
监控 Linux
配置zabbix连接grafana展示监控图形(十)
zabbix连接grafana 1.安装grafana
978 0
配置zabbix连接grafana展示监控图形(十)
|
监控 数据安全/隐私保护
Grafana安装+zabbix加入节点
Grafana安装+zabbix加入节点
|
监控 关系型数据库 MySQL
配置grafana直连zabbix数据库(十二)
配置grafana直连zabbix数据库 由于grafana都是通过zabbix取值最终展示在图形中,但是由于zabbix某些监控项可能获取值的时间较长,因此我们可以让grafana直连数据库进行直接取值,从而让展示的图形更加准确
816 0
配置grafana直连zabbix数据库(十二)

推荐镜像

更多