This commit is contained in:
biosvos
2026-08-07 17:38:18 +09:00
commit 873193a243
9613 changed files with 2755992 additions and 0 deletions
+127
View File
@@ -0,0 +1,127 @@
/****************************************************************************
Shared memory define for rc_mond ( Revision 1440 )
-----------------------------------------
begin : 2015/06/09
copyright : (C) 2005 Solbox Inc.
author : Dev Storage Team
email : huibong@solbox.com
version : 3.5
CopyRight(C) 2005 Solbox Inc. All Rights reserved.
Redistribution and use in source and binary forms, with or with out
modification, are not permitted in outside of Solbox Inc.
*****************************************************************************/
#ifndef __SHM_DEFINE_H__
#define __SHM_DEFINE_H__
#include <unistd.h>
#include <sys/types.h>
#include <stdint.h>
#include <time.h>
// hostname 최대 길이.
#define HOST_NAME_LENGTH 63
// client ip 주소 저장을 위한 최대 크기값
// - NULL 포함 40자까지, IPv6 지원 목적
#define IP_ADDR_LENGTH 40
// Service 상태 코드 정의
#define SERVICE_STAT_OK 0 // 정상 상태
#define SERVICE_STAT_OUT 1 // 수동 중지 상태
#define SERVICE_STAT_DISABLE 2 // 서비스 불가 상태
#define SERVICE_STAT_RONLY 3 // Read Only 상태
// ShmDefine.h 에서 정의된 서비스 상태 코드 외에 미정의된 코드 처리를 위한 정의
#define SERVICE_STAT_NOT_DEFINE -1
// rc_monde src/Makefile 에 정의된 값
#define MAX_CLIENT_COUNT 1024
#ifdef __cplusplus
extern "C" {
#endif
// 각 Client 로 부터 수신된 정보를 저장하기 위한 공유메모리 정의 파일
// - 공유메모리 관련 상세 내역은 rc_mond 설계서 의 공유메모리 구조 항목을 참고할 것.
// Service 상태 정보
struct ServiceInfo {
time_t update_time; // 최종 update 시간 (local time, 시간동기화 영향 받음)
int service_stat; // Service 상태 code. ( -1: 정보 미수신 상태, 그외 csagentd 설정과 동일)
time_t update_time_clock_sec; // clock_gettime(CLOCK_MONOTONIC) 을 통해 추출된 sec 정보. expire 여부 판단을 위해 사용.
};
// System 상태 정보
struct SystemInfo {
time_t update_time; // 최종 update 시간
double load_avg[3]; // load average.
uint64_t memory_total; // Total memory size (byte 단위)
uint64_t memory_free; // Free memory size (byte 단위)
int memory_usage; // memory 사용률 (%)
uint64_t swap_total; // Total swap size (byte 단위)
uint64_t swap_used; // Used swap size (byte 단위)
int swap_usage; // swap 사용률 (%)
uint64_t storage_total; // Total Storage size (byte 단위)
uint64_t storage_avail; // Available Storage size (byte 단위)
int storage_max_usage; // Storage 중 최대 사용률 (%)
uint64_t disk_max_queue; // Disk 상태 정보 중 Max Queue Length
double disk_max_busy; // Disk 상태 정보 중 Max busy(%)
uint64_t network_packet_in; // Network inbound packet 평균 count (count/sec)
uint64_t network_packet_out; // Network outbound packet 평균 count (count/sec)
uint64_t network_traffic_in; // Network inbound 평균 traffic (Byte/sec)
uint64_t network_traffic_out; // Network outbound 평균 traffic (Byte/sec)
unsigned int tcp_total; // TCP 세션 total count
unsigned int tcp_80; // TCP 세션 중 local 80 port 를 사용하는 세션 count
unsigned int tcp_80_establish; // TCP 세션 중 local 80 port 를 사용하고.. ESTABLISH 상태인 세션 count
};
// Shared momory 상의 각 slot 구성 정보.
struct ClientInfo {
int use; // 해당 공유메모리 slot 사용 여부 (0 : 미사용, 1 : 사용 중)
int valid; // 해당 공유메모리에 저장된 data 의 유효성 여부, (0 : 유효 안함, 1 : 유효)
char client_ip[IP_ADDR_LENGTH]; // Client IP 주소, NULL 포함 40자까지, IPv6 지원 목적
int client_app; // 해당 공유메모리 slot 의 Data 가 어느 프로그램에서 수신되었는지 정의 (0 : csagentd, 1 : vmasd)
char hostname[HOST_NAME_LENGTH + 1]; // hostname, NULL 포함 최대 64자까지만 허용. 각 장비를 구분하는 Key 값으로 사용.
struct ServiceInfo service; // 수신된 서비스 상태 정보 저장
struct SystemInfo system; // 수신된 System 상태 정보 저장
};
// Shared Memory 전체 구조
struct RcInfo {
int client_max_index; // FHS Client 정보 중 유효한 slot 의 최대 Index 정보.
struct ClientInfo client[MAX_CLIENT_COUNT]; // 각 FHS Client 정보.
// 향후 RCDB, RCTS 는 수집 항목이 다르므로.. 아래에 새로 정의하여 확장 처리한다.
};
#ifdef __cplusplus
}
#endif
#endif /* __SHM_DEFINE_H__ */