当前位置:网站首页>C alarm design
C alarm design
2022-07-05 12:27:00 【yang881221】
1 Alarm log module design
1.1 function analysis
The function of this module is to output the generated alarm to the serial port or log file
1.2 The basic principle
The alarm level output to the serial port defaults to info Level ; The alarm level output to the file defaults to alert Level , take alert And higher level information saved to file .
When other modules have alarms , call sysLogMsg(MODULEIDmodule, LEVELID level,const char * format, ...) Function to send an alarm message to the module , The incoming parameters have alarm module 、 Alarm level and message body . The module outputs the message to the serial port or saves it to a file according to the alarm module and alarm level .
If the message queue is full or the message length is greater than 256 byte , The message is discarded . For messages to be output to the serial port , direct printf Printout ; For messages to be saved to a file , For a while Buf in , And put the sign at 1, Each time will be Buf Before writing to the file , Use tick Count the interval between the last save time , When the interval is greater than the specified value , And the sign bit is 1 when , hold Buf Content in write to file .
1.3 Data structure design
typedef struct tagSysLogGlobalConfig {
int iCurrLofServer;
int iSendRate;
LOGHOST plServerList[SYSLOG_MAX_HOST];
LIST *plMsgBufList;
int iBufListSize;
BUFLISTELEMENT *ptBufInsertPos;
BUFLISTELEMENT *ptBufShowFirstPos;
int iConsoleSwitch;
int iConsoleServity;
ulong_t ulConsolMessages;
int iMonitorSwitch;
int iMonitorServity;
ulong_t ulMonitorMessages;
int iFileSwitch;
int iFileServity;
char * logFileName;
MSG_Q_ID logMsgQ;
int iLogSocket;
int iAppendTime;
int iGlobalSwitch;
ulong_t ulDropMessage;
SEM_ID semMemCpy;
} SYSLOGCONF;
typedef struct tagLogHost{
ulong_t ulIpAddr; /* Log host's IP Address */
ulong_t ulLevel; /* The output level of the log host */
ulong_t ulFacility; /*Unix System defined equipment number ,local0~local7(16~23);*/
ulong_t ulSwitch; /* Indicates whether the switch of the current log host is on ,0 To open */
ulong_t ulMsgSent; /* The number of discarded logs sent to this host */
ulong_t ulMsgdrop; /* Number of dropped messages */
ulong_t ulPort;
} LOGHOST;
typedef struct tagBufListElement{
NODE link;
ulong_t ulGetTick;
ulong_t ulSec;
char* buf;
ulong_t ulInUse;
int iModule; /*module */
int iLevel; /*message level*/
}BUFLISTELEMENT;
typedef struct tSYSLOGMODULE{
char *pcModuleName; /* Module name */
char *pcFacility; /**/
int iModuleDebugSwitch;
} SYSLOGMODULE;
边栏推荐
- Understand kotlin from the perspective of an architect
- byte2String、string2Byte
- A guide to threaded and asynchronous UI development in the "quick start fluent Development Series tutorials"
- How does MySQL execute an SQL statement?
- Correct opening method of redis distributed lock
- Select drop-down box realizes three-level linkage of provinces and cities in China
- Implementing Yang Hui triangle with cyclic queue C language
- 什么是数字化存在?数字化转型要先从数字化存在开始
- Get the variable address of structure member in C language
- Matlab struct function (structure array)
猜你喜欢

ZABBIX customized monitoring disk IO performance

Flutter2 heavy release supports web and desktop applications

Implementing Yang Hui triangle with cyclic queue C language

嵌入式软件架构设计-消息交互
Automated test lifecycle
Why do you always fail in automated tests?

Anaconda creates a virtual environment and installs pytorch

Take you hand in hand to develop a service monitoring component

July Huaqing learning-1

mysql拆分字符串做条件查询
随机推荐
Read and understand the rendering mechanism and principle of flutter's three trees
What is the difference between canvas and SVG?
图像超分实验:SRCNN/FSRCNN
Introduction to GNN
Learn JVM garbage collection 02 - a brief introduction to the reference and recycling method area
[HDU 2096] 小明A+B
Understand kotlin from the perspective of an architect
ZABBIX agent2 installation
MySQL data table operation DDL & data type
自动化测试生命周期
Complete activity switching according to sliding
Intern position selection and simplified career development planning in Internet companies
How does MySQL execute an SQL statement?
MySQL view
【ijkplayer】when i compile file “compile-ffmpeg.sh“ ,it show error “No such file or directory“.
POJ-2499 Binary Tree
ZABBIX 5.0 - LNMP environment compilation and installation
MySQL transaction
mysql拆分字符串做条件查询
GPS data format conversion [easy to understand]