本文共 10876 字,大约阅读时间需要 36 分钟。
[root@db-172-16-3-221 cpu]# cd /opt/ganglia-core-3.6.0/[root@db-172-16-3-221 ganglia-core-3.6.0]# lltotal 24drwxr-xr-x 2 root root 4096 Sep 9 11:03 bindrwxr-xr-x 3 root root 4096 Sep 15 09:31 etcdrwxr-xr-x 2 root root 4096 Sep 9 11:03 includedrwxr-xr-x 3 root root 4096 Sep 9 11:03 lib64drwxr-xr-x 2 root root 4096 Sep 9 11:03 sbindrwxr-xr-x 3 root root 4096 Sep 9 11:03 share[root@db-172-16-3-221 ganglia-core-3.6.0]# cd lib64/[root@db-172-16-3-221 lib64]# lltotal 660drwxr-xr-x 2 root root 4096 Sep 9 11:03 ganglialrwxrwxrwx 1 root root 25 Sep 9 11:03 libganglia-3.6.0.so.0 -> libganglia-3.6.0.so.0.0.0-rwxr-xr-x 1 root root 257554 Sep 9 11:03 libganglia-3.6.0.so.0.0.0-rw-r--r-- 1 root root 408276 Sep 9 11:03 libganglia.a-rwxr-xr-x 1 root root 1270 Sep 9 11:03 libganglia.lalrwxrwxrwx 1 root root 25 Sep 9 11:03 libganglia.so -> libganglia-3.6.0.so.0.0.0[root@db-172-16-3-221 lib64]# cd ganglia/[root@db-172-16-3-221 ganglia]# lltotal 700-rwxr-xr-x 1 root root 86896 Sep 9 11:03 modcpu.so-rwxr-xr-x 1 root root 84118 Sep 9 11:03 moddisk.so-rwxr-xr-x 1 root root 17896 Sep 9 11:03 modgstatus.so-rwxr-xr-x 1 root root 84078 Sep 9 11:03 modload.so-rwxr-xr-x 1 root root 85832 Sep 9 11:03 modmem.so-rwxr-xr-x 1 root root 31655 Sep 9 11:03 modmulticpu.so-rwxr-xr-x 1 root root 84480 Sep 9 11:03 modnet.so-rwxr-xr-x 1 root root 83862 Sep 9 11:03 modproc.so-rwxr-xr-x 1 root root 53954 Sep 9 11:03 modpython.so-rwxr-xr-x 1 root root 85136 Sep 9 11:03 modsys.so在gmond的配置文件中加载模块 :
# less /opt/ganglia-core-3.6.0/etc/gmond.conf/* Each metrics module that is referenced by gmond must be specified and loaded. If the module has been statically linked with gmond, it does not require a load path. However all dynamically loadable modules must include a load path. */modules { module { name = "core_metrics" } module { name = "cpu_module" path = "modcpu.so" } module { name = "disk_module" path = "moddisk.so" } module { name = "load_module" path = "modload.so" } module { name = "mem_module" path = "modmem.so" } module { name = "net_module" path = "modnet.so" } module { name = "proc_module" path = "modproc.so" } module { name = "sys_module" path = "modsys.so" }}
[root@db-172-16-3-221 ganglia-3.6.0]# gmetric --helpgmetric 3.6.0The Ganglia Metric Client (gmetric) announces a metricon the list of defined send channels defined in a configuration fileUsage: gmetric [OPTIONS]... -h, --help Print help and exit -V, --version Print version and exit -c, --conf=STRING The configuration file to use for finding send channels (default=`/opt/ganglia-core-3.6.0/etc/gmond.conf') -n, --name=STRING Name of the metric -v, --value=STRING Value of the metric -t, --type=STRING Either string|int8|uint8|int16|uint16|int32|uint32|float|double -u, --units=STRING Unit of measure for the value e.g. Kilobytes, Celcius (default=`') -s, --slope=STRING Either zero|positive|negative|both (default=`both') -x, --tmax=INT The maximum time in seconds between gmetric calls (default=`60') -d, --dmax=INT The lifetime in seconds of this metric (default=`0') -g, --group=STRING Group(s) of the metric (comma-separated) -C, --cluster=STRING Cluster of the metric -D, --desc=STRING Description of the metric -T, --title=STRING Title of the metric -S, --spoof=STRING IP address and name of host/device (colon separated) we are spoofing (default=`') -H, --heartbeat spoof a heartbeat message (use with spoof option)
[root@db-172-16-3-221 ganglia-3.6.0]# ps -ewf|grep gmondnobody 4271 1 0 15:51 ? 00:00:00 gmondroot 4930 26259 0 16:54 pts/2 00:00:00 grep gmond[root@db-172-16-3-221 ganglia-3.6.0]# netstat -anp|grep gmontcp 0 0 0.0.0.0:8649 0.0.0.0:* LISTEN 4271/gmond udp 0 0 172.16.3.221:63894 239.2.11.71:8649 ESTABLISHED 4271/gmond udp 0 0 239.2.11.71:8649 0.0.0.0:* 4271/gmond
[root@150 etc]# vi /opt/ganglia-core-3.6.0/etc/gmond.conf/* This configuration is as close to 2.5.x default behavior as possible The values closely match ./gmond/metric.h definitions in 2.5.x */globals { daemonize = yes setuid = yes user = nobody debug_level = 0 max_udp_msg_len = 1472 mute = no deaf = no allow_extra_data = yes host_dmax = 86400 /*secs. Expires (removes from web interface) hosts in 1 day */ host_tmax = 20 /*secs */ cleanup_threshold = 300 /*secs */ gexec = no # By default gmond will use reverse DNS resolution when displaying your hostname # Uncommeting following value will override that value. # override_hostname = "mywebserver.domain.com" # If you are not using multicast this value should be set to something other than 0. # Otherwise if you restart aggregator gmond you will get empty graphs. 60 seconds is reasonable send_metadata_interval = 0 /*secs */}/* * The cluster attributes specified will be used as part of the主机名和IP如下 :* tag that will wrap all hosts collected by this instance. */cluster { name = "test" owner = "digoal" latlong = "111 122" url = "http://dba.sky-mobi.com"}/* The host section describes attributes of the host, like the location */host { location = "1,2,4"}/* 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 port = 8649 ttl = 10}
[root@150 etc]# hostname150.sky-mobi.com[root@150 etc]# ifconfigem1 Link encap:Ethernet HWaddr 00:22:19:60:77:8F inet6 addr: fe80::222:19ff:fe60:778f/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:599238829 errors:0 dropped:0 overruns:0 frame:0 TX packets:67014382 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:882536084904 (821.9 GiB) TX bytes:8841108757 (8.2 GiB)lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:81579301 errors:0 dropped:0 overruns:0 frame:0 TX packets:81579301 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:15164677095 (14.1 GiB) TX bytes:15164677095 (14.1 GiB)ovirtmgmt Link encap:Ethernet HWaddr 00:22:19:60:77:8F inet addr:172.16.3.150 Bcast:172.16.3.255 Mask:255.255.255.0 inet6 addr: fe80::222:19ff:fe60:778f/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:93718326 errors:0 dropped:0 overruns:0 frame:0 TX packets:86213477 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:1098952054073 (1023.4 GiB) TX bytes:11330242206 (10.5 GiB)ovirtmgmt:1 Link encap:Ethernet HWaddr 00:22:19:60:77:8F inet addr:172.16.13.150 Bcast:172.16.13.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1首先要启动gmond, (当然, 不启动也可以, 启动gmond除了可以发心跳包, 还可以将location等基础信息发过去)
Usage: gmetric [OPTIONS]... -h, --help Print help and exit -V, --version Print version and exit -c, --conf=STRING The configuration file to use for finding send channels (default=`/opt/ganglia-core-3.6.0/etc/gmond.conf') -n, --name=STRING Name of the metric -v, --value=STRING Value of the metric -t, --type=STRING Either string|int8|uint8|int16|uint16|int32|uint32|float|double -u, --units=STRING Unit of measure for the value e.g. Kilobytes, Celcius (default=`') -s, --slope=STRING Either zero|positive|negative|both (default=`both') -x, --tmax=INT The maximum time in seconds between gmetric calls (default=`60') -d, --dmax=INT The lifetime in seconds of this metric (default=`0') -g, --group=STRING Group(s) of the metric (comma-separated) -C, --cluster=STRING Cluster of the metric -D, --desc=STRING Description of the metric -T, --title=STRING Title of the metric -S, --spoof=STRING IP address and name of host/device (colon separated) we are spoofing (default=`') -H, --heartbeat spoof a heartbeat message (use with spoof option)[root@150 etc]# gmetric -c /opt/ganglia-core-3.6.0/etc/gmond.conf -n load_one -v 1.0 -t float -s both -x 20 -g load -C test -D "load per min" -T "load one"例如在172.16.3.150模拟发送172.16.3.151的metric信息 :
[root@150 etc]# gmetric -c /opt/ganglia-core-3.6.0/etc/gmond.conf -n load_one -v 1.0 -t float -s both -x 20 -g load -C test -D "load per min" -T "load one" -S "172.16.3.151:digoal_host"
[root@150 etc]# gmetric -c /opt/ganglia-core-3.6.0/etc/gmond.conf -n load_one -v 1.0 -t float -s both -x 20 -g load -C test -D "load per min" -T "load one" -S "172.16.3.151:digoal_host" -H
[root@db-172-16-3-221 kernel-doc-2.6.32]# netstat -anp|grep gmondtcp 0 0 0.0.0.0:8649 0.0.0.0:* LISTEN 4271/gmond udp 0 0 172.16.3.221:63894 239.2.11.71:8649 ESTABLISHED 4271/gmond udp 0 0 239.2.11.71:8649 0.0.0.0:* 4271/gmond
转载地址:http://wkaca.baihongyu.com/