oracle subagent moved to public tree
[public/netxms.git] / src / agent / subagents / oracle / oracle_subagent.h
1 /*
2 ** NetXMS subagent for Oracle monitoring
3 ** Copyright (C) 2009-2012 Raden Solutions
4 **/
5
6 #ifndef _oracle_subagent_h_
7 #define _oracle_subagent_h_
8
9 #include <nms_common.h>
10 #include <nms_util.h>
11 #include <nms_agent.h>
12 #include <nxdbapi.h>
13
14 //
15 // Misc defines
16 //
17
18 #define MAX_STR (255)
19 #define MAX_QUERY (8192)
20 #define MYNAMESTR _T("oracle")
21 #define DB_NULLARG_MAGIC _T("8201")
22
23 // Oracle-specific
24 #define MAX_USERNAME (30+1)
25 #define MAX_PASSWORD (30+1)
26
27 #define MAX_DATABASES (5)
28
29
30 //
31 // DB-related structs
32 //
33
34 // struct for the databases configured within the subagent
35 typedef struct
36 {
37 TCHAR id[MAX_STR]; // this is how client addresses the database
38 TCHAR name[MAX_STR];
39 TCHAR server[MAX_STR];
40 char username[MAX_USERNAME];
41 char password[MAX_PASSWORD];
42 THREAD queryThreadHandle;
43 DB_HANDLE handle;
44 bool connected;
45 int version; // in xxx format
46 MUTEX accessMutex;
47 } DatabaseInfo;
48
49 typedef struct {
50 TCHAR name[MAX_STR];
51 StringMap* attrs;
52 } DBParameter;
53
54 typedef struct {
55 int version; // minimum database version in xxx format for this query
56 TCHAR* prefix; // parameter prefix, e.g. "Oracle.Tablespaces."
57 TCHAR* query; // the query
58 int queryColumns; // number of columns returned by query
59 DBParameter* values[MAX_DATABASES]; // list of values
60 int valueCount[MAX_DATABASES];
61 } DBParameterGroup;
62
63 // struct for stat data obtained from the database
64 typedef struct
65 {
66 DWORD openCursors;
67 DWORD sessions;
68 } DatabaseData;
69
70 //
71 // Functions
72 //
73
74 bool getParametersFromDB(int dbIndex);
75
76 #endif /* _oracle_subagent_h_ */