知识共享许可协议
本作品采用知识共享署名-非商业性使用-禁止演绎 3.0 未本地化版本许可协议进行许可。

更新源
vim /etc/apt/sources.list

deb http://mirrors.aliyun.com/ubuntu/ precise main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ precise-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ precise-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ precise-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ precise main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ precise-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ precise-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ precise-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ precise-backports main restricted universe multiverse

apt-get update
安装依赖包
apt-get install pkg-config libapr1-dev zlib1g-dev libconfuse-dev libexpat1-dev libpcre3-dev daemon sysv-rc-conf
安装Ganglia gmond
http://ganglia.info/

wget http://sourceforge.net/projects/ganglia/files/ganglia%20monitoring%20core/3.6.0/ganglia-3.6.0.tar.gz/download -O ~/ganglia-3.6.0.tar.gz
tar zxvf ganglia-3.6.0.tar.gz
cd ganglia-3.6.0

./configure --prefix=/usr/local/ganglia-3.6.0 --enable-gexec --enable-status --with-libconfuse --with-zlib
make
make install
配置
  • 设置软链接

    ln -s /usr/local/ganglia-3.6.0/sbin/gmond /usr/bin/gmond
    
  • 复制服务启动文件

    cp ~/ganglia-3.6.0/gmond/gmond.init /etc/init.d/gmond
    sysv-rc-conf gmond on
    
  • 修改启动文件

    vim /etc/init.d/gmond
    
    GMOND=/usr/local/ganglia-3.6.0/sbin/gmond
    
    /etc/rc.d/init.d/functions 
    修改成
    /lib/lsb/init-functions
    
    daemon $GMETAD -c /etc/ganglia/gmond.conf
    
  • 生成初始文件

    mkdir -p /var/lock/subsys
    mkdir -p /usr/local/ganglia-3.6.0/lib64/ganglia/python_modules 
    mkdir -p /etc/ganglia
    gmond -t | tee /etc/ganglia/gmond.conf
    
  • 修改gmond.conf

    vim /etc/ganglia/gmond.conf
    
    cluster {
        name = "ganglia.monitor"
        owner = "unspecified"
        latlong = "unspecified"
        url = "unspecified"
    }
    
    udp_send_channel {
        host = ganglia.monitor
        port = 8649
        ttl = 1
    }
    
    udp_recv_channel {
        port = 8649
    }
    tcp_accept_channel {
        port = 8649
    }
    
  • 启动

    service gmond start