fix/TD-30989
This commit is contained in:
parent
235712b79e
commit
6a2e9118bd
|
@ -45,11 +45,11 @@ static FORCE_INLINE void auditDeleteRecord(SAuditRecord * record) {
|
||||||
|
|
||||||
void auditCleanup() {
|
void auditCleanup() {
|
||||||
tsLogFp = NULL;
|
tsLogFp = NULL;
|
||||||
taosThreadMutexLock(&tsAudit.lock);
|
(void)taosThreadMutexLock(&tsAudit.lock);
|
||||||
taosArrayDestroyP(tsAudit.records, (FDelete)auditDeleteRecord);
|
taosArrayDestroyP(tsAudit.records, (FDelete)auditDeleteRecord);
|
||||||
taosThreadMutexUnlock(&tsAudit.lock);
|
(void)taosThreadMutexUnlock(&tsAudit.lock);
|
||||||
tsAudit.records = NULL;
|
tsAudit.records = NULL;
|
||||||
taosThreadMutexDestroy(&tsAudit.lock);
|
(void)taosThreadMutexDestroy(&tsAudit.lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void auditRecordImp(SRpcMsg *pReq, int64_t clusterId, char *operation, char *target1, char *target2,
|
extern void auditRecordImp(SRpcMsg *pReq, int64_t clusterId, char *operation, char *target1, char *target2,
|
||||||
|
|
|
@ -100,7 +100,7 @@ extern char* tsMonFwUri;
|
||||||
#define VNODE_ROLE "taosd_vnodes_info:role"
|
#define VNODE_ROLE "taosd_vnodes_info:role"
|
||||||
|
|
||||||
void monInitMonitorFW(){
|
void monInitMonitorFW(){
|
||||||
taos_collector_registry_default_init();
|
(void)taos_collector_registry_default_init();
|
||||||
|
|
||||||
tsMonitor.metrics = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
|
tsMonitor.metrics = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
|
||||||
taos_gauge_t *gauge = NULL;
|
taos_gauge_t *gauge = NULL;
|
||||||
|
@ -115,9 +115,9 @@ void monInitMonitorFW(){
|
||||||
for(int32_t i = 0; i < 25; i++){
|
for(int32_t i = 0; i < 25; i++){
|
||||||
gauge= taos_gauge_new(dnodes_gauges[i], "", dnodes_label_count, dnodes_sample_labels);
|
gauge= taos_gauge_new(dnodes_gauges[i], "", dnodes_label_count, dnodes_sample_labels);
|
||||||
if(taos_collector_registry_register_metric(gauge) == 1){
|
if(taos_collector_registry_register_metric(gauge) == 1){
|
||||||
taos_counter_destroy(gauge);
|
(void)taos_counter_destroy(gauge);
|
||||||
}
|
}
|
||||||
taosHashPut(tsMonitor.metrics, dnodes_gauges[i], strlen(dnodes_gauges[i]), &gauge, sizeof(taos_gauge_t *));
|
(void)taosHashPut(tsMonitor.metrics, dnodes_gauges[i], strlen(dnodes_gauges[i]), &gauge, sizeof(taos_gauge_t *));
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t dnodes_data_label_count = 5;
|
int32_t dnodes_data_label_count = 5;
|
||||||
|
@ -126,9 +126,10 @@ void monInitMonitorFW(){
|
||||||
for(int32_t i = 0; i < 3; i++){
|
for(int32_t i = 0; i < 3; i++){
|
||||||
gauge= taos_gauge_new(dnodes_data_gauges[i], "", dnodes_data_label_count, dnodes_data_sample_labels);
|
gauge= taos_gauge_new(dnodes_data_gauges[i], "", dnodes_data_label_count, dnodes_data_sample_labels);
|
||||||
if(taos_collector_registry_register_metric(gauge) == 1){
|
if(taos_collector_registry_register_metric(gauge) == 1){
|
||||||
taos_counter_destroy(gauge);
|
(void)taos_counter_destroy(gauge);
|
||||||
}
|
}
|
||||||
taosHashPut(tsMonitor.metrics, dnodes_data_gauges[i], strlen(dnodes_data_gauges[i]), &gauge, sizeof(taos_gauge_t *));
|
(void)taosHashPut(tsMonitor.metrics, dnodes_data_gauges[i], strlen(dnodes_data_gauges[i]), &gauge,
|
||||||
|
sizeof(taos_gauge_t *));
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t dnodes_log_label_count = 4;
|
int32_t dnodes_log_label_count = 4;
|
||||||
|
@ -137,15 +138,16 @@ void monInitMonitorFW(){
|
||||||
for(int32_t i = 0; i < 3; i++){
|
for(int32_t i = 0; i < 3; i++){
|
||||||
gauge= taos_gauge_new(dnodes_log_gauges[i], "", dnodes_log_label_count, dnodes_log_sample_labels);
|
gauge= taos_gauge_new(dnodes_log_gauges[i], "", dnodes_log_label_count, dnodes_log_sample_labels);
|
||||||
if(taos_collector_registry_register_metric(gauge) == 1){
|
if(taos_collector_registry_register_metric(gauge) == 1){
|
||||||
taos_counter_destroy(gauge);
|
(void)taos_counter_destroy(gauge);
|
||||||
}
|
}
|
||||||
taosHashPut(tsMonitor.metrics, dnodes_log_gauges[i], strlen(dnodes_log_gauges[i]), &gauge, sizeof(taos_gauge_t *));
|
(void)taosHashPut(tsMonitor.metrics, dnodes_log_gauges[i], strlen(dnodes_log_gauges[i]), &gauge,
|
||||||
|
sizeof(taos_gauge_t *));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void monCleanupMonitorFW(){
|
void monCleanupMonitorFW(){
|
||||||
taosHashCleanup(tsMonitor.metrics);
|
taosHashCleanup(tsMonitor.metrics);
|
||||||
taos_collector_registry_destroy(TAOS_COLLECTOR_REGISTRY_DEFAULT);
|
(void)taos_collector_registry_destroy(TAOS_COLLECTOR_REGISTRY_DEFAULT);
|
||||||
TAOS_COLLECTOR_REGISTRY_DEFAULT = NULL;
|
TAOS_COLLECTOR_REGISTRY_DEFAULT = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,7 +167,7 @@ void monGenClusterInfoTable(SMonInfo *pMonitor){
|
||||||
uError("failed to delete metric %s", metric_names[i]);
|
uError("failed to delete metric %s", metric_names[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
taosHashRemove(tsMonitor.metrics, metric_names[i], strlen(metric_names[i]));
|
(void)taosHashRemove(tsMonitor.metrics, metric_names[i], strlen(metric_names[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pBasicInfo->cluster_id == 0) {
|
if(pBasicInfo->cluster_id == 0) {
|
||||||
|
@ -182,9 +184,9 @@ void monGenClusterInfoTable(SMonInfo *pMonitor){
|
||||||
for(int32_t i = 0; i < 18; i++){
|
for(int32_t i = 0; i < 18; i++){
|
||||||
gauge= taos_gauge_new(metric_names[i], "", label_count, sample_labels1);
|
gauge= taos_gauge_new(metric_names[i], "", label_count, sample_labels1);
|
||||||
if(taos_collector_registry_register_metric(gauge) == 1){
|
if(taos_collector_registry_register_metric(gauge) == 1){
|
||||||
taos_counter_destroy(gauge);
|
(void)taos_counter_destroy(gauge);
|
||||||
}
|
}
|
||||||
taosHashPut(tsMonitor.metrics, metric_names[i], strlen(metric_names[i]), &gauge, sizeof(taos_gauge_t *));
|
(void)taosHashPut(tsMonitor.metrics, metric_names[i], strlen(metric_names[i]), &gauge, sizeof(taos_gauge_t *));
|
||||||
}
|
}
|
||||||
|
|
||||||
char buf[TSDB_CLUSTER_ID_LEN] = {0};
|
char buf[TSDB_CLUSTER_ID_LEN] = {0};
|
||||||
|
@ -194,37 +196,37 @@ void monGenClusterInfoTable(SMonInfo *pMonitor){
|
||||||
taos_gauge_t **metric = NULL;
|
taos_gauge_t **metric = NULL;
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, MASTER_UPTIME, strlen(MASTER_UPTIME));
|
metric = taosHashGet(tsMonitor.metrics, MASTER_UPTIME, strlen(MASTER_UPTIME));
|
||||||
taos_gauge_set(*metric, pInfo->master_uptime, sample_label_values);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pInfo->master_uptime, sample_label_values);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, DBS_TOTAL, strlen(DBS_TOTAL));
|
metric = taosHashGet(tsMonitor.metrics, DBS_TOTAL, strlen(DBS_TOTAL));
|
||||||
taos_gauge_set(*metric, pInfo->dbs_total, sample_label_values);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pInfo->dbs_total, sample_label_values);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, TBS_TOTAL, strlen(TBS_TOTAL));
|
metric = taosHashGet(tsMonitor.metrics, TBS_TOTAL, strlen(TBS_TOTAL));
|
||||||
taos_gauge_set(*metric, pInfo->tbs_total, sample_label_values);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pInfo->tbs_total, sample_label_values);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, STBS_TOTAL, strlen(STBS_TOTAL));
|
metric = taosHashGet(tsMonitor.metrics, STBS_TOTAL, strlen(STBS_TOTAL));
|
||||||
taos_gauge_set(*metric, pInfo->stbs_total, sample_label_values);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pInfo->stbs_total, sample_label_values);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, VGROUPS_TOTAL, strlen(VGROUPS_TOTAL));
|
metric = taosHashGet(tsMonitor.metrics, VGROUPS_TOTAL, strlen(VGROUPS_TOTAL));
|
||||||
taos_gauge_set(*metric, pInfo->vgroups_total, sample_label_values);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pInfo->vgroups_total, sample_label_values);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, VGROUPS_ALIVE, strlen(VGROUPS_ALIVE));
|
metric = taosHashGet(tsMonitor.metrics, VGROUPS_ALIVE, strlen(VGROUPS_ALIVE));
|
||||||
taos_gauge_set(*metric, pInfo->vgroups_alive, sample_label_values);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pInfo->vgroups_alive, sample_label_values);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, VNODES_TOTAL, strlen(VNODES_TOTAL));
|
metric = taosHashGet(tsMonitor.metrics, VNODES_TOTAL, strlen(VNODES_TOTAL));
|
||||||
taos_gauge_set(*metric, pInfo->vnodes_total, sample_label_values);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pInfo->vnodes_total, sample_label_values);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, VNODES_ALIVE, strlen(VNODES_ALIVE));
|
metric = taosHashGet(tsMonitor.metrics, VNODES_ALIVE, strlen(VNODES_ALIVE));
|
||||||
taos_gauge_set(*metric, pInfo->vnodes_alive, sample_label_values);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pInfo->vnodes_alive, sample_label_values);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, CONNECTIONS_TOTAL, strlen(CONNECTIONS_TOTAL));
|
metric = taosHashGet(tsMonitor.metrics, CONNECTIONS_TOTAL, strlen(CONNECTIONS_TOTAL));
|
||||||
taos_gauge_set(*metric, pInfo->connections_total, sample_label_values);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pInfo->connections_total, sample_label_values);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, TOPICS_TOTAL, strlen(TOPICS_TOTAL));
|
metric = taosHashGet(tsMonitor.metrics, TOPICS_TOTAL, strlen(TOPICS_TOTAL));
|
||||||
taos_gauge_set(*metric, pInfo->topics_toal, sample_label_values);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pInfo->topics_toal, sample_label_values);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, STREAMS_TOTAL, strlen(STREAMS_TOTAL));
|
metric = taosHashGet(tsMonitor.metrics, STREAMS_TOTAL, strlen(STREAMS_TOTAL));
|
||||||
taos_gauge_set(*metric, pInfo->streams_total, sample_label_values);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pInfo->streams_total, sample_label_values);
|
||||||
|
|
||||||
//dnodes number
|
//dnodes number
|
||||||
int32_t dnode_total = taosArrayGetSize(pInfo->dnodes);
|
int32_t dnode_total = taosArrayGetSize(pInfo->dnodes);
|
||||||
|
@ -239,10 +241,10 @@ void monGenClusterInfoTable(SMonInfo *pMonitor){
|
||||||
}
|
}
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, DNODES_TOTAL, strlen(DNODES_TOTAL));
|
metric = taosHashGet(tsMonitor.metrics, DNODES_TOTAL, strlen(DNODES_TOTAL));
|
||||||
taos_gauge_set(*metric, dnode_total, sample_label_values);
|
if (metric != NULL) (void)taos_gauge_set(*metric, dnode_total, sample_label_values);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, DNODES_ALIVE, strlen(DNODES_ALIVE));
|
metric = taosHashGet(tsMonitor.metrics, DNODES_ALIVE, strlen(DNODES_ALIVE));
|
||||||
taos_gauge_set(*metric, dnode_alive, sample_label_values);
|
if (metric != NULL) (void)taos_gauge_set(*metric, dnode_alive, sample_label_values);
|
||||||
|
|
||||||
//mnodes number
|
//mnodes number
|
||||||
int32_t mnode_total = taosArrayGetSize(pInfo->mnodes);
|
int32_t mnode_total = taosArrayGetSize(pInfo->mnodes);
|
||||||
|
@ -271,20 +273,20 @@ void monGenClusterInfoTable(SMonInfo *pMonitor){
|
||||||
}
|
}
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, MNODES_TOTAL, strlen(MNODES_TOTAL));
|
metric = taosHashGet(tsMonitor.metrics, MNODES_TOTAL, strlen(MNODES_TOTAL));
|
||||||
taos_gauge_set(*metric, mnode_total, sample_label_values);
|
if (metric != NULL) (void)taos_gauge_set(*metric, mnode_total, sample_label_values);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, MNODES_ALIVE, strlen(MNODES_ALIVE));
|
metric = taosHashGet(tsMonitor.metrics, MNODES_ALIVE, strlen(MNODES_ALIVE));
|
||||||
taos_gauge_set(*metric, mnode_alive, sample_label_values);
|
if (metric != NULL) (void)taos_gauge_set(*metric, mnode_alive, sample_label_values);
|
||||||
|
|
||||||
//grant info
|
//grant info
|
||||||
metric = taosHashGet(tsMonitor.metrics, EXPIRE_TIME, strlen(EXPIRE_TIME));
|
metric = taosHashGet(tsMonitor.metrics, EXPIRE_TIME, strlen(EXPIRE_TIME));
|
||||||
taos_gauge_set(*metric, pGrantInfo->expire_time, sample_label_values);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pGrantInfo->expire_time, sample_label_values);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, TIMESERIES_USED, strlen(TIMESERIES_USED));
|
metric = taosHashGet(tsMonitor.metrics, TIMESERIES_USED, strlen(TIMESERIES_USED));
|
||||||
taos_gauge_set(*metric, pGrantInfo->timeseries_used, sample_label_values);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pGrantInfo->timeseries_used, sample_label_values);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, TIMESERIES_TOTAL, strlen(TIMESERIES_TOTAL));
|
metric = taosHashGet(tsMonitor.metrics, TIMESERIES_TOTAL, strlen(TIMESERIES_TOTAL));
|
||||||
taos_gauge_set(*metric, pGrantInfo->timeseries_total, sample_label_values);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pGrantInfo->timeseries_total, sample_label_values);
|
||||||
}
|
}
|
||||||
|
|
||||||
void monGenVgroupInfoTable(SMonInfo *pMonitor){
|
void monGenVgroupInfoTable(SMonInfo *pMonitor){
|
||||||
|
@ -306,11 +308,11 @@ void monGenVgroupInfoTable(SMonInfo *pMonitor){
|
||||||
const char *vgroup_sample_labels[] = {"cluster_id", "vgroup_id", "database_name"};
|
const char *vgroup_sample_labels[] = {"cluster_id", "vgroup_id", "database_name"};
|
||||||
taos_gauge_t *tableNumGauge = taos_gauge_new(TABLES_NUM, "", vgroup_label_count, vgroup_sample_labels);
|
taos_gauge_t *tableNumGauge = taos_gauge_new(TABLES_NUM, "", vgroup_label_count, vgroup_sample_labels);
|
||||||
if(taos_collector_registry_register_metric(tableNumGauge) == 1){
|
if(taos_collector_registry_register_metric(tableNumGauge) == 1){
|
||||||
taos_counter_destroy(tableNumGauge);
|
(void)taos_counter_destroy(tableNumGauge);
|
||||||
}
|
}
|
||||||
taos_gauge_t *statusGauge = taos_gauge_new(STATUS, "", vgroup_label_count, vgroup_sample_labels);
|
taos_gauge_t *statusGauge = taos_gauge_new(STATUS, "", vgroup_label_count, vgroup_sample_labels);
|
||||||
if(taos_collector_registry_register_metric(statusGauge) == 1){
|
if(taos_collector_registry_register_metric(statusGauge) == 1){
|
||||||
taos_counter_destroy(statusGauge);
|
(void)taos_counter_destroy(statusGauge);
|
||||||
}
|
}
|
||||||
|
|
||||||
char cluster_id[TSDB_CLUSTER_ID_LEN] = {0};
|
char cluster_id[TSDB_CLUSTER_ID_LEN] = {0};
|
||||||
|
@ -325,14 +327,14 @@ void monGenVgroupInfoTable(SMonInfo *pMonitor){
|
||||||
const char *sample_labels[] = {cluster_id, vgroup_id, pVgroupDesc->database_name};
|
const char *sample_labels[] = {cluster_id, vgroup_id, pVgroupDesc->database_name};
|
||||||
|
|
||||||
taos_gauge_t **metric = NULL;
|
taos_gauge_t **metric = NULL;
|
||||||
|
|
||||||
taos_gauge_set(tableNumGauge, pVgroupDesc->tables_num, sample_labels);
|
if (tableNumGauge != NULL) (void)taos_gauge_set(tableNumGauge, pVgroupDesc->tables_num, sample_labels);
|
||||||
|
|
||||||
int32_t status = 0;
|
int32_t status = 0;
|
||||||
if(strcmp(pVgroupDesc->status, "ready") == 0){
|
if(strcmp(pVgroupDesc->status, "ready") == 0){
|
||||||
status = 1;
|
status = 1;
|
||||||
}
|
}
|
||||||
taos_gauge_set(statusGauge, status, sample_labels);
|
if (statusGauge != NULL) (void)taos_gauge_set(statusGauge, status, sample_labels);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -401,70 +403,70 @@ void monGenDnodeInfoTable(SMonInfo *pMonitor) {
|
||||||
double io_write_disk_rate = io_write_disk / interval;
|
double io_write_disk_rate = io_write_disk / interval;
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, UPTIME, strlen(UPTIME));
|
metric = taosHashGet(tsMonitor.metrics, UPTIME, strlen(UPTIME));
|
||||||
taos_gauge_set(*metric, pInfo->uptime, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pInfo->uptime, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, CPU_ENGINE, strlen(CPU_ENGINE));
|
metric = taosHashGet(tsMonitor.metrics, CPU_ENGINE, strlen(CPU_ENGINE));
|
||||||
taos_gauge_set(*metric, cpu_engine, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, cpu_engine, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, CPU_SYSTEM, strlen(CPU_SYSTEM));
|
metric = taosHashGet(tsMonitor.metrics, CPU_SYSTEM, strlen(CPU_SYSTEM));
|
||||||
taos_gauge_set(*metric, pSys->cpu_system, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pSys->cpu_system, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, CPU_CORE, strlen(CPU_CORE));
|
metric = taosHashGet(tsMonitor.metrics, CPU_CORE, strlen(CPU_CORE));
|
||||||
taos_gauge_set(*metric, pSys->cpu_cores, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pSys->cpu_cores, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, MEM_ENGINE, strlen(MEM_ENGINE));
|
metric = taosHashGet(tsMonitor.metrics, MEM_ENGINE, strlen(MEM_ENGINE));
|
||||||
taos_gauge_set(*metric, mem_engine, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, mem_engine, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, MEM_SYSTEM, strlen(MEM_SYSTEM));
|
metric = taosHashGet(tsMonitor.metrics, MEM_SYSTEM, strlen(MEM_SYSTEM));
|
||||||
taos_gauge_set(*metric, pSys->mem_system, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pSys->mem_system, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, MEM_TOTAL, strlen(MEM_TOTAL));
|
metric = taosHashGet(tsMonitor.metrics, MEM_TOTAL, strlen(MEM_TOTAL));
|
||||||
taos_gauge_set(*metric, pSys->mem_total, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pSys->mem_total, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, DISK_ENGINE, strlen(DISK_ENGINE));
|
metric = taosHashGet(tsMonitor.metrics, DISK_ENGINE, strlen(DISK_ENGINE));
|
||||||
taos_gauge_set(*metric, pSys->disk_engine, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pSys->disk_engine, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, DISK_USED, strlen(DISK_USED));
|
metric = taosHashGet(tsMonitor.metrics, DISK_USED, strlen(DISK_USED));
|
||||||
taos_gauge_set(*metric, pSys->disk_used, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pSys->disk_used, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, DISK_TOTAL, strlen(DISK_TOTAL));
|
metric = taosHashGet(tsMonitor.metrics, DISK_TOTAL, strlen(DISK_TOTAL));
|
||||||
taos_gauge_set(*metric, pSys->disk_total, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pSys->disk_total, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, NET_IN, strlen(NET_IN));
|
metric = taosHashGet(tsMonitor.metrics, NET_IN, strlen(NET_IN));
|
||||||
taos_gauge_set(*metric, net_in_rate, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, net_in_rate, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, NET_OUT, strlen(NET_OUT));
|
metric = taosHashGet(tsMonitor.metrics, NET_OUT, strlen(NET_OUT));
|
||||||
taos_gauge_set(*metric, net_out_rate, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, net_out_rate, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, IO_READ, strlen(IO_READ));
|
metric = taosHashGet(tsMonitor.metrics, IO_READ, strlen(IO_READ));
|
||||||
taos_gauge_set(*metric, io_read_rate, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, io_read_rate, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, IO_WRITE, strlen(IO_WRITE));
|
metric = taosHashGet(tsMonitor.metrics, IO_WRITE, strlen(IO_WRITE));
|
||||||
taos_gauge_set(*metric, io_write_rate, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, io_write_rate, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, IO_READ_DISK, strlen(IO_READ_DISK));
|
metric = taosHashGet(tsMonitor.metrics, IO_READ_DISK, strlen(IO_READ_DISK));
|
||||||
taos_gauge_set(*metric, io_read_disk_rate, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, io_read_disk_rate, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, IO_WRITE_DISK, strlen(IO_WRITE_DISK));
|
metric = taosHashGet(tsMonitor.metrics, IO_WRITE_DISK, strlen(IO_WRITE_DISK));
|
||||||
taos_gauge_set(*metric, io_write_disk_rate, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, io_write_disk_rate, sample_labels);
|
||||||
|
|
||||||
//metric = taosHashGet(tsMonitor.metrics, ERRORS, strlen(ERRORS));
|
// metric = taosHashGet(tsMonitor.metrics, ERRORS, strlen(ERRORS));
|
||||||
//taos_gauge_set(*metric, pStat->errors, sample_labels);
|
// if(metric != NULL) (void)taos_gauge_set(*metric, pStat->errors, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, VNODES_NUM, strlen(VNODES_NUM));
|
metric = taosHashGet(tsMonitor.metrics, VNODES_NUM, strlen(VNODES_NUM));
|
||||||
taos_gauge_set(*metric, pStat->totalVnodes, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pStat->totalVnodes, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, MASTERS, strlen(MASTERS));
|
metric = taosHashGet(tsMonitor.metrics, MASTERS, strlen(MASTERS));
|
||||||
taos_gauge_set(*metric, pStat->masterNum, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pStat->masterNum, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, HAS_MNODE, strlen(HAS_MNODE));
|
metric = taosHashGet(tsMonitor.metrics, HAS_MNODE, strlen(HAS_MNODE));
|
||||||
taos_gauge_set(*metric, pInfo->has_mnode, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pInfo->has_mnode, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, HAS_QNODE, strlen(HAS_QNODE));
|
metric = taosHashGet(tsMonitor.metrics, HAS_QNODE, strlen(HAS_QNODE));
|
||||||
taos_gauge_set(*metric, pInfo->has_qnode, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pInfo->has_qnode, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, HAS_SNODE, strlen(HAS_SNODE));
|
metric = taosHashGet(tsMonitor.metrics, HAS_SNODE, strlen(HAS_SNODE));
|
||||||
taos_gauge_set(*metric, pInfo->has_snode, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pInfo->has_snode, sample_labels);
|
||||||
|
|
||||||
//log number
|
//log number
|
||||||
SMonLogs *logs[6];
|
SMonLogs *logs[6];
|
||||||
|
@ -489,16 +491,16 @@ void monGenDnodeInfoTable(SMonInfo *pMonitor) {
|
||||||
}
|
}
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, DNODE_LOG_ERROR, strlen(DNODE_LOG_ERROR));
|
metric = taosHashGet(tsMonitor.metrics, DNODE_LOG_ERROR, strlen(DNODE_LOG_ERROR));
|
||||||
taos_gauge_set(*metric, numOfErrorLogs, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, numOfErrorLogs, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, DNODE_LOG_INFO, strlen(DNODE_LOG_INFO));
|
metric = taosHashGet(tsMonitor.metrics, DNODE_LOG_INFO, strlen(DNODE_LOG_INFO));
|
||||||
taos_gauge_set(*metric, numOfInfoLogs, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, numOfInfoLogs, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, DNODE_LOG_DEBUG, strlen(DNODE_LOG_DEBUG));
|
metric = taosHashGet(tsMonitor.metrics, DNODE_LOG_DEBUG, strlen(DNODE_LOG_DEBUG));
|
||||||
taos_gauge_set(*metric, numOfDebugLogs, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, numOfDebugLogs, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, DNODE_LOG_TRACE, strlen(DNODE_LOG_TRACE));
|
metric = taosHashGet(tsMonitor.metrics, DNODE_LOG_TRACE, strlen(DNODE_LOG_TRACE));
|
||||||
taos_gauge_set(*metric, numOfTraceLogs, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, numOfTraceLogs, sample_labels);
|
||||||
}
|
}
|
||||||
|
|
||||||
void monGenDnodeStatusInfoTable(SMonInfo *pMonitor){
|
void monGenDnodeStatusInfoTable(SMonInfo *pMonitor){
|
||||||
|
@ -519,7 +521,7 @@ void monGenDnodeStatusInfoTable(SMonInfo *pMonitor){
|
||||||
|
|
||||||
gauge= taos_gauge_new(DNODE_STATUS, "", dnodes_label_count, dnodes_sample_labels);
|
gauge= taos_gauge_new(DNODE_STATUS, "", dnodes_label_count, dnodes_sample_labels);
|
||||||
if(taos_collector_registry_register_metric(gauge) == 1){
|
if(taos_collector_registry_register_metric(gauge) == 1){
|
||||||
taos_counter_destroy(gauge);
|
(void)taos_counter_destroy(gauge);
|
||||||
}
|
}
|
||||||
|
|
||||||
char cluster_id[TSDB_CLUSTER_ID_LEN];
|
char cluster_id[TSDB_CLUSTER_ID_LEN];
|
||||||
|
@ -541,7 +543,7 @@ void monGenDnodeStatusInfoTable(SMonInfo *pMonitor){
|
||||||
if(strcmp(pDnodeDesc->status, "ready") == 0){
|
if(strcmp(pDnodeDesc->status, "ready") == 0){
|
||||||
status = 1;
|
status = 1;
|
||||||
}
|
}
|
||||||
taos_gauge_set(gauge, status, sample_labels);
|
if (gauge != NULL) (void)taos_gauge_set(gauge, status, sample_labels);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -567,13 +569,13 @@ void monGenDataDiskTable(SMonInfo *pMonitor){
|
||||||
const char *sample_labels[] = {cluster_id, dnode_id, pMonitor->dmInfo.basic.dnode_ep, pDatadirDesc->name, level};
|
const char *sample_labels[] = {cluster_id, dnode_id, pMonitor->dmInfo.basic.dnode_ep, pDatadirDesc->name, level};
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, DNODE_DATA_AVAIL, strlen(DNODE_DATA_AVAIL));
|
metric = taosHashGet(tsMonitor.metrics, DNODE_DATA_AVAIL, strlen(DNODE_DATA_AVAIL));
|
||||||
taos_gauge_set(*metric, pDatadirDesc->size.avail, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pDatadirDesc->size.avail, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, DNODE_DATA_USED, strlen(DNODE_DATA_USED));
|
metric = taosHashGet(tsMonitor.metrics, DNODE_DATA_USED, strlen(DNODE_DATA_USED));
|
||||||
taos_gauge_set(*metric, pDatadirDesc->size.used, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pDatadirDesc->size.used, sample_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, DNODE_DATA_TOTAL, strlen(DNODE_DATA_TOTAL));
|
metric = taosHashGet(tsMonitor.metrics, DNODE_DATA_TOTAL, strlen(DNODE_DATA_TOTAL));
|
||||||
taos_gauge_set(*metric, pDatadirDesc->size.total, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pDatadirDesc->size.total, sample_labels);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -594,24 +596,24 @@ void monGenLogDiskTable(SMonInfo *pMonitor){
|
||||||
const char *sample_log_labels[] = {cluster_id, dnode_id, pMonitor->dmInfo.basic.dnode_ep, pLogDesc->name};
|
const char *sample_log_labels[] = {cluster_id, dnode_id, pMonitor->dmInfo.basic.dnode_ep, pLogDesc->name};
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, DNODE_LOG_AVAIL, strlen(DNODE_LOG_AVAIL));
|
metric = taosHashGet(tsMonitor.metrics, DNODE_LOG_AVAIL, strlen(DNODE_LOG_AVAIL));
|
||||||
taos_gauge_set(*metric, pLogDesc->size.avail, sample_log_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pLogDesc->size.avail, sample_log_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, DNODE_LOG_USED, strlen(DNODE_LOG_USED));
|
metric = taosHashGet(tsMonitor.metrics, DNODE_LOG_USED, strlen(DNODE_LOG_USED));
|
||||||
taos_gauge_set(*metric, pLogDesc->size.used, sample_log_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pLogDesc->size.used, sample_log_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, DNODE_LOG_TOTAL, strlen(DNODE_LOG_TOTAL));
|
metric = taosHashGet(tsMonitor.metrics, DNODE_LOG_TOTAL, strlen(DNODE_LOG_TOTAL));
|
||||||
taos_gauge_set(*metric, pLogDesc->size.total, sample_log_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pLogDesc->size.total, sample_log_labels);
|
||||||
|
|
||||||
const char *sample_temp_labels[] = {cluster_id, dnode_id, pMonitor->dmInfo.basic.dnode_ep, pTempDesc->name};
|
const char *sample_temp_labels[] = {cluster_id, dnode_id, pMonitor->dmInfo.basic.dnode_ep, pTempDesc->name};
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, DNODE_LOG_AVAIL, strlen(DNODE_LOG_AVAIL));
|
metric = taosHashGet(tsMonitor.metrics, DNODE_LOG_AVAIL, strlen(DNODE_LOG_AVAIL));
|
||||||
taos_gauge_set(*metric, pTempDesc->size.avail, sample_temp_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pTempDesc->size.avail, sample_temp_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, DNODE_LOG_USED, strlen(DNODE_LOG_USED));
|
metric = taosHashGet(tsMonitor.metrics, DNODE_LOG_USED, strlen(DNODE_LOG_USED));
|
||||||
taos_gauge_set(*metric, pTempDesc->size.used, sample_temp_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pTempDesc->size.used, sample_temp_labels);
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, DNODE_LOG_TOTAL, strlen(DNODE_LOG_TOTAL));
|
metric = taosHashGet(tsMonitor.metrics, DNODE_LOG_TOTAL, strlen(DNODE_LOG_TOTAL));
|
||||||
taos_gauge_set(*metric, pTempDesc->size.total, sample_temp_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pTempDesc->size.total, sample_temp_labels);
|
||||||
}
|
}
|
||||||
|
|
||||||
void monGenMnodeRoleTable(SMonInfo *pMonitor){
|
void monGenMnodeRoleTable(SMonInfo *pMonitor){
|
||||||
|
@ -622,7 +624,7 @@ void monGenMnodeRoleTable(SMonInfo *pMonitor){
|
||||||
uError("failed to delete metric %s", mnodes_role_gauges[i]);
|
uError("failed to delete metric %s", mnodes_role_gauges[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
taosHashRemove(tsMonitor.metrics, mnodes_role_gauges[i], strlen(mnodes_role_gauges[i]));
|
(void)taosHashRemove(tsMonitor.metrics, mnodes_role_gauges[i], strlen(mnodes_role_gauges[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
SMonClusterInfo *pInfo = &pMonitor->mmInfo.cluster;
|
SMonClusterInfo *pInfo = &pMonitor->mmInfo.cluster;
|
||||||
|
@ -636,9 +638,10 @@ void monGenMnodeRoleTable(SMonInfo *pMonitor){
|
||||||
for(int32_t i = 0; i < 1; i++){
|
for(int32_t i = 0; i < 1; i++){
|
||||||
gauge= taos_gauge_new(mnodes_role_gauges[i], "", mnodes_role_label_count, mnodes_role_sample_labels);
|
gauge= taos_gauge_new(mnodes_role_gauges[i], "", mnodes_role_label_count, mnodes_role_sample_labels);
|
||||||
if(taos_collector_registry_register_metric(gauge) == 1){
|
if(taos_collector_registry_register_metric(gauge) == 1){
|
||||||
taos_counter_destroy(gauge);
|
(void)taos_counter_destroy(gauge);
|
||||||
}
|
}
|
||||||
taosHashPut(tsMonitor.metrics, mnodes_role_gauges[i], strlen(mnodes_role_gauges[i]), &gauge, sizeof(taos_gauge_t *));
|
(void)taosHashPut(tsMonitor.metrics, mnodes_role_gauges[i], strlen(mnodes_role_gauges[i]), &gauge,
|
||||||
|
sizeof(taos_gauge_t *));
|
||||||
}
|
}
|
||||||
|
|
||||||
char buf[TSDB_CLUSTER_ID_LEN] = {0};
|
char buf[TSDB_CLUSTER_ID_LEN] = {0};
|
||||||
|
@ -669,13 +672,13 @@ void monGenMnodeRoleTable(SMonInfo *pMonitor){
|
||||||
metric = taosHashGet(tsMonitor.metrics, MNODE_ROLE, strlen(MNODE_ROLE));
|
metric = taosHashGet(tsMonitor.metrics, MNODE_ROLE, strlen(MNODE_ROLE));
|
||||||
|
|
||||||
if(dnodeIsOnline){
|
if(dnodeIsOnline){
|
||||||
taos_gauge_set(*metric, pMnodeDesc->syncState, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pMnodeDesc->syncState, sample_labels);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
taos_gauge_set(*metric, 0, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, 0, sample_labels);
|
||||||
}
|
}
|
||||||
//metric = taosHashGet(tsMonitor.metrics, MNODE_ROLE, strlen(MNODE_ROLE));
|
// metric = taosHashGet(tsMonitor.metrics, MNODE_ROLE, strlen(MNODE_ROLE));
|
||||||
//taos_gauge_set(*metric, pMnodeDesc->syncState, sample_labels);
|
// if(metric != NULL) (void)taos_gauge_set(*metric, pMnodeDesc->syncState, sample_labels);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -688,7 +691,7 @@ void monGenVnodeRoleTable(SMonInfo *pMonitor){
|
||||||
uError("failed to delete metric %s", vnodes_role_gauges[i]);
|
uError("failed to delete metric %s", vnodes_role_gauges[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
taosHashRemove(tsMonitor.metrics, vnodes_role_gauges[i], strlen(vnodes_role_gauges[i]));
|
(void)taosHashRemove(tsMonitor.metrics, vnodes_role_gauges[i], strlen(vnodes_role_gauges[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
SMonVgroupInfo *pInfo = &pMonitor->mmInfo.vgroup;
|
SMonVgroupInfo *pInfo = &pMonitor->mmInfo.vgroup;
|
||||||
|
@ -702,9 +705,10 @@ void monGenVnodeRoleTable(SMonInfo *pMonitor){
|
||||||
for(int32_t i = 0; i < 1; i++){
|
for(int32_t i = 0; i < 1; i++){
|
||||||
gauge= taos_gauge_new(vnodes_role_gauges[i], "", vnodes_role_label_count, vnodes_role_sample_labels);
|
gauge= taos_gauge_new(vnodes_role_gauges[i], "", vnodes_role_label_count, vnodes_role_sample_labels);
|
||||||
if(taos_collector_registry_register_metric(gauge) == 1){
|
if(taos_collector_registry_register_metric(gauge) == 1){
|
||||||
taos_counter_destroy(gauge);
|
(void)taos_counter_destroy(gauge);
|
||||||
}
|
}
|
||||||
taosHashPut(tsMonitor.metrics, vnodes_role_gauges[i], strlen(vnodes_role_gauges[i]), &gauge, sizeof(taos_gauge_t *));
|
(void)taosHashPut(tsMonitor.metrics, vnodes_role_gauges[i], strlen(vnodes_role_gauges[i]), &gauge,
|
||||||
|
sizeof(taos_gauge_t *));
|
||||||
}
|
}
|
||||||
|
|
||||||
char buf[TSDB_CLUSTER_ID_LEN] = {0};
|
char buf[TSDB_CLUSTER_ID_LEN] = {0};
|
||||||
|
@ -728,7 +732,7 @@ void monGenVnodeRoleTable(SMonInfo *pMonitor){
|
||||||
const char *sample_labels[] = {buf, vgroup_id, pVgroupDesc->database_name, dnode_id};
|
const char *sample_labels[] = {buf, vgroup_id, pVgroupDesc->database_name, dnode_id};
|
||||||
|
|
||||||
metric = taosHashGet(tsMonitor.metrics, VNODE_ROLE, strlen(VNODE_ROLE));
|
metric = taosHashGet(tsMonitor.metrics, VNODE_ROLE, strlen(VNODE_ROLE));
|
||||||
taos_gauge_set(*metric, pVnodeDesc->syncState, sample_labels);
|
if (metric != NULL) (void)taos_gauge_set(*metric, pVnodeDesc->syncState, sample_labels);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -753,7 +757,7 @@ void monSendPromReport() {
|
||||||
if (taosSendHttpReport(tsMonitor.cfg.server, tsMonFwUri, tsMonitor.cfg.port, pCont, strlen(pCont), flag) != 0) {
|
if (taosSendHttpReport(tsMonitor.cfg.server, tsMonFwUri, tsMonitor.cfg.port, pCont, strlen(pCont), flag) != 0) {
|
||||||
uError("failed to send monitor msg");
|
uError("failed to send monitor msg");
|
||||||
}else{
|
}else{
|
||||||
taos_collector_registry_clear_batch(TAOS_COLLECTOR_REGISTRY_DEFAULT);
|
(void)taos_collector_registry_clear_batch(TAOS_COLLECTOR_REGISTRY_DEFAULT);
|
||||||
}
|
}
|
||||||
taosMemoryFreeClear(pCont);
|
taosMemoryFreeClear(pCont);
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,7 +110,7 @@ int32_t monInit(const SMonCfg *pCfg) {
|
||||||
tsMonitor.cfg = *pCfg;
|
tsMonitor.cfg = *pCfg;
|
||||||
tsLogFp = monRecordLog;
|
tsLogFp = monRecordLog;
|
||||||
tsMonitor.lastTime = taosGetTimestampMs();
|
tsMonitor.lastTime = taosGetTimestampMs();
|
||||||
taosThreadMutexInit(&tsMonitor.lock, NULL);
|
(void)taosThreadMutexInit(&tsMonitor.lock, NULL);
|
||||||
|
|
||||||
monInitMonitorFW();
|
monInitMonitorFW();
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ void monCleanup() {
|
||||||
tFreeSMonSmInfo(&tsMonitor.smInfo);
|
tFreeSMonSmInfo(&tsMonitor.smInfo);
|
||||||
tFreeSMonQmInfo(&tsMonitor.qmInfo);
|
tFreeSMonQmInfo(&tsMonitor.qmInfo);
|
||||||
tFreeSMonBmInfo(&tsMonitor.bmInfo);
|
tFreeSMonBmInfo(&tsMonitor.bmInfo);
|
||||||
taosThreadMutexDestroy(&tsMonitor.lock);
|
(void)taosThreadMutexDestroy(&tsMonitor.lock);
|
||||||
|
|
||||||
monCleanupMonitorFW();
|
monCleanupMonitorFW();
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,9 @@ static SMonInfo *monCreateMonitorInfo() {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
monGetLogs(&pMonitor->log);
|
if ((terrno = monGetLogs(&pMonitor->log)) != 0) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
(void)taosThreadMutexLock(&tsMonitor.lock);
|
(void)taosThreadMutexLock(&tsMonitor.lock);
|
||||||
memcpy(&pMonitor->dmInfo, &tsMonitor.dmInfo, sizeof(SMonDmInfo));
|
memcpy(&pMonitor->dmInfo, &tsMonitor.dmInfo, sizeof(SMonDmInfo));
|
||||||
|
@ -185,14 +187,14 @@ static void monGenBasicJson(SMonInfo *pMonitor) {
|
||||||
|
|
||||||
SJson *pJson = pMonitor->pJson;
|
SJson *pJson = pMonitor->pJson;
|
||||||
char buf[40] = {0};
|
char buf[40] = {0};
|
||||||
taosFormatUtcTime(buf, sizeof(buf), pMonitor->curTime, TSDB_TIME_PRECISION_MILLI);
|
(void)taosFormatUtcTime(buf, sizeof(buf), pMonitor->curTime, TSDB_TIME_PRECISION_MILLI);
|
||||||
|
|
||||||
tjsonAddStringToObject(pJson, "ts", buf);
|
(void)tjsonAddStringToObject(pJson, "ts", buf);
|
||||||
tjsonAddDoubleToObject(pJson, "dnode_id", pInfo->dnode_id);
|
(void)tjsonAddDoubleToObject(pJson, "dnode_id", pInfo->dnode_id);
|
||||||
tjsonAddStringToObject(pJson, "dnode_ep", pInfo->dnode_ep);
|
(void)tjsonAddStringToObject(pJson, "dnode_ep", pInfo->dnode_ep);
|
||||||
snprintf(buf, sizeof(buf), "%" PRId64, pInfo->cluster_id);
|
snprintf(buf, sizeof(buf), "%" PRId64, pInfo->cluster_id);
|
||||||
tjsonAddStringToObject(pJson, "cluster_id", buf);
|
(void)tjsonAddStringToObject(pJson, "cluster_id", buf);
|
||||||
tjsonAddDoubleToObject(pJson, "protocol", pInfo->protocol);
|
(void)tjsonAddDoubleToObject(pJson, "protocol", pInfo->protocol);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void monGenBasicJsonBasic(SMonInfo *pMonitor) {
|
static void monGenBasicJsonBasic(SMonInfo *pMonitor) {
|
||||||
|
@ -203,12 +205,12 @@ static void monGenBasicJsonBasic(SMonInfo *pMonitor) {
|
||||||
char buf[40] = {0};
|
char buf[40] = {0};
|
||||||
|
|
||||||
sprintf(buf, "%" PRId64, taosGetTimestamp(TSDB_TIME_PRECISION_MILLI));
|
sprintf(buf, "%" PRId64, taosGetTimestamp(TSDB_TIME_PRECISION_MILLI));
|
||||||
tjsonAddStringToObject(pJson, "ts", buf);
|
(void)tjsonAddStringToObject(pJson, "ts", buf);
|
||||||
tjsonAddDoubleToObject(pJson, "dnode_id", pInfo->dnode_id);
|
(void)tjsonAddDoubleToObject(pJson, "dnode_id", pInfo->dnode_id);
|
||||||
tjsonAddStringToObject(pJson, "dnode_ep", pInfo->dnode_ep);
|
(void)tjsonAddStringToObject(pJson, "dnode_ep", pInfo->dnode_ep);
|
||||||
snprintf(buf, sizeof(buf), "%" PRId64, pInfo->cluster_id);
|
snprintf(buf, sizeof(buf), "%" PRId64, pInfo->cluster_id);
|
||||||
tjsonAddStringToObject(pJson, "cluster_id", buf);
|
(void)tjsonAddStringToObject(pJson, "cluster_id", buf);
|
||||||
tjsonAddDoubleToObject(pJson, "protocol", pInfo->protocol);
|
(void)tjsonAddDoubleToObject(pJson, "protocol", pInfo->protocol);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void monGenClusterJson(SMonInfo *pMonitor) {
|
static void monGenClusterJson(SMonInfo *pMonitor) {
|
||||||
|
@ -222,21 +224,21 @@ static void monGenClusterJson(SMonInfo *pMonitor) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
tjsonAddStringToObject(pJson, "first_ep", pInfo->first_ep);
|
(void)tjsonAddStringToObject(pJson, "first_ep", pInfo->first_ep);
|
||||||
tjsonAddDoubleToObject(pJson, "first_ep_dnode_id", pInfo->first_ep_dnode_id);
|
(void)tjsonAddDoubleToObject(pJson, "first_ep_dnode_id", pInfo->first_ep_dnode_id);
|
||||||
tjsonAddStringToObject(pJson, "version", pInfo->version);
|
(void)tjsonAddStringToObject(pJson, "version", pInfo->version);
|
||||||
tjsonAddDoubleToObject(pJson, "master_uptime", pInfo->master_uptime);
|
(void)tjsonAddDoubleToObject(pJson, "master_uptime", pInfo->master_uptime);
|
||||||
tjsonAddDoubleToObject(pJson, "monitor_interval", pInfo->monitor_interval);
|
(void)tjsonAddDoubleToObject(pJson, "monitor_interval", pInfo->monitor_interval);
|
||||||
tjsonAddDoubleToObject(pJson, "dbs_total", pInfo->dbs_total);
|
(void)tjsonAddDoubleToObject(pJson, "dbs_total", pInfo->dbs_total);
|
||||||
tjsonAddDoubleToObject(pJson, "tbs_total", pInfo->tbs_total);
|
(void)tjsonAddDoubleToObject(pJson, "tbs_total", pInfo->tbs_total);
|
||||||
tjsonAddDoubleToObject(pJson, "stbs_total", pInfo->stbs_total);
|
(void)tjsonAddDoubleToObject(pJson, "stbs_total", pInfo->stbs_total);
|
||||||
tjsonAddDoubleToObject(pJson, "vgroups_total", pInfo->vgroups_total);
|
(void)tjsonAddDoubleToObject(pJson, "vgroups_total", pInfo->vgroups_total);
|
||||||
tjsonAddDoubleToObject(pJson, "vgroups_alive", pInfo->vgroups_alive);
|
(void)tjsonAddDoubleToObject(pJson, "vgroups_alive", pInfo->vgroups_alive);
|
||||||
tjsonAddDoubleToObject(pJson, "vnodes_total", pInfo->vnodes_total);
|
(void)tjsonAddDoubleToObject(pJson, "vnodes_total", pInfo->vnodes_total);
|
||||||
tjsonAddDoubleToObject(pJson, "vnodes_alive", pInfo->vnodes_alive);
|
(void)tjsonAddDoubleToObject(pJson, "vnodes_alive", pInfo->vnodes_alive);
|
||||||
tjsonAddDoubleToObject(pJson, "connections_total", pInfo->connections_total);
|
(void)tjsonAddDoubleToObject(pJson, "connections_total", pInfo->connections_total);
|
||||||
tjsonAddDoubleToObject(pJson, "topics_total", pInfo->topics_toal);
|
(void)tjsonAddDoubleToObject(pJson, "topics_total", pInfo->topics_toal);
|
||||||
tjsonAddDoubleToObject(pJson, "streams_total", pInfo->streams_total);
|
(void)tjsonAddDoubleToObject(pJson, "streams_total", pInfo->streams_total);
|
||||||
|
|
||||||
SJson *pDnodesJson = tjsonAddArrayToObject(pJson, "dnodes");
|
SJson *pDnodesJson = tjsonAddArrayToObject(pJson, "dnodes");
|
||||||
if (pDnodesJson == NULL) return;
|
if (pDnodesJson == NULL) return;
|
||||||
|
@ -246,9 +248,9 @@ static void monGenClusterJson(SMonInfo *pMonitor) {
|
||||||
if (pDnodeJson == NULL) continue;
|
if (pDnodeJson == NULL) continue;
|
||||||
|
|
||||||
SMonDnodeDesc *pDnodeDesc = taosArrayGet(pInfo->dnodes, i);
|
SMonDnodeDesc *pDnodeDesc = taosArrayGet(pInfo->dnodes, i);
|
||||||
tjsonAddDoubleToObject(pDnodeJson, "dnode_id", pDnodeDesc->dnode_id);
|
(void)tjsonAddDoubleToObject(pDnodeJson, "dnode_id", pDnodeDesc->dnode_id);
|
||||||
tjsonAddStringToObject(pDnodeJson, "dnode_ep", pDnodeDesc->dnode_ep);
|
(void)tjsonAddStringToObject(pDnodeJson, "dnode_ep", pDnodeDesc->dnode_ep);
|
||||||
tjsonAddStringToObject(pDnodeJson, "status", pDnodeDesc->status);
|
(void)tjsonAddStringToObject(pDnodeJson, "status", pDnodeDesc->status);
|
||||||
|
|
||||||
if (tjsonAddItemToArray(pDnodesJson, pDnodeJson) != 0) tjsonDelete(pDnodeJson);
|
if (tjsonAddItemToArray(pDnodesJson, pDnodeJson) != 0) tjsonDelete(pDnodeJson);
|
||||||
}
|
}
|
||||||
|
@ -261,9 +263,9 @@ static void monGenClusterJson(SMonInfo *pMonitor) {
|
||||||
if (pMnodeJson == NULL) continue;
|
if (pMnodeJson == NULL) continue;
|
||||||
|
|
||||||
SMonMnodeDesc *pMnodeDesc = taosArrayGet(pInfo->mnodes, i);
|
SMonMnodeDesc *pMnodeDesc = taosArrayGet(pInfo->mnodes, i);
|
||||||
tjsonAddDoubleToObject(pMnodeJson, "mnode_id", pMnodeDesc->mnode_id);
|
(void)tjsonAddDoubleToObject(pMnodeJson, "mnode_id", pMnodeDesc->mnode_id);
|
||||||
tjsonAddStringToObject(pMnodeJson, "mnode_ep", pMnodeDesc->mnode_ep);
|
(void)tjsonAddStringToObject(pMnodeJson, "mnode_ep", pMnodeDesc->mnode_ep);
|
||||||
tjsonAddStringToObject(pMnodeJson, "role", pMnodeDesc->role);
|
(void)tjsonAddStringToObject(pMnodeJson, "role", pMnodeDesc->role);
|
||||||
|
|
||||||
if (tjsonAddItemToArray(pMnodesJson, pMnodeJson) != 0) tjsonDelete(pMnodeJson);
|
if (tjsonAddItemToArray(pMnodesJson, pMnodeJson) != 0) tjsonDelete(pMnodeJson);
|
||||||
}
|
}
|
||||||
|
@ -273,11 +275,11 @@ static void monGenClusterJsonBasic(SMonInfo *pMonitor) {
|
||||||
SMonClusterInfo *pInfo = &pMonitor->mmInfo.cluster;
|
SMonClusterInfo *pInfo = &pMonitor->mmInfo.cluster;
|
||||||
if (pMonitor->mmInfo.cluster.first_ep_dnode_id == 0) return;
|
if (pMonitor->mmInfo.cluster.first_ep_dnode_id == 0) return;
|
||||||
|
|
||||||
// tjsonAddStringToObject(pMonitor->pJson, "first_ep", pInfo->first_ep);
|
// (void)tjsonAddStringToObject(pMonitor->pJson, "first_ep", pInfo->first_ep);
|
||||||
tjsonAddStringToObject(pMonitor->pJson, "first_ep", tsFirst);
|
(void)tjsonAddStringToObject(pMonitor->pJson, "first_ep", tsFirst);
|
||||||
tjsonAddDoubleToObject(pMonitor->pJson, "first_ep_dnode_id", pInfo->first_ep_dnode_id);
|
(void)tjsonAddDoubleToObject(pMonitor->pJson, "first_ep_dnode_id", pInfo->first_ep_dnode_id);
|
||||||
tjsonAddStringToObject(pMonitor->pJson, "cluster_version", pInfo->version);
|
(void)tjsonAddStringToObject(pMonitor->pJson, "cluster_version", pInfo->version);
|
||||||
// tjsonAddDoubleToObject(pMonitor->pJson, "monitor_interval", pInfo->monitor_interval);
|
// (void)tjsonAddDoubleToObject(pMonitor->pJson, "monitor_interval", pInfo->monitor_interval);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void monGenVgroupJson(SMonInfo *pMonitor) {
|
static void monGenVgroupJson(SMonInfo *pMonitor) {
|
||||||
|
@ -296,10 +298,10 @@ static void monGenVgroupJson(SMonInfo *pMonitor) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SMonVgroupDesc *pVgroupDesc = taosArrayGet(pInfo->vgroups, i);
|
SMonVgroupDesc *pVgroupDesc = taosArrayGet(pInfo->vgroups, i);
|
||||||
tjsonAddDoubleToObject(pVgroupJson, "vgroup_id", pVgroupDesc->vgroup_id);
|
(void)tjsonAddDoubleToObject(pVgroupJson, "vgroup_id", pVgroupDesc->vgroup_id);
|
||||||
tjsonAddStringToObject(pVgroupJson, "database_name", pVgroupDesc->database_name);
|
(void)tjsonAddStringToObject(pVgroupJson, "database_name", pVgroupDesc->database_name);
|
||||||
tjsonAddDoubleToObject(pVgroupJson, "tables_num", pVgroupDesc->tables_num);
|
(void)tjsonAddDoubleToObject(pVgroupJson, "tables_num", pVgroupDesc->tables_num);
|
||||||
tjsonAddStringToObject(pVgroupJson, "status", pVgroupDesc->status);
|
(void)tjsonAddStringToObject(pVgroupJson, "status", pVgroupDesc->status);
|
||||||
|
|
||||||
SJson *pVnodesJson = tjsonAddArrayToObject(pVgroupJson, "vnodes");
|
SJson *pVnodesJson = tjsonAddArrayToObject(pVgroupJson, "vnodes");
|
||||||
if (pVnodesJson == NULL) continue;
|
if (pVnodesJson == NULL) continue;
|
||||||
|
@ -311,8 +313,8 @@ static void monGenVgroupJson(SMonInfo *pMonitor) {
|
||||||
SJson *pVnodeJson = tjsonCreateObject();
|
SJson *pVnodeJson = tjsonCreateObject();
|
||||||
if (pVnodeJson == NULL) continue;
|
if (pVnodeJson == NULL) continue;
|
||||||
|
|
||||||
tjsonAddDoubleToObject(pVnodeJson, "dnode_id", pVnodeDesc->dnode_id);
|
(void)tjsonAddDoubleToObject(pVnodeJson, "dnode_id", pVnodeDesc->dnode_id);
|
||||||
tjsonAddStringToObject(pVnodeJson, "vnode_role", pVnodeDesc->vnode_role);
|
(void)tjsonAddStringToObject(pVnodeJson, "vnode_role", pVnodeDesc->vnode_role);
|
||||||
|
|
||||||
if (tjsonAddItemToArray(pVnodesJson, pVnodeJson) != 0) tjsonDelete(pVnodeJson);
|
if (tjsonAddItemToArray(pVnodesJson, pVnodeJson) != 0) tjsonDelete(pVnodeJson);
|
||||||
}
|
}
|
||||||
|
@ -335,8 +337,8 @@ static void monGenStbJson(SMonInfo *pMonitor) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SMonStbDesc *pStbDesc = taosArrayGet(pInfo->stbs, i);
|
SMonStbDesc *pStbDesc = taosArrayGet(pInfo->stbs, i);
|
||||||
tjsonAddStringToObject(pStbJson, "stb_name", pStbDesc->stb_name);
|
(void)tjsonAddStringToObject(pStbJson, "stb_name", pStbDesc->stb_name);
|
||||||
tjsonAddStringToObject(pStbJson, "database_name", pStbDesc->database_name);
|
(void)tjsonAddStringToObject(pStbJson, "database_name", pStbDesc->database_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,9 +353,9 @@ static void monGenGrantJson(SMonInfo *pMonitor) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
tjsonAddDoubleToObject(pJson, "expire_time", pInfo->expire_time);
|
(void)tjsonAddDoubleToObject(pJson, "expire_time", pInfo->expire_time);
|
||||||
tjsonAddDoubleToObject(pJson, "timeseries_used", pInfo->timeseries_used);
|
(void)tjsonAddDoubleToObject(pJson, "timeseries_used", pInfo->timeseries_used);
|
||||||
tjsonAddDoubleToObject(pJson, "timeseries_total", pInfo->timeseries_total);
|
(void)tjsonAddDoubleToObject(pJson, "timeseries_total", pInfo->timeseries_total);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void monGenDnodeJson(SMonInfo *pMonitor) {
|
static void monGenDnodeJson(SMonInfo *pMonitor) {
|
||||||
|
@ -410,36 +412,36 @@ static void monGenDnodeJson(SMonInfo *pMonitor) {
|
||||||
double io_read_disk_rate = io_read_disk / interval;
|
double io_read_disk_rate = io_read_disk / interval;
|
||||||
double io_write_disk_rate = io_write_disk / interval;
|
double io_write_disk_rate = io_write_disk / interval;
|
||||||
|
|
||||||
tjsonAddDoubleToObject(pJson, "uptime", pInfo->uptime);
|
(void)tjsonAddDoubleToObject(pJson, "uptime", pInfo->uptime);
|
||||||
tjsonAddDoubleToObject(pJson, "cpu_engine", cpu_engine);
|
(void)tjsonAddDoubleToObject(pJson, "cpu_engine", cpu_engine);
|
||||||
tjsonAddDoubleToObject(pJson, "cpu_system", pSys->cpu_system);
|
(void)tjsonAddDoubleToObject(pJson, "cpu_system", pSys->cpu_system);
|
||||||
tjsonAddDoubleToObject(pJson, "cpu_cores", pSys->cpu_cores);
|
(void)tjsonAddDoubleToObject(pJson, "cpu_cores", pSys->cpu_cores);
|
||||||
tjsonAddDoubleToObject(pJson, "mem_engine", mem_engine);
|
(void)tjsonAddDoubleToObject(pJson, "mem_engine", mem_engine);
|
||||||
tjsonAddDoubleToObject(pJson, "mem_system", pSys->mem_system);
|
(void)tjsonAddDoubleToObject(pJson, "mem_system", pSys->mem_system);
|
||||||
tjsonAddDoubleToObject(pJson, "mem_total", pSys->mem_total);
|
(void)tjsonAddDoubleToObject(pJson, "mem_total", pSys->mem_total);
|
||||||
tjsonAddDoubleToObject(pJson, "disk_engine", pSys->disk_engine);
|
(void)tjsonAddDoubleToObject(pJson, "disk_engine", pSys->disk_engine);
|
||||||
tjsonAddDoubleToObject(pJson, "disk_used", pSys->disk_used);
|
(void)tjsonAddDoubleToObject(pJson, "disk_used", pSys->disk_used);
|
||||||
tjsonAddDoubleToObject(pJson, "disk_total", pSys->disk_total);
|
(void)tjsonAddDoubleToObject(pJson, "disk_total", pSys->disk_total);
|
||||||
tjsonAddDoubleToObject(pJson, "net_in", net_in_rate);
|
(void)tjsonAddDoubleToObject(pJson, "net_in", net_in_rate);
|
||||||
tjsonAddDoubleToObject(pJson, "net_out", net_out_rate);
|
(void)tjsonAddDoubleToObject(pJson, "net_out", net_out_rate);
|
||||||
tjsonAddDoubleToObject(pJson, "io_read", io_read_rate);
|
(void)tjsonAddDoubleToObject(pJson, "io_read", io_read_rate);
|
||||||
tjsonAddDoubleToObject(pJson, "io_write", io_write_rate);
|
(void)tjsonAddDoubleToObject(pJson, "io_write", io_write_rate);
|
||||||
tjsonAddDoubleToObject(pJson, "io_read_disk", io_read_disk_rate);
|
(void)tjsonAddDoubleToObject(pJson, "io_read_disk", io_read_disk_rate);
|
||||||
tjsonAddDoubleToObject(pJson, "io_write_disk", io_write_disk_rate);
|
(void)tjsonAddDoubleToObject(pJson, "io_write_disk", io_write_disk_rate);
|
||||||
tjsonAddDoubleToObject(pJson, "req_select", pStat->numOfSelectReqs);
|
(void)tjsonAddDoubleToObject(pJson, "req_select", pStat->numOfSelectReqs);
|
||||||
tjsonAddDoubleToObject(pJson, "req_select_rate", req_select_rate);
|
(void)tjsonAddDoubleToObject(pJson, "req_select_rate", req_select_rate);
|
||||||
tjsonAddDoubleToObject(pJson, "req_insert", pStat->numOfInsertReqs);
|
(void)tjsonAddDoubleToObject(pJson, "req_insert", pStat->numOfInsertReqs);
|
||||||
tjsonAddDoubleToObject(pJson, "req_insert_success", pStat->numOfInsertSuccessReqs);
|
(void)tjsonAddDoubleToObject(pJson, "req_insert_success", pStat->numOfInsertSuccessReqs);
|
||||||
tjsonAddDoubleToObject(pJson, "req_insert_rate", req_insert_rate);
|
(void)tjsonAddDoubleToObject(pJson, "req_insert_rate", req_insert_rate);
|
||||||
tjsonAddDoubleToObject(pJson, "req_insert_batch", pStat->numOfBatchInsertReqs);
|
(void)tjsonAddDoubleToObject(pJson, "req_insert_batch", pStat->numOfBatchInsertReqs);
|
||||||
tjsonAddDoubleToObject(pJson, "req_insert_batch_success", pStat->numOfBatchInsertSuccessReqs);
|
(void)tjsonAddDoubleToObject(pJson, "req_insert_batch_success", pStat->numOfBatchInsertSuccessReqs);
|
||||||
tjsonAddDoubleToObject(pJson, "req_insert_batch_rate", req_insert_batch_rate);
|
(void)tjsonAddDoubleToObject(pJson, "req_insert_batch_rate", req_insert_batch_rate);
|
||||||
tjsonAddDoubleToObject(pJson, "errors", pStat->errors);
|
(void)tjsonAddDoubleToObject(pJson, "errors", pStat->errors);
|
||||||
tjsonAddDoubleToObject(pJson, "vnodes_num", pStat->totalVnodes);
|
(void)tjsonAddDoubleToObject(pJson, "vnodes_num", pStat->totalVnodes);
|
||||||
tjsonAddDoubleToObject(pJson, "masters", pStat->masterNum);
|
(void)tjsonAddDoubleToObject(pJson, "masters", pStat->masterNum);
|
||||||
tjsonAddDoubleToObject(pJson, "has_mnode", pInfo->has_mnode);
|
(void)tjsonAddDoubleToObject(pJson, "has_mnode", pInfo->has_mnode);
|
||||||
tjsonAddDoubleToObject(pJson, "has_qnode", pInfo->has_qnode);
|
(void)tjsonAddDoubleToObject(pJson, "has_qnode", pInfo->has_qnode);
|
||||||
tjsonAddDoubleToObject(pJson, "has_snode", pInfo->has_snode);
|
(void)tjsonAddDoubleToObject(pJson, "has_snode", pInfo->has_snode);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void monGenDiskJson(SMonInfo *pMonitor) {
|
static void monGenDiskJson(SMonInfo *pMonitor) {
|
||||||
|
@ -474,18 +476,18 @@ static void monGenDiskJson(SMonInfo *pMonitor) {
|
||||||
SJson *pLogdirJson = tjsonCreateObject();
|
SJson *pLogdirJson = tjsonCreateObject();
|
||||||
if (pLogdirJson == NULL) return;
|
if (pLogdirJson == NULL) return;
|
||||||
if (tjsonAddItemToObject(pJson, "logdir", pLogdirJson) != 0) return;
|
if (tjsonAddItemToObject(pJson, "logdir", pLogdirJson) != 0) return;
|
||||||
tjsonAddStringToObject(pLogdirJson, "name", pLogDesc->name);
|
(void)tjsonAddStringToObject(pLogdirJson, "name", pLogDesc->name);
|
||||||
tjsonAddDoubleToObject(pLogdirJson, "avail", pLogDesc->size.avail);
|
(void)tjsonAddDoubleToObject(pLogdirJson, "avail", pLogDesc->size.avail);
|
||||||
tjsonAddDoubleToObject(pLogdirJson, "used", pLogDesc->size.used);
|
(void)tjsonAddDoubleToObject(pLogdirJson, "used", pLogDesc->size.used);
|
||||||
tjsonAddDoubleToObject(pLogdirJson, "total", pLogDesc->size.total);
|
(void)tjsonAddDoubleToObject(pLogdirJson, "total", pLogDesc->size.total);
|
||||||
|
|
||||||
SJson *pTempdirJson = tjsonCreateObject();
|
SJson *pTempdirJson = tjsonCreateObject();
|
||||||
if (pTempdirJson == NULL) return;
|
if (pTempdirJson == NULL) return;
|
||||||
if (tjsonAddItemToObject(pJson, "tempdir", pTempdirJson) != 0) return;
|
if (tjsonAddItemToObject(pJson, "tempdir", pTempdirJson) != 0) return;
|
||||||
tjsonAddStringToObject(pTempdirJson, "name", pTempDesc->name);
|
(void)tjsonAddStringToObject(pTempdirJson, "name", pTempDesc->name);
|
||||||
tjsonAddDoubleToObject(pTempdirJson, "avail", pTempDesc->size.avail);
|
(void)tjsonAddDoubleToObject(pTempdirJson, "avail", pTempDesc->size.avail);
|
||||||
tjsonAddDoubleToObject(pTempdirJson, "used", pTempDesc->size.used);
|
(void)tjsonAddDoubleToObject(pTempdirJson, "used", pTempDesc->size.used);
|
||||||
tjsonAddDoubleToObject(pTempdirJson, "total", pTempDesc->size.total);
|
(void)tjsonAddDoubleToObject(pTempdirJson, "total", pTempDesc->size.total);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *monLogLevelStr(ELogLevel level) {
|
static const char *monLogLevelStr(ELogLevel level) {
|
||||||
|
@ -530,26 +532,26 @@ static void monGenLogJson(SMonInfo *pMonitor) {
|
||||||
|
|
||||||
SJson *pLogError = tjsonCreateObject();
|
SJson *pLogError = tjsonCreateObject();
|
||||||
if (pLogError == NULL) return;
|
if (pLogError == NULL) return;
|
||||||
tjsonAddStringToObject(pLogError, "level", "error");
|
(void)tjsonAddStringToObject(pLogError, "level", "error");
|
||||||
tjsonAddDoubleToObject(pLogError, "total", numOfErrorLogs);
|
(void)tjsonAddDoubleToObject(pLogError, "total", numOfErrorLogs);
|
||||||
if (tjsonAddItemToArray(pSummaryJson, pLogError) != 0) tjsonDelete(pLogError);
|
if (tjsonAddItemToArray(pSummaryJson, pLogError) != 0) tjsonDelete(pLogError);
|
||||||
|
|
||||||
SJson *pLogInfo = tjsonCreateObject();
|
SJson *pLogInfo = tjsonCreateObject();
|
||||||
if (pLogInfo == NULL) return;
|
if (pLogInfo == NULL) return;
|
||||||
tjsonAddStringToObject(pLogInfo, "level", "info");
|
(void)tjsonAddStringToObject(pLogInfo, "level", "info");
|
||||||
tjsonAddDoubleToObject(pLogInfo, "total", numOfInfoLogs);
|
(void)tjsonAddDoubleToObject(pLogInfo, "total", numOfInfoLogs);
|
||||||
if (tjsonAddItemToArray(pSummaryJson, pLogInfo) != 0) tjsonDelete(pLogInfo);
|
if (tjsonAddItemToArray(pSummaryJson, pLogInfo) != 0) tjsonDelete(pLogInfo);
|
||||||
|
|
||||||
SJson *pLogDebug = tjsonCreateObject();
|
SJson *pLogDebug = tjsonCreateObject();
|
||||||
if (pLogDebug == NULL) return;
|
if (pLogDebug == NULL) return;
|
||||||
tjsonAddStringToObject(pLogDebug, "level", "debug");
|
(void)tjsonAddStringToObject(pLogDebug, "level", "debug");
|
||||||
tjsonAddDoubleToObject(pLogDebug, "total", numOfDebugLogs);
|
(void)tjsonAddDoubleToObject(pLogDebug, "total", numOfDebugLogs);
|
||||||
if (tjsonAddItemToArray(pSummaryJson, pLogDebug) != 0) tjsonDelete(pLogDebug);
|
if (tjsonAddItemToArray(pSummaryJson, pLogDebug) != 0) tjsonDelete(pLogDebug);
|
||||||
|
|
||||||
SJson *pLogTrace = tjsonCreateObject();
|
SJson *pLogTrace = tjsonCreateObject();
|
||||||
if (pLogTrace == NULL) return;
|
if (pLogTrace == NULL) return;
|
||||||
tjsonAddStringToObject(pLogTrace, "level", "trace");
|
(void)tjsonAddStringToObject(pLogTrace, "level", "trace");
|
||||||
tjsonAddDoubleToObject(pLogTrace, "total", numOfTraceLogs);
|
(void)tjsonAddDoubleToObject(pLogTrace, "total", numOfTraceLogs);
|
||||||
if (tjsonAddItemToArray(pSummaryJson, pLogTrace) != 0) tjsonDelete(pLogTrace);
|
if (tjsonAddItemToArray(pSummaryJson, pLogTrace) != 0) tjsonDelete(pLogTrace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue