运维监控平台之ganglia
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.martin.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.martin.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.martin.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.martin.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 的运行状态

低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。
持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。
转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。
- 上一篇
Linux基础之文件系统简介及其系统管理工具
常见的文件系统 Linux文件系统: ext2, ext3, ext4, xfs, btrfs, reiserfs, jfs, swap swap: 交换分区 光盘:iso9660 Windows:fat32, ntfs Unix: FFS, UFS, JFS2 网络文件系统:NFS, CIFS 集群文件系统:GFS2, OCFS2 分布式文件系统:ceph,moosefs, mogilefs, GlusterFS, Lustre 实验环境CentOS7.2 Linux根据其是否支持"journal"功能: 日志型文件系统: ext3, ext4, xfs, ... 非日志型文件系统: ext2, vfat Linux的文件系统的组成部分: 内核中的模块:ext4, xfs, vfat 用户空间的管理工具:mkfs.ext4, mkfs.xfs, mkfs.vfat 在正式介绍文件系统的前先说一下创建文件系统之前的格式化问题。 格式化 低级格式化:硬件制造商、分区之前划分磁道,形成簇 磁盘出厂前由厂家完成 高级格式化:分区之后...
- 下一篇
openstack-M版安装部署
[openstack信息简介] Openstack项目是一个开源的云计算平台,它为广大云平台提供了可大规模扩展的平台,全世界的云计算技术人员创造了这个项目,通过一组相互关联的服务来提供了Iaas基础解决方案,每一个服务都通过提供自身的API来提供服务,个人或者企业完全可以根据自身的需求来安装一部分或者全部的服务。 通过下面一张表格来描述一下当前openstack的各个组件及功能。 Service Project name Description Dashboard Horizon 通过提供了web服务实现openstack服务的交互,比如创建实例,配置IP以及配置访问控制。 Compute Nova 在系统环境中管理整个生态圈的计算。承担着经过请求后的孵化,调度和回收虚拟机等一系列的责任,是核心组件,可以说是真正实现的角色。 Networking Neutron 提供了网络服务,连接起了其他服务。为用户提供API去定义网络并将它们联系起来。支持多种网络供应商和新兴的网络技术,比如vxlan等。 Object Storage Swift 通过了RESTful API来存储和检索任务非结构...
相关文章
文章评论
共有0条评论来说两句吧...
文章二维码
点击排行
推荐阅读
最新文章
- Jdk安装(Linux,MacOS,Windows),包含三大操作系统的最全安装
- CentOS8安装MyCat,轻松搞定数据库的读写分离、垂直分库、水平分库
- CentOS7设置SWAP分区,小内存服务器的救世主
- Windows10,CentOS7,CentOS8安装MongoDB4.0.16
- CentOS7安装Docker,走上虚拟化容器引擎之路
- SpringBoot2初体验,简单认识spring boot2并且搭建基础工程
- CentOS关闭SELinux安全模块
- Docker快速安装Oracle11G,搭建oracle11g学习环境
- CentOS7编译安装Gcc9.2.0,解决mysql等软件编译问题
- Docker安装Oracle12C,快速搭建Oracle学习环境