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.

目录
相关文章
|
6月前
|
SQL 弹性计算 运维
云备份(Cloud Backup)ECS备份基础版——超好用的ECS数据保护方案
ECS备份基础版是阿里云云备份(Cloud Backup,原混合云备份HBR)全新推出的ECS数据保护方案,配置简单、预算可控,同时支持ECS文件、自建数据库和整机的保护。ECS基础版属于预付费商品,可为每台ECS保护最多500G数据。
83690 0
|
12天前
|
数据采集 监控 数据库
请问OceanBase社区版能否通过zabbix监控,然后将报错信息展现到grafana?
【2月更文挑战第25天】请问OceanBase社区版能否通过zabbix监控,然后将报错信息展现到grafana?
27 2
|
12天前
|
监控 JavaScript 前端开发
Grafana 系列 - 统一展示 -6-Zabbix 仪表板
Grafana 系列 - 统一展示 -6-Zabbix 仪表板
|
12天前
|
监控 Cloud Native 关系型数据库
使用 Grafana 统一监控展示 - 对接 Zabbix
使用 Grafana 统一监控展示 - 对接 Zabbix
|
9月前
|
SQL 运维 监控
【运维知识进阶篇】Zabbix5.0稳定版详解11(在Grafana中使用Zabbix插件:安装Grafana+安装Zabbix插件+添加数据源+Grafana直连MySQL数据库取值)(下)
【运维知识进阶篇】Zabbix5.0稳定版详解11(在Grafana中使用Zabbix插件:安装Grafana+安装Zabbix插件+添加数据源+Grafana直连MySQL数据库取值)(下)
128 1
|
9月前
|
运维 监控 数据可视化
【运维知识进阶篇】Zabbix5.0稳定版详解11(在Grafana中使用Zabbix插件:安装Grafana+安装Zabbix插件+添加数据源+Grafana直连MySQL数据库取值)(上)
【运维知识进阶篇】Zabbix5.0稳定版详解11(在Grafana中使用Zabbix插件:安装Grafana+安装Zabbix插件+添加数据源+Grafana直连MySQL数据库取值)
268 0
|
9月前
|
存储 监控 关系型数据库
|
10月前
|
安全 JavaScript 小程序
Spring Cloud实战 | 第九篇:Spring Cloud整合Spring Security OAuth2认证服务器统一认证自定义异常处理
Spring Cloud实战 | 第九篇:Spring Cloud整合Spring Security OAuth2认证服务器统一认证自定义异常处理
|
11月前
|
SpringCloudAlibaba 前端开发 安全
SpringCloud Alibaba实战二十六 - Oauth2认证服务器自定义异常
SpringCloud Alibaba实战二十六 - Oauth2认证服务器自定义异常
308 0
|
弹性计算 NoSQL Linux
阿里云ECS安装Alibaba Cloud Linux操作系统部署Redis数据库
阿里云ECS安装Alibaba Cloud Linux操作系统部署Redis数据库,阿里云持久内存型云服务器ECS有re7p、r7p、re6p等,云服务器吧以持久内存型re6p实例ecs.re6p-redis.2xlarge为例,操作系统镜像为Alibaba Cloud Linux 2.1903 LTS 64位,安装Redis 6.0.5或Redis 3.2.12教程如下:
313 0