1、ganglia简介

Ganglia 是一款为 HPC(高性能计算)集群而设计的可扩展的分布式监控系统,它可以监视和显示集群中的节点的各种状态信息,它由运行在各个节点上的 gmond 守护进程来采集 CPU 、内存、硬盘利用率、 I/O 负载、网络流量情况等方面的数据,然后汇总到 gmetad守护进程下,使用 rrdtool 存储数据,最后将历史数据以曲线方式通过 PHP 页面呈现。

Ganglia 的特点如下:

良好的扩展性,分层架构设计能够适应大规模服务器集群的需要

负载开销低,支持高并发

广泛支持各种操作系统( UNIX 等)和 cpu 架构,支持虚拟

2、ganglia组成

Ganglia 监控系统有三部分组成,分别是 gmond、 gmetad、 webfrontend,作用如下。

gmond: 即为 ganglia monitoring daemon,是一个守护进程,运行在每一个需要监测的节点上,用于收集本节点的信息并发送到其他节点,同时也接收其他节点发过了的数据,默认的监听端口为 8649。

gmetad: 即为 ganglia meta daemon,是一个守护进程,运行在一个数据汇聚节点上,定期检查每个监测节点的 gmond 进程并从那里获取数据,然后将数据指标存储在本地 RRD 存储引擎中。

webfrontend: 是一个基于 web 的图形化监控界面,需要和 Gmetad 安装在同一个节点上,它从 gmetad 取数据,并且读取 RRD 数据库,通过 rrdtool 生成图表,用于前台展示,界面美观、丰富,功能强大。下图是其结构

环境规划(CentOS6.7)

服务器端  172.16.80.117

客户端    172.16.80.117 172.16.80.116

3、ganglia的安装

[root@centos02 tools]# wget wget

[root@centos02 tools]# rpm -ivh epel-release-6-8.noarch.rpm

[root@centos02 tools]# yum install ganglia-gmetad.x86_64  ganglia-gmond.x86_64 ganglia-gmond-python.x86_64  -y

修改服务端配置文件

[root@centos02 tools]# vim /etc/ganglia/gmetad.conf

data_source "my cluster"  172.16.80.117 172.16.80.116

gridname "MyGrid"

ganglia web的安装(基于LNMP环境)

[root@centos02 tools]# tar xf ganglia-web-3.7.2.tar.gz

[root@centos02 tools]# mv ganglia-web-3.7.2 /application/nginx/html/ganglia

修改ganglia web的php配置文件

[root@centos02 tools]# vim /application/nginx/html/ganglia/conf_default.php

$conf['gweb_confdir'] = "/application/nginx/html/ganglia";

nginx配置

[root@centos02 ganglia]# cat /application/nginx/conf/nginx.conf

worker_processes  2;

events {

worker_connections  1024;

}

http {

log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '

'$status $body_bytes_sent "$http_referer" '

'"$http_user_agent" "$http_x_forwarded_for"';

include      mime.types;

default_type  application/octet-stream;

sendfile        on;

keepalive_timeout  65;

server {

listen      80;

server_name  www.linuxidc.com martin.com;

location / {

root  html/zabbix;

index  index.php index.html index.htm;

}

location ~ .*\.(php|php5)?$ {

root  html/zabbix;

fastcgi_pass 127.0.0.1:9000;

fastcgi_index index.php;

include fastcgi.conf;

}

access_log  logs/access_zabbix.log  main;

}

server {

listen      80;

server_name  ganglia.linuxidc.com;

location / {

root  html/ganglia;

index  index.php index.html index.htm;

}

location ~ .*\.(php|php5)?$ {

root  html/ganglia;

fastcgi_pass 127.0.0.1:9000;

fastcgi_index index.php;

include fastcgi.conf;

}

access_log  logs/access_bbs.log  main;

}

###status

server{

listen 80;

server_name status.linuxidc.org;

location / {

stub_status on;

access_log off;

}

}

}

访问测试,报错如下

Fatal error:Errors were detected in your configuration.

DWOO compiled templates directory '/application/nginx/html/ganglia/dwoo/compiled' is not writeable.

Please adjust $conf['dwoo_compiled_dir'].

DWOO cache directory '/application/nginx/html/ganglia/dwoo/cache' is not writeable.

Please adjust $conf['dwoo_cache_dir'].

in /application/nginx-1.6.3/html/ganglia/eval_conf.php on line 126

解决办法:

[root@centos02 tools]# mkdir /application/nginx/html/ganglia/dwoo/compiled

[root@centos02 tools]# mkdir /application/nginx/html/ganglia/dwoo/cache

[root@centos02 tools]# chmod 777 /application/nginx/html/ganglia/dwoo/compiled

[root@centos02 tools]# chmod 777 /application/nginx/html/ganglia/dwoo/cache

[root@centos02 html]# chmod -R 777 /var/lib/ganglia/rrds

修改客户端配置文件(所有的客户端都需要做)

[root@centos02 tools]# vim /etc/ganglia/gmond.conf

cluster {

name = "my cluster"    #这个名字要和服务器端定义的data_source后面的名字一样

owner = "unspecified"

latlong = "unspecified"

url = "unspecified"

}

udp_send_channel {

#bind_hostname = yes # Highly recommended, soon to be default.

# This option tells gmond to use a source address

# that resolves to the machine's hostname.  Without

# this, the metrics may appear to come from any

# interface and the DNS names associated with

# those IPs will be used to create the RRDs.

#  mcast_join = 239.2.11.71

host = 172.16.80.117      #这里我们采用单播方式,默认是组播

port = 8649

#  ttl = 1

}

udp_recv_channel {

#  mcast_join = 239.2.11.71

port = 8649

#  bind = 239.2.11.71

retry_bind = true

# Size of the UDP buffer. If you are handling lots of metrics you really

# should bump it up to e.g. 10MB or even higher.

# buffer = 10485760

}

4、再次访问测试

这里是整个集群的一个总的汇总图,而不是单台服务器的图,下面我们打开单台服务器的图看看

再来看看对同一指标,每台服务器一起显示的图

5、扩展 Ganglia 监控功能的方法

默认安装完成的 Ganglia 仅向我们提供基础的系统监控信息,通过 Ganglia 插件可以实现两种扩展 Ganglia 监控功能的方法。

1) 添加带内( in-band)插件,主要是通过 gmetric 命令来实现。

这是通常使用的一种方法,主要是通过 crontab 方法并调用 Ganglia 的 gmetric 命令来向gmond 输入数据,进而实现统一监控。这种方法简单,对于少量的监控可以采用,但是对于大规模自定义监控时,监控数据难以统一管理。

2) 添加一些其他来源的带外( out-of-band)插件,主要是通过 C 或者 Python 接口来实现。

在 Ganglia3.1.x 版本以后,增加了 C 或 Python 接口,通过这个接口可以自定义数据收集模块,并且可以将这些模块直接插入到 gmond 中以监控用户自定义的应用。

这里我们举例通过带外扩展的方式 来监控nginx的运行状态

配置 ganglia 客户端,收集 nginx_status 数据

[root@centos02 nginx_status]# pwd

/tools/gmond_python_modules-master/nginx_status

[root@centos02 nginx_status]# cp conf.d/nginx_status.pyconf /etc/ganglia/conf.d/

[root@centos02 nginx_status]# cp python_modules/nginx_status.py  /usr/lib64/ganglia/python_modules/

[root@centos02 nginx_status]# cp graph.d/nginx_* /application/nginx/html/ganglia/graph.d/

[root@centos02 mysql]# cat /etc/ganglia/conf.d/nginx_status.pyconf

#

modules {

module {

name = 'nginx_status'

language = 'python'

param status_url {

value = 'http://status.linuxidc.org/'

}

param nginx_bin {

value = '/application/nginx/sbin/nginx'

}

param refresh_rate {

value = '15'

}

}

}

collection_group {

collect_once = yes

time_threshold = 20

metric {

name = 'nginx_server_version'

title = "Nginx Version"

}

}

collection_group {

collect_every = 10

time_threshold = 20

metric {

name = "nginx_active_connections"

title = "Total Active Connections"

value_threshold = 1.0

}

metric {

name = "nginx_accepts"

title = "Total Connections Accepted"

value_threshold = 1.0

}

metric {

name = "nginx_handled"

title = "Total Connections Handled"

value_threshold = 1.0

}

metric {

name = "nginx_requests"

title = "Total Requests"

value_threshold = 1.0

}

metric {

name = "nginx_reading"

title = "Connections Reading"

value_threshold = 1.0

}

metric {

name = "nginx_writing"

title = "Connections Writing"

value_threshold = 1.0

}

metric {

name = "nginx_waiting"

title = "Connections Waiting"

value_threshold = 1.0

}

}

完成上面的所有步骤后,重启 Ganglia 客户端 gmond 服务,在客户端通过“ gmond–m”

命令可以查看支持的模板,最后就可以在 Ganglia web 界面查看 Nginx 的运行状态

下面关于Ganglia的文章您也可能喜欢,不妨参考下:

CentOS集群上安装Ganglia-3.6.0监控Hadoop-2.2.0和HBase-0.96.0 http://www.linuxidc.com/Linux/2014-01/95804.htm

linux下ganglia监控系统搭建,开源监控软件Ganglia 安装使用相关推荐

  1. Linux下光盘yum源搭建及简单软件安装

    Linux下软件安装包常见的有源码包.二进制包, 软件安装一般有以下几种方式:RPM包安装.yum安装.以及脚本安装. 严格来说,脚本安装并不是独立的一种安装方式,只是对Linux字符界面下软件复杂安 ...

  2. linux下ganglia监控系统搭建,linux下ganglia监控系统搭建

    Ganglia监控软件主要是用来监控系统性能的软件,如:cpu .mem.硬盘利用率, I/O负载.网络流量情况等,通过曲线很容易见到每个节点的工作状态,对合理调整.分配系统资源,提高系统整体性能起到 ...

  3. Linux下常用的系统监控软件

    转载:http://blog.chinaunix.net/uid-25266990-id-3380929.html Linux下常用的系统监控软件有Nagios.Cacti.Zabbix.Monit等 ...

  4. GPE服务器监控系统搭建

    GPE服务器监控系统搭建 使用 Prometheus + Grafana + Exporter 监控服务器的运行状态 相关概念 微服务中的监控分根据作用领域分为三大类,Logging,Tracing, ...

  5. Grafana监控系统之Prometheus+Grafana监控系统搭建

    Grafana监控系统之Prometheus+Grafana监控系统搭建 本文章内容较长,可通过右上角点击目录快速定位想看的内容 => => 一. 概述 1.1 Grafana介绍 Gra ...

  6. Traefik监控系统搭建

    Traefik监控系统搭建 背景 前边的文章Traefik学习中已经介绍了Traefik的使用,但是如果没有一个可视化的Traefik访问状态与Acces Log的Dashboard界面的话,对于一个 ...

  7. 服务器是什么系统_为什么视频监控系统搭建,要使用流媒体服务器做视频分发?...

    众所周知,TSINGSEE有很多视频流媒体平台和辅助分发的组件,例如EasyNVR.EasyDSS.EasyGBS均是流媒体平台,而EasyRTMPLive则是负责拉转推的推流网关. 而对于流媒体服务 ...

  8. Zabbix监控系统搭建飞书机器人告警

    Zabbix监控系统搭建&飞书机器人告警 操作系统:CentOS7x64 Zabbix版本:5.0LTS 参考官网链接:下载Zabbix 5.0 LTS for CentOS 7, MySQL ...

  9. Sentry监控系统搭建流程及钉钉告警配置

    Sentry监控系统搭建流程 1.安装Sentry (1)更新docker版本 注意:最新21版本docker要求在19.3.05版本及以上,如果版本过低,需要更新(更新前要先卸载旧版本) 列出所有包 ...

最新文章

  1. [NOI2005]聪聪与可可(期望dp)
  2. excel两个指标相关性分析_Excel实操分析函数,投资决策指标的假设分析,就是那么简单...
  3. hadoop centos 安装
  4. jQuery-动画点击淡化消失
  5. C++学习之路 | PTA乙级—— 1050 螺旋矩阵 (25 分)(精简)
  6. 五、Hashtable与HashMap的区别
  7. 【图数据库】Neo4j
  8. 服务状态已停止_虾米音乐今日宣布关停,新平台”音螺“相关商标已注册
  9. 记一次在广州看牙医经历
  10. 计算机考研需要分数线,计算机考研分数线是多少?
  11. JavaScript lambda 表达式介绍
  12. Excel技巧 - Date函数日期转换
  13. does not exist or is not a readable directory
  14. 证件照制作相关的人像抠图/分割各家接口整理分析
  15. 前端间隔查询的两种方法:Debounce和Throttle
  16. 三种查看文件MD5 SHA*等校验值的方法
  17. 安装GitHub代码所需包
  18. Centos7 安装Chrome浏览器
  19. 麒麟810鸿蒙内核移植,麒麟810实体芯片首曝光 鸿蒙系统或8月重磅发布
  20. Matlab自适应均线_matlab – 计算移动平均线

热门文章

  1. Maven编译Scala报错StackOverflowError
  2. 163相册验证码图片的识别手记之二 --- 识别
  3. 密码学——DES算法计算
  4. mysql sql判断语句,SQL条件判断语句语法
  5. 哎,个人开发者,想靠 app 赚钱真的很困难啊!
  6. 运输问题的单纯形解法
  7. MFC常识性知识汇总
  8. [Aaronyang]谈谈2015年AY对WPF全面技术总结40多篇WPF,炫到没朋友的AYUI来了
  9. vscode 调试参数_VSCode调试配置
  10. python decode ignore_Python decode()方法 - Python 教程 - 自强学堂