Commit | Line | Data |
---|---|---|
cc022855 | 1 | /* |
7ac71e60 | 2 | ** NetXMS - Network Management System |
d02f6b92 | 3 | ** Copyright (C) 2003-2013 Victor Kirhenshtein |
cbcaf8c8 VK |
4 | ** |
5 | ** This program is free software; you can redistribute it and/or modify | |
68f384ea VK |
6 | ** it under the terms of the GNU Lesser General Public License as published by |
7 | ** the Free Software Foundation; either version 3 of the License, or | |
cbcaf8c8 VK |
8 | ** (at your option) any later version. |
9 | ** | |
10 | ** This program is distributed in the hope that it will be useful, | |
11 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | ** GNU General Public License for more details. | |
14 | ** | |
68f384ea | 15 | ** You should have received a copy of the GNU Lesser General Public License |
cbcaf8c8 VK |
16 | ** along with this program; if not, write to the Free Software |
17 | ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |
18 | ** | |
456d5d1c | 19 | ** File: nms_agent.h |
cbcaf8c8 VK |
20 | ** |
21 | **/ | |
22 | ||
23 | #ifndef _nms_agent_h_ | |
24 | #define _nms_agent_h_ | |
25 | ||
adc00755 | 26 | #include <nms_common.h> |
64584976 | 27 | #include <nms_util.h> |
e6c91aac | 28 | #include <nxconfig.h> |
6827d635 | 29 | |
acc04d96 VK |
30 | /** |
31 | * Initialization function declaration macro | |
32 | */ | |
a0a945fb | 33 | #if defined(_STATIC_AGENT) || defined(_NETWARE) |
e6c91aac | 34 | #define DECLARE_SUBAGENT_ENTRY_POINT(name) extern "C" BOOL NxSubAgentRegister_##name(NETXMS_SUBAGENT_INFO **ppInfo, Config *config) |
a0a945fb | 35 | #else |
b5138dfb | 36 | #ifdef _WIN32 |
a0a945fb | 37 | #define DECLSPEC_EXPORT __declspec(dllexport) __cdecl |
b5138dfb VK |
38 | #else |
39 | #define DECLSPEC_EXPORT | |
40 | #endif | |
e6c91aac | 41 | #define DECLARE_SUBAGENT_ENTRY_POINT(name) extern "C" BOOL DECLSPEC_EXPORT NxSubAgentRegister(NETXMS_SUBAGENT_INFO **ppInfo, Config *config) |
b5138dfb VK |
42 | #endif |
43 | ||
86c126f5 VK |
44 | /** |
45 | * Constants | |
46 | */ | |
cbcaf8c8 | 47 | #define AGENT_LISTEN_PORT 4700 |
deaa4491 | 48 | #define AGENT_PROTOCOL_VERSION 2 |
cbcaf8c8 | 49 | #define MAX_RESULT_LENGTH 256 |
e22f1644 VK |
50 | #define MAX_CMD_LEN 256 |
51 | #define COMMAND_TIMEOUT 60 | |
47e0446b | 52 | #define MAX_SUBAGENT_NAME 64 |
86c126f5 | 53 | #define MAX_INSTANCE_COLUMNS 8 |
cbcaf8c8 | 54 | |
d02f6b92 VK |
55 | /** |
56 | * Agent policy types | |
57 | */ | |
6ca3b41c | 58 | #define AGENT_POLICY_CONFIG 1 |
f47c176c | 59 | #define AGENT_POLICY_LOG_PARSER 2 |
6ca3b41c | 60 | |
d02f6b92 VK |
61 | /** |
62 | * Error codes | |
63 | */ | |
967893bb VK |
64 | #define ERR_SUCCESS ((UINT32)0) |
65 | #define ERR_UNKNOWN_COMMAND ((UINT32)400) | |
66 | #define ERR_AUTH_REQUIRED ((UINT32)401) | |
67 | #define ERR_ACCESS_DENIED ((UINT32)403) | |
68 | #define ERR_UNKNOWN_PARAMETER ((UINT32)404) | |
69 | #define ERR_REQUEST_TIMEOUT ((UINT32)408) | |
70 | #define ERR_AUTH_FAILED ((UINT32)440) | |
71 | #define ERR_ALREADY_AUTHENTICATED ((UINT32)441) | |
72 | #define ERR_AUTH_NOT_REQUIRED ((UINT32)442) | |
73 | #define ERR_INTERNAL_ERROR ((UINT32)500) | |
74 | #define ERR_NOT_IMPLEMENTED ((UINT32)501) | |
75 | #define ERR_OUT_OF_RESOURCES ((UINT32)503) | |
76 | #define ERR_NOT_CONNECTED ((UINT32)900) | |
77 | #define ERR_CONNECTION_BROKEN ((UINT32)901) | |
78 | #define ERR_BAD_RESPONSE ((UINT32)902) | |
79 | #define ERR_IO_FAILURE ((UINT32)903) | |
80 | #define ERR_RESOURCE_BUSY ((UINT32)904) | |
81 | #define ERR_EXEC_FAILED ((UINT32)905) | |
82 | #define ERR_ENCRYPTION_REQUIRED ((UINT32)906) | |
83 | #define ERR_NO_CIPHERS ((UINT32)907) | |
84 | #define ERR_INVALID_PUBLIC_KEY ((UINT32)908) | |
85 | #define ERR_INVALID_SESSION_KEY ((UINT32)909) | |
86 | #define ERR_CONNECT_FAILED ((UINT32)910) | |
87 | #define ERR_MALFORMED_COMMAND ((UINT32)911) | |
88 | #define ERR_SOCKET_ERROR ((UINT32)912) | |
89 | #define ERR_BAD_ARGUMENTS ((UINT32)913) | |
90 | #define ERR_SUBAGENT_LOAD_FAILED ((UINT32)914) | |
91 | #define ERR_FILE_OPEN_ERROR ((UINT32)915) | |
92 | #define ERR_FILE_STAT_FAILED ((UINT32)916) | |
93 | #define ERR_MEM_ALLOC_FAILED ((UINT32)917) | |
94 | #define ERR_FILE_DELETE_FAILED ((UINT32)918) | |
cbcaf8c8 | 95 | |
d02f6b92 VK |
96 | /** |
97 | * Parameter handler return codes | |
98 | */ | |
cbcaf8c8 VK |
99 | #define SYSINFO_RC_SUCCESS 0 |
100 | #define SYSINFO_RC_UNSUPPORTED 1 | |
101 | #define SYSINFO_RC_ERROR 2 | |
102 | ||
d02f6b92 VK |
103 | /** |
104 | * WinPerf features | |
105 | */ | |
967893bb VK |
106 | #define WINPERF_AUTOMATIC_SAMPLE_COUNT ((UINT32)0x00000001) |
107 | #define WINPERF_REMOTE_COUNTER_CONFIG ((UINT32)0x00000002) | |
cbcaf8c8 | 108 | |
d02f6b92 VK |
109 | /** |
110 | * Descriptions for common parameters | |
111 | */ | |
bf3b7f79 VK |
112 | #define DCIDESC_FS_AVAIL _T("Available space on file system {instance}") |
113 | #define DCIDESC_FS_AVAILPERC _T("Percentage of available space on file system {instance}") | |
114 | #define DCIDESC_FS_FREE _T("Free space on file system {instance}") | |
115 | #define DCIDESC_FS_FREEPERC _T("Percentage of free space on file system {instance}") | |
116 | #define DCIDESC_FS_TOTAL _T("Total space on file system {instance}") | |
117 | #define DCIDESC_FS_USED _T("Used space on file system {instance}") | |
118 | #define DCIDESC_FS_USEDPERC _T("Percentage of used space on file system {instance}") | |
119 | #define DCIDESC_NET_INTERFACE_ADMINSTATUS _T("Administrative status of interface {instance}") | |
120 | #define DCIDESC_NET_INTERFACE_BYTESIN _T("Number of input bytes on interface {instance}") | |
121 | #define DCIDESC_NET_INTERFACE_BYTESOUT _T("Number of output bytes on interface {instance}") | |
122 | #define DCIDESC_NET_INTERFACE_DESCRIPTION _T("Description of interface {instance}") | |
123 | #define DCIDESC_NET_INTERFACE_INERRORS _T("Number of input errors on interface {instance}") | |
124 | #define DCIDESC_NET_INTERFACE_LINK _T("Link status for interface {instance}") | |
125 | #define DCIDESC_NET_INTERFACE_MTU _T("MTU for interface {instance}") | |
126 | #define DCIDESC_NET_INTERFACE_OPERSTATUS _T("Operational status of interface {instance}") | |
127 | #define DCIDESC_NET_INTERFACE_OUTERRORS _T("Number of output errors on interface {instance}") | |
128 | #define DCIDESC_NET_INTERFACE_PACKETSIN _T("Number of input packets on interface {instance}") | |
129 | #define DCIDESC_NET_INTERFACE_PACKETSOUT _T("Number of output packets on interface {instance}") | |
130 | #define DCIDESC_NET_INTERFACE_SPEED _T("Speed of interface {instance}") | |
131 | #define DCIDESC_NET_IP_FORWARDING _T("IP forwarding status") | |
132 | #define DCIDESC_NET_IP6_FORWARDING _T("IPv6 forwarding status") | |
133 | #define DCIDESC_PHYSICALDISK_FIRMWARE _T("Firmware version of hard disk {instance}") | |
134 | #define DCIDESC_PHYSICALDISK_MODEL _T("Model of hard disk {instance}") | |
135 | #define DCIDESC_PHYSICALDISK_SERIALNUMBER _T("Serial number of hard disk {instance}") | |
136 | #define DCIDESC_PHYSICALDISK_SMARTATTR _T("") | |
137 | #define DCIDESC_PHYSICALDISK_SMARTSTATUS _T("Status of hard disk {instance} reported by SMART") | |
138 | #define DCIDESC_PHYSICALDISK_TEMPERATURE _T("Temperature of hard disk {instance}") | |
139 | #define DCIDESC_SYSTEM_CPU_COUNT _T("Number of CPU in the system") | |
140 | #define DCIDESC_SYSTEM_HOSTNAME _T("Host name") | |
141 | #define DCIDESC_SYSTEM_MEMORY_PHYSICAL_FREE _T("Free physical memory") | |
142 | #define DCIDESC_SYSTEM_MEMORY_PHYSICAL_FREE_PCT _T("Percentage of free physical memory") | |
143 | #define DCIDESC_SYSTEM_MEMORY_PHYSICAL_TOTAL _T("Total amount of physical memory") | |
144 | #define DCIDESC_SYSTEM_MEMORY_PHYSICAL_USED _T("Used physical memory") | |
145 | #define DCIDESC_SYSTEM_MEMORY_PHYSICAL_USED_PCT _T("Percentage of used physical memory") | |
146 | #define DCIDESC_SYSTEM_MEMORY_PHYSICAL_AVAILABLE _T("Available physical memory") | |
147 | #define DCIDESC_SYSTEM_MEMORY_PHYSICAL_AVAILABLE_PCT _T("Percentage of available physical memory") | |
03a48429 VK |
148 | #define DCIDESC_SYSTEM_MEMORY_VIRTUAL_ACTIVE _T("Active virtual memory") |
149 | #define DCIDESC_SYSTEM_MEMORY_VIRTUAL_ACTIVE_PCT _T("Percentage of active virtual memory") | |
bf3b7f79 VK |
150 | #define DCIDESC_SYSTEM_MEMORY_VIRTUAL_FREE _T("Free virtual memory") |
151 | #define DCIDESC_SYSTEM_MEMORY_VIRTUAL_FREE_PCT _T("Percentage of free virtual memory") | |
152 | #define DCIDESC_SYSTEM_MEMORY_VIRTUAL_TOTAL _T("Total amount of virtual memory") | |
153 | #define DCIDESC_SYSTEM_MEMORY_VIRTUAL_USED _T("Used virtual memory") | |
154 | #define DCIDESC_SYSTEM_MEMORY_VIRTUAL_USED_PCT _T("Percentage of used virtual memory") | |
155 | #define DCIDESC_SYSTEM_MEMORY_VIRTUAL_AVAILABLE _T("Available virtual memory") | |
156 | #define DCIDESC_SYSTEM_MEMORY_VIRTUAL_AVAILABLE_PCT _T("Percentage of available virtual memory") | |
157 | #define DCIDESC_SYSTEM_MEMORY_SWAP_FREE _T("Free swap space") | |
158 | #define DCIDESC_SYSTEM_MEMORY_SWAP_FREE_PCT _T("Percentage of free swap space") | |
159 | #define DCIDESC_SYSTEM_MEMORY_SWAP_TOTAL _T("Total amount of swap space") | |
160 | #define DCIDESC_SYSTEM_MEMORY_SWAP_USED _T("Used swap space") | |
161 | #define DCIDESC_SYSTEM_MEMORY_SWAP_USED_PCT _T("Percentage of used swap space") | |
162 | #define DCIDESC_SYSTEM_UNAME _T("System uname") | |
163 | #define DCIDESC_AGENT_ACCEPTEDCONNECTIONS _T("Number of connections accepted by agent") | |
164 | #define DCIDESC_AGENT_ACCEPTERRORS _T("Number of accept() call errors") | |
165 | #define DCIDESC_AGENT_ACTIVECONNECTIONS _T("Number of active connections to agent") | |
166 | #define DCIDESC_AGENT_AUTHENTICATIONFAILURES _T("Number of authentication failures") | |
167 | #define DCIDESC_AGENT_CONFIG_SERVER _T("Configuration server address set on agent startup") | |
168 | #define DCIDESC_AGENT_FAILEDREQUESTS _T("Number of failed requests to agent") | |
169 | #define DCIDESC_AGENT_GENERATED_TRAPS _T("Number of traps generated by agent") | |
05db3127 | 170 | #define DCIDESC_AGENT_IS_SUBAGENT_LOADED _T("Check if given subagent is loaded") |
bf3b7f79 VK |
171 | #define DCIDESC_AGENT_LAST_TRAP_TIME _T("Timestamp of last generated trap") |
172 | #define DCIDESC_AGENT_PROCESSEDREQUESTS _T("Number of requests processed by agent") | |
173 | #define DCIDESC_AGENT_REGISTRAR _T("Registrar server address set on agent startup") | |
174 | #define DCIDESC_AGENT_REJECTEDCONNECTIONS _T("Number of connections rejected by agent") | |
175 | #define DCIDESC_AGENT_SENT_TRAPS _T("Number of traps successfully sent to server") | |
05db3127 | 176 | #define DCIDESC_AGENT_SOURCEPACKAGESUPPORT _T("Check if source packages are supported") |
bf3b7f79 VK |
177 | #define DCIDESC_AGENT_SUPPORTEDCIPHERS _T("List of ciphers supported by agent") |
178 | #define DCIDESC_AGENT_TIMEDOUTREQUESTS _T("Number of timed out requests to agent") | |
179 | #define DCIDESC_AGENT_UNSUPPORTEDREQUESTS _T("Number of requests for unsupported parameters") | |
180 | #define DCIDESC_AGENT_UPTIME _T("Agent's uptime") | |
181 | #define DCIDESC_AGENT_VERSION _T("Agent's version") | |
182 | #define DCIDESC_FILE_COUNT _T("Number of files {instance}") | |
183 | #define DCIDESC_FILE_HASH_CRC32 _T("CRC32 checksum of {instance}") | |
184 | #define DCIDESC_FILE_HASH_MD5 _T("MD5 hash of {instance}") | |
185 | #define DCIDESC_FILE_HASH_SHA1 _T("SHA1 hash of {instance}") | |
186 | #define DCIDESC_FILE_SIZE _T("Size of file {instance}") | |
187 | #define DCIDESC_FILE_TIME_ACCESS _T("Time of last access to file {instance}") | |
188 | #define DCIDESC_FILE_TIME_CHANGE _T("Time of last status change of file {instance}") | |
189 | #define DCIDESC_FILE_TIME_MODIFY _T("Time of last modification of file {instance}") | |
8ce7501b | 190 | #define DCIDESC_SYSTEM_CURRENTTIME _T("Current system time") |
bf3b7f79 VK |
191 | #define DCIDESC_SYSTEM_PLATFORMNAME _T("Platform name") |
192 | #define DCIDESC_PROCESS_COUNT _T("Number of {instance} processes") | |
193 | #define DCIDESC_PROCESS_COUNTEX _T("Number of {instance} processes (extended)") | |
545c3996 | 194 | #define DCIDESC_PROCESS_ZOMBIE_COUNT _T("Number of {instance} zombie processes") |
bf3b7f79 VK |
195 | #define DCIDESC_PROCESS_CPUTIME _T("Total execution time for process {instance}") |
196 | #define DCIDESC_PROCESS_GDIOBJ _T("GDI objects used by process {instance}") | |
197 | #define DCIDESC_PROCESS_IO_OTHERB _T("") | |
198 | #define DCIDESC_PROCESS_IO_OTHEROP _T("") | |
199 | #define DCIDESC_PROCESS_IO_READB _T("") | |
200 | #define DCIDESC_PROCESS_IO_READOP _T("") | |
201 | #define DCIDESC_PROCESS_IO_WRITEB _T("") | |
202 | #define DCIDESC_PROCESS_IO_WRITEOP _T("") | |
203 | #define DCIDESC_PROCESS_KERNELTIME _T("Total execution time in kernel mode for process {instance}") | |
204 | #define DCIDESC_PROCESS_PAGEFAULTS _T("Page faults for process {instance}") | |
205 | #define DCIDESC_PROCESS_SYSCALLS _T("Number of system calls made by process {instance}") | |
206 | #define DCIDESC_PROCESS_THREADS _T("Number of threads in process {instance}") | |
207 | #define DCIDESC_PROCESS_USEROBJ _T("USER objects used by process {instance}") | |
208 | #define DCIDESC_PROCESS_USERTIME _T("Total execution time in user mode for process {instance}") | |
209 | #define DCIDESC_PROCESS_VMSIZE _T("Virtual memory used by process {instance}") | |
210 | #define DCIDESC_PROCESS_WKSET _T("Physical memory used by process {instance}") | |
211 | #define DCIDESC_SYSTEM_APPADDRESSSPACE _T("Address space available to applications (MB)") | |
212 | #define DCIDESC_SYSTEM_CONNECTEDUSERS _T("Number of logged in users") | |
213 | #define DCIDESC_SYSTEM_PROCESSCOUNT _T("Total number of processes") | |
214 | #define DCIDESC_SYSTEM_SERVICESTATE _T("State of {instance} service") | |
215 | #define DCIDESC_SYSTEM_PROCESSCOUNT _T("Total number of processes") | |
216 | #define DCIDESC_SYSTEM_THREADCOUNT _T("Total number of threads") | |
217 | #define DCIDESC_PDH_COUNTERVALUE _T("Value of PDH counter {instance}") | |
218 | #define DCIDESC_PDH_VERSION _T("Version of PDH.DLL") | |
219 | #define DCIDESC_SYSTEM_UPTIME _T("System uptime") | |
220 | #define DCIDESC_SYSTEM_CPU_LOADAVG _T("Average CPU load for last minute") | |
221 | #define DCIDESC_SYSTEM_CPU_LOADAVG5 _T("Average CPU load for last 5 minutes") | |
222 | #define DCIDESC_SYSTEM_CPU_LOADAVG15 _T("Average CPU load for last 15 minutes") | |
223 | ||
224 | ||
225 | #define DCIDESC_SYSTEM_CPU_USAGE_EX _T("Average CPU {instance} utilization for last minute") | |
226 | #define DCIDESC_SYSTEM_CPU_USAGE5_EX _T("Average CPU {instance} utilization for last 5 minutes") | |
227 | #define DCIDESC_SYSTEM_CPU_USAGE15_EX _T("Average CPU {instance} utilization for last 15 minutes") | |
228 | #define DCIDESC_SYSTEM_CPU_USAGE _T("Average CPU utilization for last minute") | |
229 | #define DCIDESC_SYSTEM_CPU_USAGE5 _T("Average CPU utilization for last 5 minutes") | |
230 | #define DCIDESC_SYSTEM_CPU_USAGE15 _T("Average CPU utilization for last 15 minutes") | |
231 | ||
232 | #define DCIDESC_SYSTEM_CPU_USAGE_USER_EX _T("Average CPU {instance} utilization (user) for last minute") | |
233 | #define DCIDESC_SYSTEM_CPU_USAGE5_USER_EX _T("Average CPU {instance} utilization (user) for last 5 minutes") | |
234 | #define DCIDESC_SYSTEM_CPU_USAGE15_USER_EX _T("Average CPU {instance} utilization (user) for last 15 minutes") | |
235 | #define DCIDESC_SYSTEM_CPU_USAGE_USER _T("Average CPU utilization (user) for last minute") | |
236 | #define DCIDESC_SYSTEM_CPU_USAGE5_USER _T("Average CPU utilization (user) for last 5 minutes") | |
237 | #define DCIDESC_SYSTEM_CPU_USAGE15_USER _T("Average CPU utilization (user) for last 15 minutes") | |
238 | ||
239 | #define DCIDESC_SYSTEM_CPU_USAGE_NICE_EX _T("Average CPU {instance} utilization (nice) for last minute") | |
240 | #define DCIDESC_SYSTEM_CPU_USAGE5_NICE_EX _T("Average CPU {instance} utilization (nice) for last 5 minutes") | |
241 | #define DCIDESC_SYSTEM_CPU_USAGE15_NICE_EX _T("Average CPU {instance} utilization (nice) for last 15 minutes") | |
242 | #define DCIDESC_SYSTEM_CPU_USAGE_NICE _T("Average CPU utilization (nice) for last minute") | |
243 | #define DCIDESC_SYSTEM_CPU_USAGE5_NICE _T("Average CPU utilization (nice) for last 5 minutes") | |
244 | #define DCIDESC_SYSTEM_CPU_USAGE15_NICE _T("Average CPU utilization (nice) for last 15 minutes") | |
245 | ||
246 | #define DCIDESC_SYSTEM_CPU_USAGE_SYSTEM_EX _T("Average CPU {instance} utilization (system) for last minute") | |
247 | #define DCIDESC_SYSTEM_CPU_USAGE5_SYSTEM_EX _T("Average CPU {instance} utilization (system) for last 5 minutes") | |
248 | #define DCIDESC_SYSTEM_CPU_USAGE15_SYSTEM_EX _T("Average CPU {instance} utilization (system) for last 15 minutes") | |
249 | #define DCIDESC_SYSTEM_CPU_USAGE_SYSTEM _T("Average CPU utilization (system) for last minute") | |
250 | #define DCIDESC_SYSTEM_CPU_USAGE5_SYSTEM _T("Average CPU utilization (system) for last 5 minutes") | |
251 | #define DCIDESC_SYSTEM_CPU_USAGE15_SYSTEM _T("Average CPU utilization (system) for last 15 minutes") | |
252 | ||
253 | #define DCIDESC_SYSTEM_CPU_USAGE_IDLE_EX _T("Average CPU {instance} utilization (idle) for last minute") | |
254 | #define DCIDESC_SYSTEM_CPU_USAGE5_IDLE_EX _T("Average CPU {instance} utilization (idle) for last 5 minutes") | |
255 | #define DCIDESC_SYSTEM_CPU_USAGE15_IDLE_EX _T("Average CPU {instance} utilization (idle) for last 15 minutes") | |
256 | #define DCIDESC_SYSTEM_CPU_USAGE_IDLE _T("Average CPU utilization (idle) for last minute") | |
257 | #define DCIDESC_SYSTEM_CPU_USAGE5_IDLE _T("Average CPU utilization (idle) for last 5 minutes") | |
258 | #define DCIDESC_SYSTEM_CPU_USAGE15_IDLE _T("Average CPU utilization (idle) for last 15 minutes") | |
259 | ||
260 | #define DCIDESC_SYSTEM_CPU_USAGE_IOWAIT_EX _T("Average CPU {instance} utilization (iowait) for last minute") | |
261 | #define DCIDESC_SYSTEM_CPU_USAGE5_IOWAIT_EX _T("Average CPU {instance} utilization (iowait) for last 5 minutes") | |
262 | #define DCIDESC_SYSTEM_CPU_USAGE15_IOWAIT_EX _T("Average CPU {instance} utilization (iowait) for last 15 minutes") | |
263 | #define DCIDESC_SYSTEM_CPU_USAGE_IOWAIT _T("Average CPU utilization (iowait) for last minute") | |
264 | #define DCIDESC_SYSTEM_CPU_USAGE5_IOWAIT _T("Average CPU utilization (iowait) for last 5 minutes") | |
265 | #define DCIDESC_SYSTEM_CPU_USAGE15_IOWAIT _T("Average CPU utilization (iowait) for last 15 minutes") | |
266 | ||
267 | #define DCIDESC_SYSTEM_CPU_USAGE_IRQ_EX _T("Average CPU {instance} utilization (irq) for last minute") | |
268 | #define DCIDESC_SYSTEM_CPU_USAGE5_IRQ_EX _T("Average CPU {instance} utilization (irq) for last 5 minutes") | |
269 | #define DCIDESC_SYSTEM_CPU_USAGE15_IRQ_EX _T("Average CPU {instance} utilization (irq) for last 15 minutes") | |
270 | #define DCIDESC_SYSTEM_CPU_USAGE_IRQ _T("Average CPU utilization (irq) for last minute") | |
271 | #define DCIDESC_SYSTEM_CPU_USAGE5_IRQ _T("Average CPU utilization (irq) for last 5 minutes") | |
272 | #define DCIDESC_SYSTEM_CPU_USAGE15_IRQ _T("Average CPU utilization (irq) for last 15 minutes") | |
273 | ||
274 | #define DCIDESC_SYSTEM_CPU_USAGE_SOFTIRQ_EX _T("Average CPU {instance} utilization (softirq) for last minute") | |
275 | #define DCIDESC_SYSTEM_CPU_USAGE5_SOFTIRQ_EX _T("Average CPU {instance} utilization (softirq) for last 5 minutes") | |
276 | #define DCIDESC_SYSTEM_CPU_USAGE15_SOFTIRQ_EX _T("Average CPU {instance} utilization (softirq) for last 15 minutes") | |
277 | #define DCIDESC_SYSTEM_CPU_USAGE_SOFTIRQ _T("Average CPU utilization (softirq) for last minute") | |
278 | #define DCIDESC_SYSTEM_CPU_USAGE5_SOFTIRQ _T("Average CPU utilization (softirq) for last 5 minutes") | |
279 | #define DCIDESC_SYSTEM_CPU_USAGE15_SOFTIRQ _T("Average CPU utilization (softirq) for last 15 minutes") | |
280 | ||
281 | #define DCIDESC_SYSTEM_CPU_USAGE_STEAL_EX _T("Average CPU {instance} utilization (steal) for last minute") | |
282 | #define DCIDESC_SYSTEM_CPU_USAGE5_STEAL_EX _T("Average CPU {instance} utilization (steal) for last 5 minutes") | |
283 | #define DCIDESC_SYSTEM_CPU_USAGE15_STEAL_EX _T("Average CPU {instance} utilization (steal) for last 15 minutes") | |
284 | #define DCIDESC_SYSTEM_CPU_USAGE_STEAL _T("Average CPU utilization (steal) for last minute") | |
285 | #define DCIDESC_SYSTEM_CPU_USAGE5_STEAL _T("Average CPU utilization (steal) for last 5 minutes") | |
286 | #define DCIDESC_SYSTEM_CPU_USAGE15_STEAL _T("Average CPU utilization (steal) for last 15 minutes") | |
287 | ||
288 | #define DCIDESC_SYSTEM_CPU_USAGE_GUEST_EX _T("Average CPU {instance} utilization (guest) for last minute") | |
289 | #define DCIDESC_SYSTEM_CPU_USAGE5_GUEST_EX _T("Average CPU {instance} utilization (guest) for last 5 minutes") | |
290 | #define DCIDESC_SYSTEM_CPU_USAGE15_GUEST_EX _T("Average CPU {instance} utilization (guest) for last 15 minutes") | |
291 | #define DCIDESC_SYSTEM_CPU_USAGE_GUEST _T("Average CPU utilization (guest) for last minute") | |
292 | #define DCIDESC_SYSTEM_CPU_USAGE5_GUEST _T("Average CPU utilization (guest) for last 5 minutes") | |
293 | #define DCIDESC_SYSTEM_CPU_USAGE15_GUEST _T("Average CPU utilization (guest) for last 15 minutes") | |
294 | ||
295 | #define DCIDESC_SYSTEM_IO_DISKQUEUE _T("Average disk queue length for last minute") | |
3e00a175 VK |
296 | #define DCIDESC_SYSTEM_IO_DISKQUEUE_MIN _T("Minimum disk queue length for last minute") |
297 | #define DCIDESC_SYSTEM_IO_DISKQUEUE_MAX _T("Maximum disk queue length for last minute") | |
bf3b7f79 | 298 | #define DCIDESC_SYSTEM_IO_DISKQUEUE_EX _T("Average disk queue length of device {instance} for last minute") |
3e00a175 VK |
299 | #define DCIDESC_SYSTEM_IO_DISKQUEUE_EX_MIN _T("Minimum disk queue length of device {instance} for last minute") |
300 | #define DCIDESC_SYSTEM_IO_DISKQUEUE_EX_MAX _T("Maximum disk queue length of device {instance} for last minute") | |
bf3b7f79 VK |
301 | #define DCIDESC_SYSTEM_IO_DISKTIME _T("Percent of CPU time spent on I/O for last minute") |
302 | #define DCIDESC_SYSTEM_IO_DISKTIME_EX _T("Percent of CPU time spent on I/O on device {instance} for last minute") | |
303 | #define DCIDESC_SYSTEM_IO_WAITTIME _T("Average I/O request wait time") | |
304 | #define DCIDESC_SYSTEM_IO_WAITTIME_EX _T("Average I/O request wait time for device {instance}") | |
305 | #define DCIDESC_SYSTEM_IO_READS _T("Average number of read operations for last minute") | |
3e00a175 VK |
306 | #define DCIDESC_SYSTEM_IO_READS_MIN _T("Minimum number of read operations for last minute") |
307 | #define DCIDESC_SYSTEM_IO_READS_MAX _T("Maximum number of read operations for last minute") | |
bf3b7f79 | 308 | #define DCIDESC_SYSTEM_IO_READS_EX _T("Average number of read operations on device {instance} for last minute") |
3e00a175 VK |
309 | #define DCIDESC_SYSTEM_IO_READS_EX_MIN _T("Minimum number of read operations on device {instance} for last minute") |
310 | #define DCIDESC_SYSTEM_IO_READS_EX_MAX _T("Maximum number of read operations on device {instance} for last minute") | |
bf3b7f79 | 311 | #define DCIDESC_SYSTEM_IO_WRITES _T("Average number of write operations for last minute") |
3e00a175 VK |
312 | #define DCIDESC_SYSTEM_IO_WRITES_MIN _T("Minimum number of write operations for last minute") |
313 | #define DCIDESC_SYSTEM_IO_WRITES_MAX _T("Maximum number of write operations for last minute") | |
bf3b7f79 | 314 | #define DCIDESC_SYSTEM_IO_WRITES_EX _T("Average number of write operations on device {instance} for last minute") |
3e00a175 VK |
315 | #define DCIDESC_SYSTEM_IO_WRITES_EX_MIN _T("Minimum number of write operations on device {instance} for last minute") |
316 | #define DCIDESC_SYSTEM_IO_WRITES_EX_MAX _T("Maximum number of write operations on device {instance} for last minute") | |
bf3b7f79 | 317 | #define DCIDESC_SYSTEM_IO_XFERS _T("Average number of I/O transfers for last minute") |
3e00a175 VK |
318 | #define DCIDESC_SYSTEM_IO_XFERS_MIN _T("Minimum number of I/O transfers for last minute") |
319 | #define DCIDESC_SYSTEM_IO_XFERS_MAX _T("Maximum number of I/O transfers for last minute") | |
bf3b7f79 | 320 | #define DCIDESC_SYSTEM_IO_XFERS_EX _T("Average number of I/O transfers on device {instance} for last minute") |
3e00a175 VK |
321 | #define DCIDESC_SYSTEM_IO_XFERS_EX_MIN _T("Minimum number of I/O transfers on device {instance} for last minute") |
322 | #define DCIDESC_SYSTEM_IO_XFERS_EX_MAX _T("Maximum number of I/O transfers on device {instance} for last minute") | |
bf3b7f79 | 323 | #define DCIDESC_SYSTEM_IO_BYTEREADS _T("Average number of bytes read for last minute") |
3e00a175 VK |
324 | #define DCIDESC_SYSTEM_IO_BYTEREADS_MIN _T("Minimum number of bytes read for last minute") |
325 | #define DCIDESC_SYSTEM_IO_BYTEREADS_MAX _T("Maximum number of bytes read for last minute") | |
bf3b7f79 | 326 | #define DCIDESC_SYSTEM_IO_BYTEREADS_EX _T("Average number of bytes read on device {instance} for last minute") |
3e00a175 VK |
327 | #define DCIDESC_SYSTEM_IO_BYTEREADS_EX_MIN _T("Minimum number of bytes read on device {instance} for last minute") |
328 | #define DCIDESC_SYSTEM_IO_BYTEREADS_EX_MAX _T("Maximum number of bytes read on device {instance} for last minute") | |
bf3b7f79 | 329 | #define DCIDESC_SYSTEM_IO_BYTEWRITES _T("Average number of bytes written for last minute") |
3e00a175 VK |
330 | #define DCIDESC_SYSTEM_IO_BYTEWRITES_MIN _T("Minimum number of bytes written for last minute") |
331 | #define DCIDESC_SYSTEM_IO_BYTEWRITES_MAX _T("Maximum number of bytes written for last minute") | |
bf3b7f79 | 332 | #define DCIDESC_SYSTEM_IO_BYTEWRITES_EX _T("Average number of bytes written on device {instance} for last minute") |
3e00a175 VK |
333 | #define DCIDESC_SYSTEM_IO_BYTEWRITES_EX_MIN _T("Minimum number of bytes written on device {instance} for last minute") |
334 | #define DCIDESC_SYSTEM_IO_BYTEWRITES_EX_MAX _T("Maximum number of bytes written on device {instance} for last minute") | |
bf3b7f79 VK |
335 | #define DCIDESC_SYSTEM_IO_OPENFILES _T("Number of open files") |
336 | ||
337 | ||
338 | #define DCIDESC_DEPRECATED _T("<deprecated>") | |
30c68fa1 AK |
339 | |
340 | ||
ad12a86f | 341 | #define DCTDESC_AGENT_SUBAGENTS _T("Loaded subagents") |
a8799146 | 342 | #define DCTDESC_FILESYSTEM_VOLUMES _T("File system volumes") |
ac60d715 | 343 | #define DCTDESC_SYSTEM_INSTALLED_PRODUCTS _T("Installed products") |
ad12a86f | 344 | #define DCTDESC_SYSTEM_PROCESSES _T("Processes") |
cc8ce218 | 345 | |
0f506caa VK |
346 | /** |
347 | * Subagent's parameter information | |
348 | */ | |
6827d635 VK |
349 | typedef struct |
350 | { | |
4687826e VK |
351 | TCHAR name[MAX_PARAM_NAME]; |
352 | LONG (* handler)(const TCHAR *, const TCHAR *, TCHAR *); | |
353 | const TCHAR *arg; | |
354 | int dataType; // Use DT_DEPRECATED to indicate deprecated parameter | |
355 | TCHAR description[MAX_DB_STRING]; | |
6827d635 VK |
356 | } NETXMS_SUBAGENT_PARAM; |
357 | ||
0f506caa VK |
358 | /** |
359 | * Subagent's push parameter information | |
360 | */ | |
f480bdd4 VK |
361 | typedef struct |
362 | { | |
363 | TCHAR name[MAX_PARAM_NAME]; | |
364 | int dataType; | |
365 | TCHAR description[MAX_DB_STRING]; | |
366 | } NETXMS_SUBAGENT_PUSHPARAM; | |
367 | ||
0f506caa VK |
368 | /** |
369 | * Subagent's list information | |
370 | */ | |
901c96c7 VK |
371 | typedef struct |
372 | { | |
4687826e VK |
373 | TCHAR name[MAX_PARAM_NAME]; |
374 | LONG (* handler)(const TCHAR *, const TCHAR *, StringList *); | |
375 | const TCHAR *arg; | |
376 | } NETXMS_SUBAGENT_LIST; | |
377 | ||
0f506caa VK |
378 | /** |
379 | * Subagent's table information | |
380 | */ | |
4687826e VK |
381 | typedef struct |
382 | { | |
383 | TCHAR name[MAX_PARAM_NAME]; | |
384 | LONG (* handler)(const TCHAR *, const TCHAR *, Table *); | |
385 | const TCHAR *arg; | |
52f5ee00 | 386 | TCHAR instanceColumns[MAX_COLUMN_NAME * MAX_INSTANCE_COLUMNS]; |
cc8ce218 | 387 | TCHAR description[MAX_DB_STRING]; |
4687826e | 388 | } NETXMS_SUBAGENT_TABLE; |
901c96c7 | 389 | |
0f506caa VK |
390 | /** |
391 | * Subagent's action information | |
392 | */ | |
37778a1d VK |
393 | typedef struct |
394 | { | |
4687826e VK |
395 | TCHAR name[MAX_PARAM_NAME]; |
396 | LONG (* handler)(const TCHAR *, StringList *, const TCHAR *); | |
397 | const TCHAR *arg; | |
398 | TCHAR description[MAX_DB_STRING]; | |
37778a1d VK |
399 | } NETXMS_SUBAGENT_ACTION; |
400 | ||
0f506caa VK |
401 | /** |
402 | * Subagent initialization structure | |
403 | */ | |
967893bb | 404 | #define NETXMS_SUBAGENT_INFO_MAGIC ((UINT32)0x20110301) |
ded831ac VK |
405 | |
406 | class CSCPMessage; | |
d618c3ae | 407 | |
6827d635 VK |
408 | typedef struct |
409 | { | |
967893bb | 410 | UINT32 magic; // Magic number to check if subagent uses correct version of this structure |
4687826e VK |
411 | TCHAR name[MAX_SUBAGENT_NAME]; |
412 | TCHAR version[32]; | |
413 | BOOL (* init)(Config *); // Called to initialize subagent. Can be NULL. | |
414 | void (* shutdown)(); // Called at subagent unload. Can be NULL. | |
7d908e04 | 415 | BOOL (* commandHandler)(UINT32 dwCommand, CSCPMessage *pRequest, CSCPMessage *pResponse, void *session); |
967893bb | 416 | UINT32 numParameters; |
4687826e | 417 | NETXMS_SUBAGENT_PARAM *parameters; |
967893bb | 418 | UINT32 numLists; |
4687826e | 419 | NETXMS_SUBAGENT_LIST *lists; |
967893bb | 420 | UINT32 numTables; |
4687826e | 421 | NETXMS_SUBAGENT_TABLE *tables; |
967893bb | 422 | UINT32 numActions; |
4687826e | 423 | NETXMS_SUBAGENT_ACTION *actions; |
967893bb | 424 | UINT32 numPushParameters; |
4687826e | 425 | NETXMS_SUBAGENT_PUSHPARAM *pushParameters; |
6827d635 | 426 | } NETXMS_SUBAGENT_INFO; |
3b376ea0 | 427 | |
0f506caa VK |
428 | /** |
429 | * Inline functions for returning parameters | |
430 | */ | |
a765d97c | 431 | inline void ret_string(TCHAR *rbuf, const TCHAR *value) |
cbcaf8c8 | 432 | { |
a23d8e0d | 433 | nx_strncpy(rbuf, value, MAX_RESULT_LENGTH); |
cbcaf8c8 VK |
434 | } |
435 | ||
f3387429 VK |
436 | inline void ret_wstring(TCHAR *rbuf, const WCHAR *value) |
437 | { | |
438 | #ifdef UNICODE | |
439 | nx_strncpy(rbuf, value, MAX_RESULT_LENGTH); | |
440 | #else | |
441 | WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK | WC_DEFAULTCHAR, value, -1, rbuf, MAX_RESULT_LENGTH, NULL, NULL); | |
442 | rbuf[MAX_RESULT_LENGTH - 1] = 0; | |
443 | #endif | |
444 | } | |
445 | ||
446 | inline void ret_mbstring(TCHAR *rbuf, const char *value) | |
447 | { | |
448 | #ifdef UNICODE | |
449 | MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, value, -1, rbuf, MAX_RESULT_LENGTH); | |
450 | rbuf[MAX_RESULT_LENGTH - 1] = 0; | |
451 | #else | |
452 | nx_strncpy(rbuf, value, MAX_RESULT_LENGTH); | |
453 | #endif | |
454 | } | |
455 | ||
0212dc5a | 456 | inline void ret_int(TCHAR *rbuf, LONG value) |
cbcaf8c8 | 457 | { |
66d07089 | 458 | #if defined(_WIN32) && (_MSC_VER >= 1300) |
6e38075b | 459 | _sntprintf_s(rbuf, MAX_RESULT_LENGTH, _TRUNCATE, _T("%ld"), (long)value); |
a23d8e0d | 460 | #else |
6e38075b | 461 | _sntprintf(rbuf, MAX_RESULT_LENGTH, _T("%ld"), (long)value); |
a23d8e0d | 462 | #endif |
cbcaf8c8 VK |
463 | } |
464 | ||
967893bb | 465 | inline void ret_uint(TCHAR *rbuf, UINT32 value) |
cbcaf8c8 | 466 | { |
66d07089 | 467 | #if defined(_WIN32) && (_MSC_VER >= 1300) |
6e38075b | 468 | _sntprintf_s(rbuf, MAX_RESULT_LENGTH, _TRUNCATE, _T("%lu"), (unsigned long)value); |
a23d8e0d | 469 | #else |
6e38075b | 470 | _sntprintf(rbuf, MAX_RESULT_LENGTH, _T("%lu"), (unsigned long)value); |
a23d8e0d | 471 | #endif |
cbcaf8c8 VK |
472 | } |
473 | ||
018fda4d | 474 | inline void ret_double(TCHAR *rbuf, double value) |
cbcaf8c8 | 475 | { |
66d07089 | 476 | #if defined(_WIN32) && (_MSC_VER >= 1300) |
a23d8e0d VK |
477 | _sntprintf_s(rbuf, MAX_RESULT_LENGTH, _TRUNCATE, _T("%f"), value); |
478 | #else | |
8b86c5dc | 479 | _sntprintf(rbuf, MAX_RESULT_LENGTH, _T("%f"), value); |
a23d8e0d | 480 | #endif |
cbcaf8c8 VK |
481 | } |
482 | ||
018fda4d | 483 | inline void ret_int64(TCHAR *rbuf, INT64 value) |
cbcaf8c8 | 484 | { |
66d07089 | 485 | #if defined(_WIN32) && (_MSC_VER >= 1300) |
a23d8e0d | 486 | _sntprintf_s(rbuf, MAX_RESULT_LENGTH, _TRUNCATE, _T("%I64d"), value); |
cbcaf8c8 | 487 | #else /* _WIN32 */ |
ccc34207 | 488 | _sntprintf(rbuf, MAX_RESULT_LENGTH, INT64_FMT, value); |
cbcaf8c8 VK |
489 | #endif /* _WIN32 */ |
490 | } | |
491 | ||
018fda4d | 492 | inline void ret_uint64(TCHAR *rbuf, QWORD value) |
cbcaf8c8 | 493 | { |
66d07089 | 494 | #if defined(_WIN32) && (_MSC_VER >= 1300) |
a23d8e0d | 495 | _sntprintf_s(rbuf, MAX_RESULT_LENGTH, _TRUNCATE, _T("%I64u"), value); |
cbcaf8c8 | 496 | #else /* _WIN32 */ |
ccc34207 | 497 | _sntprintf(rbuf, MAX_RESULT_LENGTH, UINT64_FMT, value); |
cbcaf8c8 VK |
498 | #endif /* _WIN32 */ |
499 | } | |
500 | ||
23d3d35d | 501 | /** |
502 | * Api for CommSession | |
503 | */ | |
504 | class AbstractCommSession | |
505 | { | |
506 | public: | |
507 | virtual UINT32 openFile(TCHAR* nameOfFile, UINT32 requestId) = 0; | |
508 | virtual BOOL isMasterServer() = 0; | |
509 | virtual UINT32 getServerAddress() = 0; | |
510 | virtual void sendMessage(CSCPMessage *pMsg) = 0; | |
511 | }; | |
6827d635 VK |
512 | |
513 | // | |
6173bea8 | 514 | // API for subagents |
6827d635 | 515 | // |
f3387429 VK |
516 | BOOL LIBNETXMS_EXPORTABLE AgentGetParameterArgA(const TCHAR *param, int index, char *arg, int maxSize); |
517 | BOOL LIBNETXMS_EXPORTABLE AgentGetParameterArgW(const TCHAR *param, int index, WCHAR *arg, int maxSize); | |
518 | #ifdef UNICODE | |
519 | #define AgentGetParameterArg AgentGetParameterArgW | |
520 | #else | |
521 | #define AgentGetParameterArg AgentGetParameterArgA | |
522 | #endif | |
523 | ||
640b6719 | 524 | void LIBNETXMS_EXPORTABLE AgentWriteLog(int logLevel, const TCHAR *format, ...) |
6e383343 | 525 | #if !defined(UNICODE) && (defined(__GNUC__) || defined(__clang__)) |
640b6719 VK |
526 | __attribute__ ((format(printf, 2, 3))) |
527 | #endif | |
528 | ; | |
c303351c | 529 | void LIBNETXMS_EXPORTABLE AgentWriteLog2(int logLevel, const TCHAR *format, va_list args); |
640b6719 | 530 | void LIBNETXMS_EXPORTABLE AgentWriteDebugLog(int level, const TCHAR *format, ...) |
6e383343 | 531 | #if !defined(UNICODE) && (defined(__GNUC__) || defined(__clang__)) |
640b6719 VK |
532 | __attribute__ ((format(printf, 2, 3))) |
533 | #endif | |
534 | ; | |
c303351c | 535 | void LIBNETXMS_EXPORTABLE AgentWriteDebugLog2(int level, const TCHAR *format, va_list args); |
967893bb VK |
536 | void LIBNETXMS_EXPORTABLE AgentSendTrap(UINT32 dwEvent, const TCHAR *eventName, const char *pszFormat, ...); |
537 | void LIBNETXMS_EXPORTABLE AgentSendTrap2(UINT32 dwEvent, const TCHAR *eventName, int nCount, TCHAR **ppszArgList); | |
23d3d35d | 538 | bool LIBNETXMS_EXPORTABLE EnumerateSessions(bool (* callback)(AbstractCommSession *, void *), void *data); |
cc022855 | 539 | BOOL LIBNETXMS_EXPORTABLE AgentSendFileToServer(void *session, UINT32 requestId, const TCHAR *file, long offset); |
f480bdd4 | 540 | BOOL LIBNETXMS_EXPORTABLE AgentPushParameterData(const TCHAR *parameter, const TCHAR *value); |
9309ac95 | 541 | BOOL LIBNETXMS_EXPORTABLE AgentPushParameterDataInt32(const TCHAR *parameter, LONG value); |
967893bb | 542 | BOOL LIBNETXMS_EXPORTABLE AgentPushParameterDataUInt32(const TCHAR *parameter, UINT32 value); |
9309ac95 VK |
543 | BOOL LIBNETXMS_EXPORTABLE AgentPushParameterDataInt64(const TCHAR *parameter, INT64 value); |
544 | BOOL LIBNETXMS_EXPORTABLE AgentPushParameterDataUInt64(const TCHAR *parameter, QWORD value); | |
545 | BOOL LIBNETXMS_EXPORTABLE AgentPushParameterDataDouble(const TCHAR *parameter, double value); | |
6827d635 | 546 | |
23d3d35d | 547 | void LIBNETXMS_EXPORTABLE InitSubAgentAPI(void (* writeLog)(int, int, const TCHAR *), |
548 | void (* sendTrap1)(UINT32, const TCHAR *, const char *, va_list), | |
549 | void (* sendTrap2)(UINT32, const TCHAR *, int, TCHAR **), | |
550 | bool (* enumerateSessions)(bool (*)(AbstractCommSession *, void *), void *), | |
551 | bool (* sendFile)(void *, UINT32, const TCHAR *, long), | |
552 | bool (* pushData)(const TCHAR *, const TCHAR *, UINT32)); | |
553 | ||
cbcaf8c8 | 554 | #endif /* _nms_agent_h_ */ |