monitor.h 1.9 KB
Newer Older
H
hzcheng 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/*
 * Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
 *
 * This program is free software: you can use, redistribute, and/or modify
 * it under the terms of the GNU Affero General Public License, version 3
 * or later ("AGPL"), as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

S
dnode  
slguan 已提交
16 17
#ifndef TDENGINE_MONITOR_H
#define TDENGINE_MONITOR_H
H
hzcheng 已提交
18

S
dnode  
slguan 已提交
19 20 21
#ifdef __cplusplus
extern "C" {
#endif
H
hzcheng 已提交
22

S
dnode  
slguan 已提交
23
#include <stdint.h>
S
slguan 已提交
24

25 26 27 28 29
#define monSaveLogs(level, ...) {      \
  monSaveLog(level, __VA_ARGS__);      \
  monSaveDnodeLog(level, __VA_ARGS__); \
}

S
slguan 已提交
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
typedef struct {
  char *  acctId;
  int64_t currentPointsPerSecond;
  int64_t maxPointsPerSecond;
  int64_t totalTimeSeries;
  int64_t maxTimeSeries;
  int64_t totalStorage;
  int64_t maxStorage;
  int64_t totalQueryTime;
  int64_t maxQueryTime;
  int64_t totalInbound;
  int64_t maxInbound;
  int64_t totalOutbound;
  int64_t maxOutbound;
  int64_t totalDbs;
  int64_t maxDbs;
  int64_t totalUsers;
  int64_t maxUsers;
  int64_t totalStreams;
  int64_t maxStreams;
  int64_t totalConns;
  int64_t maxConns;
  int8_t  accessState;
} SAcctMonitorObj;

S
Shengliang Guan 已提交
55 56 57 58 59 60
int32_t monInitSystem();
int32_t monStartSystem();
void    monStopSystem();
void    monCleanupSystem();
void    monSaveAcctLog(SAcctMonitorObj *pMonObj);
void    monSaveLog(int32_t level, const char *const format, ...);
61
void    monSaveDnodeLog(int32_t level, const char *const format, ...);
S
Shengliang Guan 已提交
62
void    monExecuteSQL(char *sql);
63 64
typedef void (*MonExecuteSQLCbFP)(void *param, TAOS_RES *, int code);
void monExecuteSQLWithResultCallback(char *sql, MonExecuteSQLCbFP callback, void* param);
S
dnode  
slguan 已提交
65 66 67 68 69
#ifdef __cplusplus
}
#endif

#endif