CentOS安装ganglia进行系统监控

1.安装php环境

1.查看当前php版本
php -v

2.更换 RPM 源
#Centos 5.X:
rpm -Uvh http://mirror.webtatic.com/yum/el5/latest.rpm

#CentOs 6.x:
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm

#CentOs 7.X:
rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

3.停止相关服务
systemctl stop nginx

4.删除旧版本php包
yum remove php*

5.安装新版本 PHP
php 7.0/7.1/7.2 分别表示为 70w/71w/72w
yum install php71w php71w-cli php71w-common php71w-devel php71w-embedded php71w-fpm php71w-gd php71w-mbstring php71w-mysqlnd php71w-opcache php71w-pdo php71w-xml php71w-ldap php71w-mcrypt

6.重新启动相关服务
systemctl start php-fpm

7.查看php版本
php -v

2.安装ganglia

epel包的安装:yum install -y epel-release
gmetad的安装:yum install -y ganglia-gmetad ganglia-devel(从节点不需要这个)
gmond的安装:yum install -y ganglia-gmond ganglia-gmond-python
rrdtool的安装:yum install -y rrdtool rrdtool-devel
其他依赖包的安装:yum install -y apr-devel zlib-devel libconfuse-devel expat-devel pcre-devel

3.配置ganglia

vim /etc/ganglia/gmetad.conf
 
# 修改 data_source,这里也就是cluster的名字了,具体说明看配置文件内的介绍
data_source "my cluster"

vim /etc/ganglia/gmond.conf
 
# 修改 cluster name
cluster {
  name = "k8s-spark"
  owner = "unspecified"
  latlong = "unspecified"
  url = "unspecified"
}

/* The host section describes attributes of the host, like the location */
host {
  location = "unspecified"
}

/* Feel free to specify as many udp_send_channels as you like.  Gmond
   used to only support having a single channel */
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 = 192.168.66.30
  port = 8649
  ttl = 1
}

/* You can specify as many udp_recv_channels as you like as well. */
udp_recv_channel {
 # mcast_join = 239.2.11.71
  port = 8649
  bind = 192.168.66.30
  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
}

/* You can specify as many tcp_accept_channels as you like to share
   an xml description of the state of the cluster */
tcp_accept_channel {
  port = 8649
  # If you want to gzip XML output
  gzip_output = no
}

/* Channel to receive sFlow datagrams */
#udp_recv_channel {
#  port = 6343
#}

3.编辑从节点gmond.conf
cluster {
  name = "k8s-spark"
  owner = "unspecified"
  latlong = "unspecified"
  url = "unspecified"
}

/* The host section describes attributes of the host, like the location */
host {
  location = "unspecified"
}

/* Feel free to specify as many udp_send_channels as you like.  Gmond
   used to only support having a single channel */
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 = 192.168.66.30
  port = 8649
  ttl = 1
}

/* You can specify as many udp_recv_channels as you like as well. */
udp_recv_channel {
 # mcast_join = 239.2.11.71
  port = 8649
  # 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
}

/* You can specify as many tcp_accept_channels as you like to share
   an xml description of the state of the cluster */
tcp_accept_channel {
  port = 8649
  # If you want to gzip XML output
  gzip_output = no
}

/* Channel to receive sFlow datagrams */
#udp_recv_channel {
#  port = 6343
#}


4.将安装完成的ganglia软连接到/var/www/中
ln -s /usr/share/ganglia /var/www/

4.nginx服务器配置ganglia页面

打开php-fpm后,在/etc/php-fpm.d/www.conf中可以看到listen,将这个改为空闲端口

编写ganglia的网页文件
vim /usr/local/websites/sites-enabled/ganglia
server {
    listen 9255;(你要在网页查看的端口)
    server_name 192.168.66.30;(主节点ip)
    index index.html index.htm index.php;
    root /var/www/ganglia;(软连接目录)
 
 
    location / {
 try_files $uri $uri/ =404;
    }
 
    location ~ \.php$ {
 fastcgi_pass 127.0.0.1:9600; (监听的php端口)
 fastcgi_index index.php;
 include fastcgi_params;
 include fastcgi.conf;
    }
}

5.启动服务

systemctl start gmond
systemctl start gmetad
systemctl start nginx

6.查看页面

访问192.168.66.30:9255
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇
Theme Argon
本网站自 2020-12-24 12:00:00 起已运行