4

修改ganglia指标保存目录

 2 years ago
source link: https://houye.xyz/2017-01/ganglia/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
修改ganglia指标保存目录

修改ganglia指标保存目录

假设要把指标数据保存到目录 /data/rrds 下面

新建新的指标保存目录并修改目录所有者

mkdir -v /data/rrds
chown -R nobody:nobody /data/rrds

修改指标保存位置

ganglia 指标数据默认保存在/var/lib/ganglia/rrds/ 下

vim /etc/ganglia/gmetad.conf
修改
# rrd_rootdir  "/some/other/place"
为
rrd_rootdir  "/data/rrds"

停止gmetad

service gmetad stop

迁移旧指标数据

cd /var/lib/ganglia/rrds
cp -r * /data/rrds/

启动gmetad

service gmetad start

修改gweb读取指标数据的位置

vim  /var/www/html/gweb/conf_default.php
修改
$conf['gmetad_root'] = "/var/lib/ganglia/;
$conf['rrds'] = "${conf['gmetad_root']}/rrds";
为
$conf['gmetad_root'] = "/data;
$conf['rrds'] = "${conf['gmetad_root']}/rrds";

访问gweb前台 查看显示是否正常

#################脚本######################################
mkdir -v /data/rrds
chown -R nobody:nobody /data/rrds
sed -i.bak 's$# rrd_rootdir "/some/other/place"$rrd_rootdir "/data/rrds"$g' /etc/ganglia/gmetad.conf
sed -i.bak 's#/var/lib/ganlia#/data#g' /var/www/html/gweb/conf_default.php
service gmetad restart

cd /var/lib/ganglia/rrds
rm -rf *

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK