104 lines
4.2 KiB
C
104 lines
4.2 KiB
C
|
/*************************************************************************
|
||
|
> File Name : CJudgeSysInfo.h
|
||
|
> Author : FengChao
|
||
|
> EMail : smile.fengchao@gmail.com
|
||
|
> Created Time : Fri 17 Jul 2020 09:47:20 AM CST
|
||
|
************************************************************************/
|
||
|
|
||
|
#ifndef CJUDGE_SYS_INFO_H
|
||
|
#define CJUDGE_SYS_INFO_H
|
||
|
|
||
|
|
||
|
#include "CTypedef.h"
|
||
|
#include "CJudgeUtils.h"
|
||
|
|
||
|
#define MAX_MSG_BUFFER 1024 // 通信消息缓存区
|
||
|
#define TIME_OUT_JUDGE 30 // 超时裁决时间
|
||
|
|
||
|
|
||
|
|
||
|
class CJudgeSysInfo : public CSingleton<CJudgeSysInfo>
|
||
|
{
|
||
|
public:
|
||
|
CJudgeSysInfo();
|
||
|
~CJudgeSysInfo();
|
||
|
void Init();
|
||
|
void RcvNosStateMessage();
|
||
|
private:
|
||
|
int StartMultiThreadJudge();
|
||
|
void JudgeSysState(); // 裁决系统运行状态
|
||
|
void JudgeProcessState(); // 裁决系统进程状态
|
||
|
void JudgeFileState(); // 裁决关键文件状态
|
||
|
void JudgeFileNum(); // 裁决关键文件数量
|
||
|
void JudgeSysLog(); // 裁决系统关键日志
|
||
|
|
||
|
static void AlarmJudgeSysState(int sig); // 系统状态超时裁决
|
||
|
|
||
|
void StartJudgeSysState(); // 开始裁决系统运行状态
|
||
|
void StartJudgeProcessState(); // 开始裁决系统进程状态
|
||
|
void StartJudgeFileState(); // 开始裁决关键文件状态
|
||
|
void StartJudgeFileNum(); // 开始裁决关键文件数量
|
||
|
void StartJudgeSysLog(); // 开始裁决系统关键日志
|
||
|
|
||
|
void JudgeCpuOccupy(uint current_cpu_occupy, uint nos_id);
|
||
|
void JudgeMemOccupy();
|
||
|
void JudgeTcpSocket();
|
||
|
void JudgeProcessNum();
|
||
|
void JudgeLoginLog();
|
||
|
void JudgeCmdLog();
|
||
|
void JudgeUserInfo();
|
||
|
void JudgeGroupInfo();
|
||
|
void JudgeCronNum();
|
||
|
void JudgePathFileNum();
|
||
|
void JudgeHomeFileNum();
|
||
|
void JudgeAppMd5();
|
||
|
void JudgeAutoStartMd5();
|
||
|
void JudgeManagerProgress();
|
||
|
void JudgeProtocolProgress();
|
||
|
void JudgeLocalConfigManager();
|
||
|
void JudgeFirewell();
|
||
|
|
||
|
|
||
|
// 消息解析函数
|
||
|
SystemState_T SplitMsgToSysState(char *buffer, int len_Buffer);
|
||
|
ProcessState_T SplitMsgToProcessState(char *buffer, int len_Buffer);
|
||
|
FileState_T SplitMsgToFileState(char *buffer, int len_Buffer);
|
||
|
FileNum_T SplitMsgToFileNum(char *buffer, int len_Buffer);
|
||
|
SysLog_T SplitMsgToSysLog(char *buffer, int len_Buffer);
|
||
|
|
||
|
uint GetNosId(char ip[32]);
|
||
|
|
||
|
private:
|
||
|
int nos_num;
|
||
|
uint running_num;
|
||
|
|
||
|
SystemState_T m_SysState; // 系统运行状态消息
|
||
|
ProcessState_T m_ProcessState; // 关键进程状态消息
|
||
|
FileState_T m_FileState; // 关键文件状态消息
|
||
|
FileNum_T m_FileNum; // 关键文件数量消息
|
||
|
SysLog_T m_SysLog; // 关键日志增量消息
|
||
|
std::list<SystemState_T> ml_SysState; // 系统运行状态消息组
|
||
|
std::list<ProcessState_T> ml_ProcessState; // 关键进程状态消息组
|
||
|
std::list<FileState_T> ml_FileState; // 关键文件状态消息组
|
||
|
std::list<FileNum_T> ml_FileNum; // 关键文件数量消息组
|
||
|
std::list<SysLog_T> ml_SysLog; // 关键日志增量消息组
|
||
|
|
||
|
// Judge_sys_info
|
||
|
std::string user_md5;
|
||
|
std::string group_md5;
|
||
|
std::string config_manager_md5;
|
||
|
std::string auto_start_md5;
|
||
|
|
||
|
uint nos_monitor_port;
|
||
|
uint cpu_occupy_max;
|
||
|
uint mem_occupy_max;
|
||
|
uint tcp_socket_max;
|
||
|
uint progress_max;
|
||
|
uint cron_max;
|
||
|
uint path_file_max;
|
||
|
uint home_file_max;
|
||
|
};
|
||
|
|
||
|
|
||
|
#endif
|