Solve the Problem of starting the Python module after Ganglia is added
Recently added the Python module of Ganglia, and found that the gmond. init file provided by the Ganglia official source code package is unavailable.
Python is compiled by yourself. If Python is installed in the system rpm package, this problem will not occur.
For example, if the gmond service is started, a message indicating success is displayed. But there is no gmond process in ps. So we studied the gmond. init file.
There is no problem with service gmond stop, and there is no problem with manual gmond command execution. The key is the start parameter, so the code to solve the problem is mainly the following lines:
#! /Bin/sh
#
# Chkconfig: 2345 70 40
# Description: gmond startup script
#
GMOND =/usr/sbin/gmond
# TMPDIR set to SysV IPC ramdrive to avoid include processing failures
TMPDIR =/dev/shm
Export TMPDIR
./Etc/rc. d/init. d/functions
RETVAL = 0
Case "$1" in
Start)
Echo-n "Starting GANGLIA gmond :"
[-F $ GMOND] | exit 1
Daemon $ GMOND
RETVAL =$?
Echo
[$ RETVAL-eq 0] & touch/var/lock/subsys/gmond
;
Because Python is compiled by myself, I think the problem is probably caused by environment variables. Then two lines of code are added, and the following code is added:
- #! /Bin/sh
- #
- # Chkconfig: 2345 70 40
- # Description: gmond startup script
- #
- GMOND =/usr/sbin/gmond
- # TMPDIR set to SysV IPC ramdrive to avoid include processing failures
- TMPDIR =/dev/shm
- Export TMPDIR
- TPATH = $ PATH
- ./Etc/rc. d/init. d/functions
- PATH = $ TPATH
- RETVAL = 0
- Case "$1" in
- Start)
- Echo-n "Starting GANGLIA gmond :"
- [-F $ GMOND] | exit 1
- Daemon $ GMOND
- RETVAL =$?
- Echo
- [$ RETVAL-eq 0] & touch/var/lock/subsys/gmond
- ;
After the code is changed, there is no problem in using/etc/init. d/gmond for execution, so it must be a problem with the PATH of the environment variable. As mentioned above, my python is compiled by myself. In order not to affect yum, I connect to/usr/local/bin/python, the PATH variable defined by the service gmond start command is defined by the service script instead of defined by the current shell user. Therefore, if I modify the code as follows, it will be okay:
- #! /Bin/sh
- #
- # Chkconfig: 2345 70 40
- # Description: gmond startup script
- #
- GMOND =/usr/sbin/gmond
- # TMPDIR set to SysV IPC ramdrive to avoid include processing failures
- TMPDIR =/dev/shm
- Export TMPDIR
- ./Etc/rc. d/init. d/functions
- PATH =/usr/local/bin: $ PATH
- RETVAL = 0
- Case "$1" in
- Start)
- Echo-n "Starting GANGLIA gmond :"
- [-F $ GMOND] | exit 1
- Daemon $ GMOND
- RETVAL =$?
- Echo
- [$ RETVAL-eq 0] & touch/var/lock/subsys/gmond
- ;
Use Ganglia to monitor Hadoop Clusters
Install and configure Hadoop and Ganglia in Ubuntu of VMware Workstation
Create a Grid
Ganglia installation tutorial yum
Ganglia Quick Start Guide (translated from the official wiki)
Install Ganglia-3.6.0 monitoring Hadoop-2.2.0 and HBase-0.96.0 on CentOS Cluster
Install Ganglia on CentOS 6.5
Install Ganglia on Ubuntu 14.04 Server
This article permanently updates the link address: