[关闭]
@wenshizhang 2016-10-25T16:43:34.000000Z 字数 4025 阅读 383

classes descriptions about hb_report


class node

The father of master and collector,abstract some common features.

member variable

member variable description
SLAVE this is a collector node or not
SSH_PASSWD ssh password
WE this cluster node's name
WORKDIR temp directory of result
THIS_IS_NODE this is a legitimate node

member function

member function description
compatibility_pcmk found directories of crm,heatrt beat and so on
get_cluster_type found out the type of cluster
get_conf get CONF variable
check_this_is_node check the master node in the node list or not
getlog get the log
mktar() create the tarball use Specific name

class master

member variable

member variable description
SUDO change user to root command
LOCAL_SUDO change user to root command
ENVIRONMENT envir instance

NOTE:
1.Suppose this situation, the user is not running hb_report as a root, which is allowed. However,because of the collection of information collected from journalctl,it is necessary as a root user when you need to ssh to the collector node. Therefore, before testing ssh, you need to test the current user. If not the root user, you need to save the switch to the root user command. SUDO save ssh to the collector node when switching the root user command, LOCAL_SUDO save the master node to switch to the root user The command
2.Yes, even in the master node, wo still use class collector to clollect log.

member function

member function description
analyzed_argvments() analyze parameters that user input
mktemp() create the temp directory in /tmp
is_node() check the node name that user input is a real node or not
find_ssh_user() find the ssh user and ssh patameters
find_sudo() find SUDO and LOCAL_SUDO
change_time() change user input time to system log time form
collect_for_nodes() check ssh need password or not
start_collect() create subprocess to ssh collector and collect log
analyzed() analyze result
check_if_log_is_empty() check the result that return from collector is empty or not
finalword() print final message
send_envir() send envit member variable to collector node
__init__() class master init function
run() class master run function

NOTE:
1.Start_collect function just do some check stuff and create subprocess(if ssh doesn't need password) ssh to collector node run collector script collect.This is the way to collect collector node log, for the master node, create collector instance then collect log
2.If cluster node need ssh password, then cannot create the new process collect log.
3.ENVIRONMENT member variable is the class envir instance,assign value in the master class,then use function send_envir create xml file send the ENVIRONMENT to collector node
4.Class master_node init function have one parameter——class envir instance


class collector

member variable

member variable description
ENVIRONMENT class envir instance

member function

member function descript
mktemp() create temp directory in the /tmp
collect_info() real collect log function
return_result() collector node return result to master node
get_envir() get ENVIRONMENT from master node
__init__ class collector init function
run() class collector run function

NOTE:
1.In order to reduce the network pressure,the result return from collector node is tarball
2.Master node ssh to collector node,then run the collector script


class envir

member variable

member variable description
FROM_TIME collection start time
TO_TIME collection end time
NODE_SOURCE node source
USER_NODES node list that user input
SSH_USER ssh user(default root and hacluster)
SSH_OPTS ssh opts
DEST result tarball name
HA_LOG the location of log
EDITOR user's favourite text editor
SANITIZE like the shell script
DO_SANITIZE like the shell script
SKIP_LVL quickly collect
LOG_PATTERNS
NO_SSH only collect master node log
NO_DESCRIPTION don't fit in any editor
FORCE_TO_REMOYE if already have the tarball, delete tarball then run
EXTRA_LOGS extra log
USER_CLUSTER_TYPE cluster type
VERBOSITY hb_report version
COMPRESS Don’t create the compressed tar
SSH_PASSWD_NODES nodes which need ssh password
LOGD_CF the location of logd.cf
ANALYSIS_F analysis.txt file
DESCRIPTION_F description.txt file
HALOG_F ha-log.txt file
JOURNAL_F journal.log file
BT_F backtrace.txt file
SYSINFO_F sysinfo.txt file
SYSSTATS_F sysstats.txt file
DLM_DUMP_F dlm_dump.txt file
TIME_F time.txt file
CRM_MON_F crm_mon.txt file
MEMBERSHIP_F member.txt file
HB_UUID_F hb_uuid.txt file
HOSTCACHE hostcache file
CRM_VERITY_F crm_verity.txt file
PERMISSIONS_F permossion.txt file
CIB_F cib.xml file
CIB_TXT_F cib.txt file
COROSYNC_RECOERED_F fdata.txt file
CONFIGURATIONS

member function

member function description
__init__() set default value to some member variable
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注