Initial agent-side code for agent to server connections
[public/netxms.git] / include / nms_agent.h
1 /*
2 ** NetXMS - Network Management System
3 ** Copyright (C) 2003-2013 Victor Kirhenshtein
4 **
5 ** This program is free software; you can redistribute it and/or modify
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
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 **
15 ** You should have received a copy of the GNU Lesser General Public License
16 ** along with this program; if not, write to the Free Software
17 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 **
19 ** File: nms_agent.h
20 **
21 **/
22
23 #ifndef _nms_agent_h_
24 #define _nms_agent_h_
25
26 #ifdef _WIN32
27 #ifdef LIBNXAGENT_EXPORTS
28 #define LIBNXAGENT_EXPORTABLE __declspec(dllexport)
29 #else
30 #define LIBNXAGENT_EXPORTABLE __declspec(dllimport)
31 #endif
32 #else /* _WIN32 */
33 #define LIBNXAGENT_EXPORTABLE
34 #endif
35
36
37 #include <nms_common.h>
38 #include <nms_util.h>
39 #include <nxconfig.h>
40 #include <nxdbapi.h>
41
42 /**
43 * Initialization function declaration macro
44 */
45 #if defined(_STATIC_AGENT) || defined(_NETWARE)
46 #define DECLARE_SUBAGENT_ENTRY_POINT(name) extern "C" BOOL NxSubAgentRegister_##name(NETXMS_SUBAGENT_INFO **ppInfo, Config *config)
47 #else
48 #ifdef _WIN32
49 #define DECLSPEC_EXPORT __declspec(dllexport) __cdecl
50 #else
51 #define DECLSPEC_EXPORT
52 #endif
53 #define DECLARE_SUBAGENT_ENTRY_POINT(name) extern "C" BOOL DECLSPEC_EXPORT NxSubAgentRegister(NETXMS_SUBAGENT_INFO **ppInfo, Config *config)
54 #endif
55
56 /**
57 * Constants
58 */
59 #define AGENT_LISTEN_PORT 4700
60 #define AGENT_TUNNEL_PORT 4703
61 #define AGENT_PROTOCOL_VERSION 2
62 #define MAX_RESULT_LENGTH 256
63 #define MAX_CMD_LEN 256
64 #define COMMAND_TIMEOUT 60
65 #define MAX_SUBAGENT_NAME 64
66 #define MAX_INSTANCE_COLUMNS 8
67
68 /**
69 * Agent policy types
70 */
71 #define AGENT_POLICY_CONFIG 1
72 #define AGENT_POLICY_LOG_PARSER 2
73
74 /**
75 * Agent log parser policy folder
76 */
77 #define LOGPARSER_AP_FOLDER _T("logparser_ap")
78 #define CONFIG_AP_FOLDER _T("config_ap")
79
80 /**
81 * Error codes
82 */
83 #define ERR_SUCCESS ((UINT32)0)
84 #define ERR_UNKNOWN_COMMAND ((UINT32)400)
85 #define ERR_AUTH_REQUIRED ((UINT32)401)
86 #define ERR_ACCESS_DENIED ((UINT32)403)
87 #define ERR_UNKNOWN_PARAMETER ((UINT32)404)
88 #define ERR_REQUEST_TIMEOUT ((UINT32)408)
89 #define ERR_AUTH_FAILED ((UINT32)440)
90 #define ERR_ALREADY_AUTHENTICATED ((UINT32)441)
91 #define ERR_AUTH_NOT_REQUIRED ((UINT32)442)
92 #define ERR_INTERNAL_ERROR ((UINT32)500)
93 #define ERR_NOT_IMPLEMENTED ((UINT32)501)
94 #define ERR_OUT_OF_RESOURCES ((UINT32)503)
95 #define ERR_NOT_CONNECTED ((UINT32)900)
96 #define ERR_CONNECTION_BROKEN ((UINT32)901)
97 #define ERR_BAD_RESPONSE ((UINT32)902)
98 #define ERR_IO_FAILURE ((UINT32)903)
99 #define ERR_RESOURCE_BUSY ((UINT32)904)
100 #define ERR_EXEC_FAILED ((UINT32)905)
101 #define ERR_ENCRYPTION_REQUIRED ((UINT32)906)
102 #define ERR_NO_CIPHERS ((UINT32)907)
103 #define ERR_INVALID_PUBLIC_KEY ((UINT32)908)
104 #define ERR_INVALID_SESSION_KEY ((UINT32)909)
105 #define ERR_CONNECT_FAILED ((UINT32)910)
106 #define ERR_MALFORMED_COMMAND ((UINT32)911)
107 #define ERR_SOCKET_ERROR ((UINT32)912)
108 #define ERR_BAD_ARGUMENTS ((UINT32)913)
109 #define ERR_SUBAGENT_LOAD_FAILED ((UINT32)914)
110 #define ERR_FILE_OPEN_ERROR ((UINT32)915)
111 #define ERR_FILE_STAT_FAILED ((UINT32)916)
112 #define ERR_MEM_ALLOC_FAILED ((UINT32)917)
113 #define ERR_FILE_DELETE_FAILED ((UINT32)918)
114 #define ERR_NO_SESSION_AGENT ((UINT32)919)
115 #define ERR_SERVER_ID_UNSET ((UINT32)920)
116 #define ERR_NO_SUCH_INSTANCE ((UINT32)921)
117
118 /**
119 * Bulk data reconciliation DCI processing status codes
120 */
121 #define BULK_DATA_REC_RETRY 0
122 #define BULK_DATA_REC_SUCCESS 1
123 #define BULK_DATA_REC_FAILURE 2
124
125 /**
126 * Max bulk data block size
127 */
128 #define MAX_BULK_DATA_BLOCK_SIZE 8192
129
130 /**
131 * Parameter handler return codes
132 */
133 #define SYSINFO_RC_SUCCESS 0
134 #define SYSINFO_RC_UNSUPPORTED 1
135 #define SYSINFO_RC_ERROR 2
136 #define SYSINFO_RC_NO_SUCH_INSTANCE 3
137
138 /**
139 * WinPerf features
140 */
141 #define WINPERF_AUTOMATIC_SAMPLE_COUNT ((UINT32)0x00000001)
142 #define WINPERF_REMOTE_COUNTER_CONFIG ((UINT32)0x00000002)
143
144 /**
145 * User session states (used by session agents)
146 */
147 #define USER_SESSION_ACTIVE 0
148 #define USER_SESSION_CONNECTED 1
149 #define USER_SESSION_DISCONNECTED 2
150 #define USER_SESSION_IDLE 3
151 #define USER_SESSION_OTHER 4
152
153 /**
154 * Descriptions for common parameters
155 */
156 #define DCIDESC_FS_AVAIL _T("Available space on file system {instance}")
157 #define DCIDESC_FS_AVAILPERC _T("Percentage of available space on file system {instance}")
158 #define DCIDESC_FS_FREE _T("Free space on file system {instance}")
159 #define DCIDESC_FS_FREEPERC _T("Percentage of free space on file system {instance}")
160 #define DCIDESC_FS_TOTAL _T("Total space on file system {instance}")
161 #define DCIDESC_FS_TYPE _T("Type of file system {instance}")
162 #define DCIDESC_FS_USED _T("Used space on file system {instance}")
163 #define DCIDESC_FS_USEDPERC _T("Percentage of used space on file system {instance}")
164 #define DCIDESC_LVM_LV_SIZE _T("Size of logical volume {instance}")
165 #define DCIDESC_LVM_LV_STATUS _T("Status of logical volume {instance}")
166 #define DCIDESC_LVM_PV_FREE _T("Free space on physical volume {instance}")
167 #define DCIDESC_LVM_PV_FREEPERC _T("Percentage of free space on physical volume {instance}")
168 #define DCIDESC_LVM_PV_RESYNC_PART _T("Number of resynchronizing partitions on physical volume {instance}")
169 #define DCIDESC_LVM_PV_STALE_PART _T("Number of stale partitions on physical volume {instance}")
170 #define DCIDESC_LVM_PV_STATUS _T("Status of physical volume {instance}")
171 #define DCIDESC_LVM_PV_TOTAL _T("Total size of physical volume {instance}")
172 #define DCIDESC_LVM_PV_USED _T("Used space on physical volume {instance}")
173 #define DCIDESC_LVM_PV_USEDPERC _T("Percentage of used space on physical volume {instance}")
174 #define DCIDESC_LVM_VG_FREE _T("Free space in volume group {instance}")
175 #define DCIDESC_LVM_VG_FREEPERC _T("Percentage of free space in volume group {instance}")
176 #define DCIDESC_LVM_VG_LVOL_TOTAL _T("Number of logical volumes in volume group {instance}")
177 #define DCIDESC_LVM_VG_PVOL_ACTIVE _T("Number of active physical volumes in volume group {instance}")
178 #define DCIDESC_LVM_VG_PVOL_TOTAL _T("Number of physical volumes in volume group {instance}")
179 #define DCIDESC_LVM_VG_RESYNC_PART _T("Number of resynchronizing partitions in volume group {instance}")
180 #define DCIDESC_LVM_VG_STALE_PART _T("Number of stale partitions in volume group {instance}")
181 #define DCIDESC_LVM_VG_STATUS _T("Status of volume group {instance}")
182 #define DCIDESC_LVM_VG_TOTAL _T("Total size of volume group {instance}")
183 #define DCIDESC_LVM_VG_USED _T("Used space in volume group {instance}")
184 #define DCIDESC_LVM_VG_USEDPERC _T("Percentage of used space in volume group {instance}")
185 #define DCIDESC_NET_INTERFACE_64BITCOUNTERS _T("Is 64bit interface counters supported")
186 #define DCIDESC_NET_INTERFACE_ADMINSTATUS _T("Administrative status of interface {instance}")
187 #define DCIDESC_NET_INTERFACE_BYTESIN _T("Number of input bytes on interface {instance}")
188 #define DCIDESC_NET_INTERFACE_BYTESOUT _T("Number of output bytes on interface {instance}")
189 #define DCIDESC_NET_INTERFACE_DESCRIPTION _T("Description of interface {instance}")
190 #define DCIDESC_NET_INTERFACE_INERRORS _T("Number of input errors on interface {instance}")
191 #define DCIDESC_NET_INTERFACE_LINK _T("Link status for interface {instance}")
192 #define DCIDESC_NET_INTERFACE_MTU _T("MTU for interface {instance}")
193 #define DCIDESC_NET_INTERFACE_OPERSTATUS _T("Operational status of interface {instance}")
194 #define DCIDESC_NET_INTERFACE_OUTERRORS _T("Number of output errors on interface {instance}")
195 #define DCIDESC_NET_INTERFACE_PACKETSIN _T("Number of input packets on interface {instance}")
196 #define DCIDESC_NET_INTERFACE_PACKETSOUT _T("Number of output packets on interface {instance}")
197 #define DCIDESC_NET_INTERFACE_SPEED _T("Speed of interface {instance}")
198 #define DCIDESC_NET_IP_FORWARDING _T("IP forwarding status")
199 #define DCIDESC_NET_IP6_FORWARDING _T("IPv6 forwarding status")
200 #define DCIDESC_NET_RESOLVER_ADDRBYNAME _T("Resolver: address for name {instance}")
201 #define DCIDESC_NET_RESOLVER_NAMEBYADDR _T("Resolver: name for address {instance}")
202 #define DCIDESC_PHYSICALDISK_FIRMWARE _T("Firmware version of hard disk {instance}")
203 #define DCIDESC_PHYSICALDISK_MODEL _T("Model of hard disk {instance}")
204 #define DCIDESC_PHYSICALDISK_SERIALNUMBER _T("Serial number of hard disk {instance}")
205 #define DCIDESC_PHYSICALDISK_SMARTATTR _T("")
206 #define DCIDESC_PHYSICALDISK_SMARTSTATUS _T("Status of hard disk {instance} reported by SMART")
207 #define DCIDESC_PHYSICALDISK_TEMPERATURE _T("Temperature of hard disk {instance}")
208 #define DCIDESC_SYSTEM_CPU_CACHE_SIZE _T("CPU {instance}: cache size (KB)")
209 #define DCIDESC_SYSTEM_CPU_CORE_ID _T("CPU {instance}: core ID")
210 #define DCIDESC_SYSTEM_CPU_COUNT _T("Number of CPU in the system")
211 #define DCIDESC_SYSTEM_CPU_FREQUENCY _T("CPU {instance}: frequency")
212 #define DCIDESC_SYSTEM_CPU_MODEL _T("CPU {instance}: model")
213 #define DCIDESC_SYSTEM_CPU_PHYSICAL_ID _T("CPU {instance}: physical ID")
214 #define DCIDESC_SYSTEM_HOSTNAME _T("Host name")
215 #define DCIDESC_SYSTEM_MEMORY_PHYSICAL_AVAILABLE _T("Available physical memory")
216 #define DCIDESC_SYSTEM_MEMORY_PHYSICAL_AVAILABLE_PCT _T("Percentage of available physical memory")
217 #define DCIDESC_SYSTEM_MEMORY_PHYSICAL_BUFFERS _T("Physical memory used for buffers")
218 #define DCIDESC_SYSTEM_MEMORY_PHYSICAL_BUFFERS_PCT _T("Percentage of physical memory used for buffers")
219 #define DCIDESC_SYSTEM_MEMORY_PHYSICAL_CACHED _T("Physical memory used for cache")
220 #define DCIDESC_SYSTEM_MEMORY_PHYSICAL_CACHED_PCT _T("Percentage of physical memory used for cache")
221 #define DCIDESC_SYSTEM_MEMORY_PHYSICAL_FREE _T("Free physical memory")
222 #define DCIDESC_SYSTEM_MEMORY_PHYSICAL_FREE_PCT _T("Percentage of free physical memory")
223 #define DCIDESC_SYSTEM_MEMORY_PHYSICAL_TOTAL _T("Total amount of physical memory")
224 #define DCIDESC_SYSTEM_MEMORY_PHYSICAL_USED _T("Used physical memory")
225 #define DCIDESC_SYSTEM_MEMORY_PHYSICAL_USED_PCT _T("Percentage of used physical memory")
226 #define DCIDESC_SYSTEM_MEMORY_VIRTUAL_ACTIVE _T("Active virtual memory")
227 #define DCIDESC_SYSTEM_MEMORY_VIRTUAL_ACTIVE_PCT _T("Percentage of active virtual memory")
228 #define DCIDESC_SYSTEM_MEMORY_VIRTUAL_FREE _T("Free virtual memory")
229 #define DCIDESC_SYSTEM_MEMORY_VIRTUAL_FREE_PCT _T("Percentage of free virtual memory")
230 #define DCIDESC_SYSTEM_MEMORY_VIRTUAL_TOTAL _T("Total amount of virtual memory")
231 #define DCIDESC_SYSTEM_MEMORY_VIRTUAL_USED _T("Used virtual memory")
232 #define DCIDESC_SYSTEM_MEMORY_VIRTUAL_USED_PCT _T("Percentage of used virtual memory")
233 #define DCIDESC_SYSTEM_MEMORY_VIRTUAL_AVAILABLE _T("Available virtual memory")
234 #define DCIDESC_SYSTEM_MEMORY_VIRTUAL_AVAILABLE_PCT _T("Percentage of available virtual memory")
235 #define DCIDESC_SYSTEM_MEMORY_SWAP_FREE _T("Free swap space")
236 #define DCIDESC_SYSTEM_MEMORY_SWAP_FREE_PCT _T("Percentage of free swap space")
237 #define DCIDESC_SYSTEM_MEMORY_SWAP_TOTAL _T("Total amount of swap space")
238 #define DCIDESC_SYSTEM_MEMORY_SWAP_USED _T("Used swap space")
239 #define DCIDESC_SYSTEM_MEMORY_SWAP_USED_PCT _T("Percentage of used swap space")
240 #define DCIDESC_SYSTEM_MSGQUEUE_BYTES _T("Message queue {instance}: bytes in queue")
241 #define DCIDESC_SYSTEM_MSGQUEUE_BYTES_MAX _T("Message queue {instance}: maximum allowed bytes in queue")
242 #define DCIDESC_SYSTEM_MSGQUEUE_CHANGE_TIME _T("Message queue {instance}: last change time")
243 #define DCIDESC_SYSTEM_MSGQUEUE_MESSAGES _T("Message queue {instance}: number of messages")
244 #define DCIDESC_SYSTEM_MSGQUEUE_RECV_TIME _T("Message queue {instance}: last receive time")
245 #define DCIDESC_SYSTEM_MSGQUEUE_SEND_TIME _T("Message queue {instance}: last send time")
246 #define DCIDESC_SYSTEM_UNAME _T("System uname")
247 #define DCIDESC_AGENT_ACCEPTEDCONNECTIONS _T("Number of connections accepted by agent")
248 #define DCIDESC_AGENT_ACCEPTERRORS _T("Number of accept() call errors")
249 #define DCIDESC_AGENT_ACTIVECONNECTIONS _T("Number of active connections to agent")
250 #define DCIDESC_AGENT_AUTHENTICATIONFAILURES _T("Number of authentication failures")
251 #define DCIDESC_AGENT_CONFIG_SERVER _T("Configuration server address set on agent startup")
252 #define DCIDESC_AGENT_DATACOLLQUEUESIZE _T("Agent data collector queue size")
253 #define DCIDESC_AGENT_FAILEDREQUESTS _T("Number of failed requests to agent")
254 #define DCIDESC_AGENT_GENERATED_TRAPS _T("Number of traps generated by agent")
255 #define DCIDESC_AGENT_IS_SUBAGENT_LOADED _T("Check if given subagent is loaded")
256 #define DCIDESC_AGENT_LAST_TRAP_TIME _T("Timestamp of last generated trap")
257 #define DCIDESC_AGENT_LOCALDB_FAILED_QUERIES _T("Agent local database: failed queries")
258 #define DCIDESC_AGENT_LOCALDB_SLOW_QUERIES _T("Agent local database: long running queries")
259 #define DCIDESC_AGENT_LOCALDB_STATUS _T("Agent local database: status")
260 #define DCIDESC_AGENT_LOCALDB_TOTAL_QUERIES _T("Agent local database: total queries executed")
261 #define DCIDESC_AGENT_LOG_STATUS _T("Agent log status")
262 #define DCIDESC_AGENT_PROCESSEDREQUESTS _T("Number of requests processed by agent")
263 #define DCIDESC_AGENT_PROXY_ACTIVESESSIONS _T("Number of active proxy sessions")
264 #define DCIDESC_AGENT_PROXY_CONNECTIONREQUESTS _T("Number of proxy connection requests")
265 #define DCIDESC_AGENT_PROXY_ISENABLED _T("Check if agent proxy is enabled")
266 #define DCIDESC_AGENT_REGISTRAR _T("Registrar server address set on agent startup")
267 #define DCIDESC_AGENT_REJECTEDCONNECTIONS _T("Number of connections rejected by agent")
268 #define DCIDESC_AGENT_SENT_TRAPS _T("Number of traps successfully sent to server")
269 #define DCIDESC_AGENT_SNMP_ISPROXYENABLED _T("Check if SNMP proxy is enabled")
270 #define DCIDESC_AGENT_SNMP_REQUESTS _T("Number of SNMP requests sent")
271 #define DCIDESC_AGENT_SNMP_RESPONSES _T("Number of SNMP responses received")
272 #define DCIDESC_AGENT_SNMP_SERVERREQUESTS _T("Number of SNMP proxy requests received from server")
273 #define DCIDESC_AGENT_SOURCEPACKAGESUPPORT _T("Check if source packages are supported")
274 #define DCIDESC_AGENT_SUPPORTEDCIPHERS _T("List of ciphers supported by agent")
275 #define DCIDESC_AGENT_SYSLOGPROXY_ISENABLED _T("Check if syslog proxy is enabled")
276 #define DCIDESC_AGENT_SYSLOGPROXY_RECEIVEDMSGS _T("Number of syslog messages received by agent")
277 #define DCIDESC_AGENT_SYSLOGPROXY_QUEUESIZE _T("Agent syslog proxy queue size")
278 #define DCIDESC_AGENT_THREADPOOL_ACTIVEREQUESTS _T("Agent thread pool {instance}: active requests")
279 #define DCIDESC_AGENT_THREADPOOL_CURRSIZE _T("Agent thread pool {instance}: current size")
280 #define DCIDESC_AGENT_THREADPOOL_LOAD _T("Agent thread pool {instance}: current load")
281 #define DCIDESC_AGENT_THREADPOOL_LOADAVG _T("Agent thread pool {instance}: load average (1 minute)")
282 #define DCIDESC_AGENT_THREADPOOL_LOADAVG_5 _T("Agent thread pool {instance}: load average (5 minutes)")
283 #define DCIDESC_AGENT_THREADPOOL_LOADAVG_15 _T("Agent thread pool {instance}: load average (15 minutes)")
284 #define DCIDESC_AGENT_THREADPOOL_MAXSIZE _T("Agent thread pool {instance}: max size")
285 #define DCIDESC_AGENT_THREADPOOL_MINSIZE _T("Agent thread pool {instance}: min size")
286 #define DCIDESC_AGENT_THREADPOOL_USAGE _T("Agent thread pool {instance}: usage")
287 #define DCIDESC_AGENT_TIMEDOUTREQUESTS _T("Number of timed out requests to agent")
288 #define DCIDESC_AGENT_UNSUPPORTEDREQUESTS _T("Number of requests for unsupported parameters")
289 #define DCIDESC_AGENT_UPTIME _T("Agent's uptime")
290 #define DCIDESC_AGENT_VERSION _T("Agent's version")
291 #define DCIDESC_FILE_COUNT _T("Number of files {instance}")
292 #define DCIDESC_FILE_FOLDERCOUNT _T("Number of folders {instance}")
293 #define DCIDESC_FILE_HASH_CRC32 _T("CRC32 checksum of {instance}")
294 #define DCIDESC_FILE_HASH_MD5 _T("MD5 hash of {instance}")
295 #define DCIDESC_FILE_HASH_SHA1 _T("SHA1 hash of {instance}")
296 #define DCIDESC_FILE_SIZE _T("Size of file {instance}")
297 #define DCIDESC_FILE_TIME_ACCESS _T("Time of last access to file {instance}")
298 #define DCIDESC_FILE_TIME_CHANGE _T("Time of last status change of file {instance}")
299 #define DCIDESC_FILE_TIME_MODIFY _T("Time of last modification of file {instance}")
300 #define DCIDESC_SYSTEM_CURRENTTIME _T("Current system time")
301 #define DCIDESC_SYSTEM_PLATFORMNAME _T("Platform name")
302 #define DCIDESC_PROCESS_COUNT _T("Number of {instance} processes")
303 #define DCIDESC_PROCESS_COUNTEX _T("Number of {instance} processes (extended)")
304 #define DCIDESC_PROCESS_CPUTIME _T("Total execution time for process {instance}")
305 #define DCIDESC_PROCESS_GDIOBJ _T("GDI objects used by process {instance}")
306 #define DCIDESC_PROCESS_HANDLES _T("Number of handles in process {instance}")
307 #define DCIDESC_PROCESS_IO_OTHERB _T("")
308 #define DCIDESC_PROCESS_IO_OTHEROP _T("")
309 #define DCIDESC_PROCESS_IO_READB _T("")
310 #define DCIDESC_PROCESS_IO_READOP _T("")
311 #define DCIDESC_PROCESS_IO_WRITEB _T("")
312 #define DCIDESC_PROCESS_IO_WRITEOP _T("")
313 #define DCIDESC_PROCESS_KERNELTIME _T("Total execution time in kernel mode for process {instance}")
314 #define DCIDESC_PROCESS_PAGEFAULTS _T("Page faults for process {instance}")
315 #define DCIDESC_PROCESS_SYSCALLS _T("Number of system calls made by process {instance}")
316 #define DCIDESC_PROCESS_THREADS _T("Number of threads in process {instance}")
317 #define DCIDESC_PROCESS_USEROBJ _T("USER objects used by process {instance}")
318 #define DCIDESC_PROCESS_USERTIME _T("Total execution time in user mode for process {instance}")
319 #define DCIDESC_PROCESS_VMSIZE _T("Virtual memory used by process {instance}")
320 #define DCIDESC_PROCESS_WKSET _T("Physical memory used by process {instance}")
321 #define DCIDESC_PROCESS_ZOMBIE_COUNT _T("Number of {instance} zombie processes")
322 #define DCIDESC_SYSTEM_APPADDRESSSPACE _T("Address space available to applications (MB)")
323 #define DCIDESC_SYSTEM_CONNECTEDUSERS _T("Number of logged in users")
324 #define DCIDESC_SYSTEM_HANDLECOUNT _T("Total number of handles")
325 #define DCIDESC_SYSTEM_PROCESSCOUNT _T("Total number of processes")
326 #define DCIDESC_SYSTEM_SERVICESTATE _T("State of {instance} service")
327 #define DCIDESC_SYSTEM_THREADCOUNT _T("Total number of threads")
328 #define DCIDESC_PDH_COUNTERVALUE _T("Value of PDH counter {instance}")
329 #define DCIDESC_PDH_VERSION _T("Version of PDH.DLL")
330 #define DCIDESC_SYSTEM_UPTIME _T("System uptime")
331 #define DCIDESC_SYSTEM_CPU_LOADAVG _T("Average CPU load for last minute")
332 #define DCIDESC_SYSTEM_CPU_LOADAVG5 _T("Average CPU load for last 5 minutes")
333 #define DCIDESC_SYSTEM_CPU_LOADAVG15 _T("Average CPU load for last 15 minutes")
334
335
336 #define DCIDESC_SYSTEM_CPU_USAGE_EX _T("Average CPU {instance} utilization for last minute")
337 #define DCIDESC_SYSTEM_CPU_USAGE5_EX _T("Average CPU {instance} utilization for last 5 minutes")
338 #define DCIDESC_SYSTEM_CPU_USAGE15_EX _T("Average CPU {instance} utilization for last 15 minutes")
339 #define DCIDESC_SYSTEM_CPU_USAGECURR_EX _T("Current CPU {instance} utilization")
340 #define DCIDESC_SYSTEM_CPU_USAGE _T("Average CPU utilization for last minute")
341 #define DCIDESC_SYSTEM_CPU_USAGE5 _T("Average CPU utilization for last 5 minutes")
342 #define DCIDESC_SYSTEM_CPU_USAGE15 _T("Average CPU utilization for last 15 minutes")
343 #define DCIDESC_SYSTEM_CPU_USAGECURR _T("Current CPU utilization")
344
345 #define DCIDESC_SYSTEM_CPU_USAGE_USER_EX _T("Average CPU {instance} utilization (user) for last minute")
346 #define DCIDESC_SYSTEM_CPU_USAGE5_USER_EX _T("Average CPU {instance} utilization (user) for last 5 minutes")
347 #define DCIDESC_SYSTEM_CPU_USAGE15_USER_EX _T("Average CPU {instance} utilization (user) for last 15 minutes")
348 #define DCIDESC_SYSTEM_CPU_USAGE_USER _T("Average CPU utilization (user) for last minute")
349 #define DCIDESC_SYSTEM_CPU_USAGE5_USER _T("Average CPU utilization (user) for last 5 minutes")
350 #define DCIDESC_SYSTEM_CPU_USAGE15_USER _T("Average CPU utilization (user) for last 15 minutes")
351
352 #define DCIDESC_SYSTEM_CPU_USAGE_NICE_EX _T("Average CPU {instance} utilization (nice) for last minute")
353 #define DCIDESC_SYSTEM_CPU_USAGE5_NICE_EX _T("Average CPU {instance} utilization (nice) for last 5 minutes")
354 #define DCIDESC_SYSTEM_CPU_USAGE15_NICE_EX _T("Average CPU {instance} utilization (nice) for last 15 minutes")
355 #define DCIDESC_SYSTEM_CPU_USAGE_NICE _T("Average CPU utilization (nice) for last minute")
356 #define DCIDESC_SYSTEM_CPU_USAGE5_NICE _T("Average CPU utilization (nice) for last 5 minutes")
357 #define DCIDESC_SYSTEM_CPU_USAGE15_NICE _T("Average CPU utilization (nice) for last 15 minutes")
358
359 #define DCIDESC_SYSTEM_CPU_USAGE_SYSTEM_EX _T("Average CPU {instance} utilization (system) for last minute")
360 #define DCIDESC_SYSTEM_CPU_USAGE5_SYSTEM_EX _T("Average CPU {instance} utilization (system) for last 5 minutes")
361 #define DCIDESC_SYSTEM_CPU_USAGE15_SYSTEM_EX _T("Average CPU {instance} utilization (system) for last 15 minutes")
362 #define DCIDESC_SYSTEM_CPU_USAGE_SYSTEM _T("Average CPU utilization (system) for last minute")
363 #define DCIDESC_SYSTEM_CPU_USAGE5_SYSTEM _T("Average CPU utilization (system) for last 5 minutes")
364 #define DCIDESC_SYSTEM_CPU_USAGE15_SYSTEM _T("Average CPU utilization (system) for last 15 minutes")
365
366 #define DCIDESC_SYSTEM_CPU_USAGE_IDLE_EX _T("Average CPU {instance} utilization (idle) for last minute")
367 #define DCIDESC_SYSTEM_CPU_USAGE5_IDLE_EX _T("Average CPU {instance} utilization (idle) for last 5 minutes")
368 #define DCIDESC_SYSTEM_CPU_USAGE15_IDLE_EX _T("Average CPU {instance} utilization (idle) for last 15 minutes")
369 #define DCIDESC_SYSTEM_CPU_USAGE_IDLE _T("Average CPU utilization (idle) for last minute")
370 #define DCIDESC_SYSTEM_CPU_USAGE5_IDLE _T("Average CPU utilization (idle) for last 5 minutes")
371 #define DCIDESC_SYSTEM_CPU_USAGE15_IDLE _T("Average CPU utilization (idle) for last 15 minutes")
372
373 #define DCIDESC_SYSTEM_CPU_USAGE_IOWAIT_EX _T("Average CPU {instance} utilization (iowait) for last minute")
374 #define DCIDESC_SYSTEM_CPU_USAGE5_IOWAIT_EX _T("Average CPU {instance} utilization (iowait) for last 5 minutes")
375 #define DCIDESC_SYSTEM_CPU_USAGE15_IOWAIT_EX _T("Average CPU {instance} utilization (iowait) for last 15 minutes")
376 #define DCIDESC_SYSTEM_CPU_USAGE_IOWAIT _T("Average CPU utilization (iowait) for last minute")
377 #define DCIDESC_SYSTEM_CPU_USAGE5_IOWAIT _T("Average CPU utilization (iowait) for last 5 minutes")
378 #define DCIDESC_SYSTEM_CPU_USAGE15_IOWAIT _T("Average CPU utilization (iowait) for last 15 minutes")
379
380 #define DCIDESC_SYSTEM_CPU_USAGE_IRQ_EX _T("Average CPU {instance} utilization (irq) for last minute")
381 #define DCIDESC_SYSTEM_CPU_USAGE5_IRQ_EX _T("Average CPU {instance} utilization (irq) for last 5 minutes")
382 #define DCIDESC_SYSTEM_CPU_USAGE15_IRQ_EX _T("Average CPU {instance} utilization (irq) for last 15 minutes")
383 #define DCIDESC_SYSTEM_CPU_USAGE_IRQ _T("Average CPU utilization (irq) for last minute")
384 #define DCIDESC_SYSTEM_CPU_USAGE5_IRQ _T("Average CPU utilization (irq) for last 5 minutes")
385 #define DCIDESC_SYSTEM_CPU_USAGE15_IRQ _T("Average CPU utilization (irq) for last 15 minutes")
386
387 #define DCIDESC_SYSTEM_CPU_USAGE_SOFTIRQ_EX _T("Average CPU {instance} utilization (softirq) for last minute")
388 #define DCIDESC_SYSTEM_CPU_USAGE5_SOFTIRQ_EX _T("Average CPU {instance} utilization (softirq) for last 5 minutes")
389 #define DCIDESC_SYSTEM_CPU_USAGE15_SOFTIRQ_EX _T("Average CPU {instance} utilization (softirq) for last 15 minutes")
390 #define DCIDESC_SYSTEM_CPU_USAGE_SOFTIRQ _T("Average CPU utilization (softirq) for last minute")
391 #define DCIDESC_SYSTEM_CPU_USAGE5_SOFTIRQ _T("Average CPU utilization (softirq) for last 5 minutes")
392 #define DCIDESC_SYSTEM_CPU_USAGE15_SOFTIRQ _T("Average CPU utilization (softirq) for last 15 minutes")
393
394 #define DCIDESC_SYSTEM_CPU_USAGE_STEAL_EX _T("Average CPU {instance} utilization (steal) for last minute")
395 #define DCIDESC_SYSTEM_CPU_USAGE5_STEAL_EX _T("Average CPU {instance} utilization (steal) for last 5 minutes")
396 #define DCIDESC_SYSTEM_CPU_USAGE15_STEAL_EX _T("Average CPU {instance} utilization (steal) for last 15 minutes")
397 #define DCIDESC_SYSTEM_CPU_USAGE_STEAL _T("Average CPU utilization (steal) for last minute")
398 #define DCIDESC_SYSTEM_CPU_USAGE5_STEAL _T("Average CPU utilization (steal) for last 5 minutes")
399 #define DCIDESC_SYSTEM_CPU_USAGE15_STEAL _T("Average CPU utilization (steal) for last 15 minutes")
400
401 #define DCIDESC_SYSTEM_CPU_USAGE_GUEST_EX _T("Average CPU {instance} utilization (guest) for last minute")
402 #define DCIDESC_SYSTEM_CPU_USAGE5_GUEST_EX _T("Average CPU {instance} utilization (guest) for last 5 minutes")
403 #define DCIDESC_SYSTEM_CPU_USAGE15_GUEST_EX _T("Average CPU {instance} utilization (guest) for last 15 minutes")
404 #define DCIDESC_SYSTEM_CPU_USAGE_GUEST _T("Average CPU utilization (guest) for last minute")
405 #define DCIDESC_SYSTEM_CPU_USAGE5_GUEST _T("Average CPU utilization (guest) for last 5 minutes")
406 #define DCIDESC_SYSTEM_CPU_USAGE15_GUEST _T("Average CPU utilization (guest) for last 15 minutes")
407
408 #define DCIDESC_SYSTEM_IO_DISKQUEUE _T("Average disk queue length for last minute")
409 #define DCIDESC_SYSTEM_IO_DISKQUEUE_MIN _T("Minimum disk queue length for last minute")
410 #define DCIDESC_SYSTEM_IO_DISKQUEUE_MAX _T("Maximum disk queue length for last minute")
411 #define DCIDESC_SYSTEM_IO_DISKQUEUE_EX _T("Average disk queue length of device {instance} for last minute")
412 #define DCIDESC_SYSTEM_IO_DISKQUEUE_EX_MIN _T("Minimum disk queue length of device {instance} for last minute")
413 #define DCIDESC_SYSTEM_IO_DISKQUEUE_EX_MAX _T("Maximum disk queue length of device {instance} for last minute")
414 #define DCIDESC_SYSTEM_IO_DISKTIME _T("Percent of CPU time spent on I/O for last minute")
415 #define DCIDESC_SYSTEM_IO_DISKTIME_EX _T("Percent of CPU time spent on I/O on device {instance} for last minute")
416 #define DCIDESC_SYSTEM_IO_WAITTIME _T("Average I/O request wait time")
417 #define DCIDESC_SYSTEM_IO_WAITTIME_EX _T("Average I/O request wait time for device {instance}")
418 #define DCIDESC_SYSTEM_IO_READS _T("Average number of read operations for last minute")
419 #define DCIDESC_SYSTEM_IO_READS_MIN _T("Minimum number of read operations for last minute")
420 #define DCIDESC_SYSTEM_IO_READS_MAX _T("Maximum number of read operations for last minute")
421 #define DCIDESC_SYSTEM_IO_READS_EX _T("Average number of read operations on device {instance} for last minute")
422 #define DCIDESC_SYSTEM_IO_READS_EX_MIN _T("Minimum number of read operations on device {instance} for last minute")
423 #define DCIDESC_SYSTEM_IO_READS_EX_MAX _T("Maximum number of read operations on device {instance} for last minute")
424 #define DCIDESC_SYSTEM_IO_WRITES _T("Average number of write operations for last minute")
425 #define DCIDESC_SYSTEM_IO_WRITES_MIN _T("Minimum number of write operations for last minute")
426 #define DCIDESC_SYSTEM_IO_WRITES_MAX _T("Maximum number of write operations for last minute")
427 #define DCIDESC_SYSTEM_IO_WRITES_EX _T("Average number of write operations on device {instance} for last minute")
428 #define DCIDESC_SYSTEM_IO_WRITES_EX_MIN _T("Minimum number of write operations on device {instance} for last minute")
429 #define DCIDESC_SYSTEM_IO_WRITES_EX_MAX _T("Maximum number of write operations on device {instance} for last minute")
430 #define DCIDESC_SYSTEM_IO_XFERS _T("Average number of I/O transfers for last minute")
431 #define DCIDESC_SYSTEM_IO_XFERS_MIN _T("Minimum number of I/O transfers for last minute")
432 #define DCIDESC_SYSTEM_IO_XFERS_MAX _T("Maximum number of I/O transfers for last minute")
433 #define DCIDESC_SYSTEM_IO_XFERS_EX _T("Average number of I/O transfers on device {instance} for last minute")
434 #define DCIDESC_SYSTEM_IO_XFERS_EX_MIN _T("Minimum number of I/O transfers on device {instance} for last minute")
435 #define DCIDESC_SYSTEM_IO_XFERS_EX_MAX _T("Maximum number of I/O transfers on device {instance} for last minute")
436 #define DCIDESC_SYSTEM_IO_BYTEREADS _T("Average number of bytes read for last minute")
437 #define DCIDESC_SYSTEM_IO_BYTEREADS_MIN _T("Minimum number of bytes read for last minute")
438 #define DCIDESC_SYSTEM_IO_BYTEREADS_MAX _T("Maximum number of bytes read for last minute")
439 #define DCIDESC_SYSTEM_IO_BYTEREADS_EX _T("Average number of bytes read on device {instance} for last minute")
440 #define DCIDESC_SYSTEM_IO_BYTEREADS_EX_MIN _T("Minimum number of bytes read on device {instance} for last minute")
441 #define DCIDESC_SYSTEM_IO_BYTEREADS_EX_MAX _T("Maximum number of bytes read on device {instance} for last minute")
442 #define DCIDESC_SYSTEM_IO_BYTEWRITES _T("Average number of bytes written for last minute")
443 #define DCIDESC_SYSTEM_IO_BYTEWRITES_MIN _T("Minimum number of bytes written for last minute")
444 #define DCIDESC_SYSTEM_IO_BYTEWRITES_MAX _T("Maximum number of bytes written for last minute")
445 #define DCIDESC_SYSTEM_IO_BYTEWRITES_EX _T("Average number of bytes written on device {instance} for last minute")
446 #define DCIDESC_SYSTEM_IO_BYTEWRITES_EX_MIN _T("Minimum number of bytes written on device {instance} for last minute")
447 #define DCIDESC_SYSTEM_IO_BYTEWRITES_EX_MAX _T("Maximum number of bytes written on device {instance} for last minute")
448 #define DCIDESC_SYSTEM_IO_OPENFILES _T("Number of open files")
449
450
451 #define DCIDESC_DEPRECATED _T("<deprecated>")
452
453
454 #define DCTDESC_AGENT_SESSION_AGENTS _T("Registered session agents")
455 #define DCTDESC_AGENT_SUBAGENTS _T("Loaded subagents")
456 #define DCTDESC_FILESYSTEM_VOLUMES _T("File system volumes")
457 #define DCTDESC_LVM_VOLUME_GROUPS _T("LVM volume groups")
458 #define DCTDESC_LVM_LOGICAL_VOLUMES _T("Logical volumes in volume group {instance}")
459 #define DCTDESC_LVM_PHYSICAL_VOLUMES _T("Physical volumes in volume group {instance}")
460 #define DCTDESC_SYSTEM_INSTALLED_PRODUCTS _T("Installed products")
461 #define DCTDESC_SYSTEM_OPEN_FILES _T("Open files")
462 #define DCTDESC_SYSTEM_PROCESSES _T("Processes")
463
464 /**
465 * API for CommSession
466 */
467 class AbstractCommSession : public RefCountObject
468 {
469 public:
470 virtual bool isMasterServer() = 0;
471 virtual bool isControlServer() = 0;
472 virtual bool canAcceptData() = 0;
473 virtual bool canAcceptTraps() = 0;
474 virtual bool canAcceptFileUpdates() = 0;
475 virtual UINT64 getServerId() = 0;
476 virtual const InetAddress& getServerAddress() = 0;
477
478 virtual bool isIPv6Aware() = 0;
479
480 virtual void sendMessage(NXCPMessage *msg) = 0;
481 virtual void sendRawMessage(NXCP_MESSAGE *msg) = 0;
482 virtual bool sendFile(UINT32 requestId, const TCHAR *file, long offset) = 0;
483 virtual UINT32 doRequest(NXCPMessage *msg, UINT32 timeout) = 0;
484 virtual NXCPMessage *doRequestEx(NXCPMessage *msg, UINT32 timeout) = 0;
485 virtual UINT32 generateRequestId() = 0;
486 virtual UINT32 openFile(TCHAR* nameOfFile, UINT32 requestId) = 0;
487 };
488
489 /**
490 * Subagent's parameter information
491 */
492 typedef struct
493 {
494 TCHAR name[MAX_PARAM_NAME];
495 LONG (* handler)(const TCHAR *, const TCHAR *, TCHAR *, AbstractCommSession *);
496 const TCHAR *arg;
497 int dataType; // Use DT_DEPRECATED to indicate deprecated parameter
498 TCHAR description[MAX_DB_STRING];
499 } NETXMS_SUBAGENT_PARAM;
500
501 /**
502 * Subagent's push parameter information
503 */
504 typedef struct
505 {
506 TCHAR name[MAX_PARAM_NAME];
507 int dataType;
508 TCHAR description[MAX_DB_STRING];
509 } NETXMS_SUBAGENT_PUSHPARAM;
510
511 /**
512 * Subagent's list information
513 */
514 typedef struct
515 {
516 TCHAR name[MAX_PARAM_NAME];
517 LONG (* handler)(const TCHAR *, const TCHAR *, StringList *, AbstractCommSession *);
518 const TCHAR *arg;
519 TCHAR description[MAX_DB_STRING];
520 } NETXMS_SUBAGENT_LIST;
521
522 /**
523 * Subagent's table column information
524 */
525 typedef struct
526 {
527 TCHAR name[MAX_COLUMN_NAME];
528 TCHAR displayName[MAX_COLUMN_NAME];
529 int dataType;
530 bool isInstance;
531 } NETXMS_SUBAGENT_TABLE_COLUMN;
532
533 /**
534 * Subagent's table information
535 */
536 typedef struct
537 {
538 TCHAR name[MAX_PARAM_NAME];
539 LONG (* handler)(const TCHAR *, const TCHAR *, Table *, AbstractCommSession *);
540 const TCHAR *arg;
541 TCHAR instanceColumns[MAX_COLUMN_NAME * MAX_INSTANCE_COLUMNS];
542 TCHAR description[MAX_DB_STRING];
543 int numColumns;
544 NETXMS_SUBAGENT_TABLE_COLUMN *columns;
545 } NETXMS_SUBAGENT_TABLE;
546
547 /**
548 * Subagent's action information
549 */
550 typedef struct
551 {
552 TCHAR name[MAX_PARAM_NAME];
553 LONG (* handler)(const TCHAR *, StringList *, const TCHAR *, AbstractCommSession *);
554 const TCHAR *arg;
555 TCHAR description[MAX_DB_STRING];
556 } NETXMS_SUBAGENT_ACTION;
557
558 #define NETXMS_SUBAGENT_INFO_MAGIC ((UINT32)0x20150626)
559
560 class NXCPMessage;
561
562 /**
563 * Subagent initialization structure
564 */
565 typedef struct
566 {
567 UINT32 magic; // Magic number to check if subagent uses correct version of this structure
568 TCHAR name[MAX_SUBAGENT_NAME];
569 TCHAR version[32];
570 BOOL (* init)(Config *); // Called to initialize subagent. Can be NULL.
571 void (* shutdown)(); // Called at subagent unload. Can be NULL.
572 BOOL (* commandHandler)(UINT32 command, NXCPMessage *request, NXCPMessage *response, AbstractCommSession *session);
573 UINT32 numParameters;
574 NETXMS_SUBAGENT_PARAM *parameters;
575 UINT32 numLists;
576 NETXMS_SUBAGENT_LIST *lists;
577 UINT32 numTables;
578 NETXMS_SUBAGENT_TABLE *tables;
579 UINT32 numActions;
580 NETXMS_SUBAGENT_ACTION *actions;
581 UINT32 numPushParameters;
582 NETXMS_SUBAGENT_PUSHPARAM *pushParameters;
583 } NETXMS_SUBAGENT_INFO;
584
585 /**
586 * Inline functions for returning parameters
587 */
588 inline void ret_string(TCHAR *rbuf, const TCHAR *value)
589 {
590 nx_strncpy(rbuf, value, MAX_RESULT_LENGTH);
591 }
592
593 inline void ret_wstring(TCHAR *rbuf, const WCHAR *value)
594 {
595 #ifdef UNICODE
596 nx_strncpy(rbuf, value, MAX_RESULT_LENGTH);
597 #else
598 WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK | WC_DEFAULTCHAR, value, -1, rbuf, MAX_RESULT_LENGTH, NULL, NULL);
599 rbuf[MAX_RESULT_LENGTH - 1] = 0;
600 #endif
601 }
602
603 inline void ret_mbstring(TCHAR *rbuf, const char *value)
604 {
605 #ifdef UNICODE
606 MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, value, -1, rbuf, MAX_RESULT_LENGTH);
607 rbuf[MAX_RESULT_LENGTH - 1] = 0;
608 #else
609 nx_strncpy(rbuf, value, MAX_RESULT_LENGTH);
610 #endif
611 }
612
613 inline void ret_int(TCHAR *rbuf, LONG value)
614 {
615 #if defined(_WIN32) && (_MSC_VER >= 1300)
616 _sntprintf_s(rbuf, MAX_RESULT_LENGTH, _TRUNCATE, _T("%ld"), (long)value);
617 #else
618 _sntprintf(rbuf, MAX_RESULT_LENGTH, _T("%ld"), (long)value);
619 #endif
620 }
621
622 inline void ret_uint(TCHAR *rbuf, UINT32 value)
623 {
624 #if defined(_WIN32) && (_MSC_VER >= 1300)
625 _sntprintf_s(rbuf, MAX_RESULT_LENGTH, _TRUNCATE, _T("%lu"), (unsigned long)value);
626 #else
627 _sntprintf(rbuf, MAX_RESULT_LENGTH, _T("%lu"), (unsigned long)value);
628 #endif
629 }
630
631 inline void ret_double(TCHAR *rbuf, double value, int digits = 6)
632 {
633 #if defined(_WIN32) && (_MSC_VER >= 1300)
634 _sntprintf_s(rbuf, MAX_RESULT_LENGTH, _TRUNCATE, _T("%1.*f"), digits, value);
635 #else
636 _sntprintf(rbuf, MAX_RESULT_LENGTH, _T("%1.*f"), digits, value);
637 #endif
638 }
639
640 inline void ret_int64(TCHAR *rbuf, INT64 value)
641 {
642 #if defined(_WIN32) && (_MSC_VER >= 1300)
643 _sntprintf_s(rbuf, MAX_RESULT_LENGTH, _TRUNCATE, _T("%I64d"), value);
644 #else /* _WIN32 */
645 _sntprintf(rbuf, MAX_RESULT_LENGTH, INT64_FMT, value);
646 #endif /* _WIN32 */
647 }
648
649 inline void ret_uint64(TCHAR *rbuf, QWORD value)
650 {
651 #if defined(_WIN32) && (_MSC_VER >= 1300)
652 _sntprintf_s(rbuf, MAX_RESULT_LENGTH, _TRUNCATE, _T("%I64u"), value);
653 #else /* _WIN32 */
654 _sntprintf(rbuf, MAX_RESULT_LENGTH, UINT64_FMT, value);
655 #endif /* _WIN32 */
656 }
657
658 /**
659 * API for subagents
660 */
661 bool LIBNXAGENT_EXPORTABLE AgentGetParameterArgA(const TCHAR *param, int index, char *arg, int maxSize, bool inBrackets = true);
662 bool LIBNXAGENT_EXPORTABLE AgentGetParameterArgW(const TCHAR *param, int index, WCHAR *arg, int maxSize, bool inBrackets = true);
663 #ifdef UNICODE
664 #define AgentGetParameterArg AgentGetParameterArgW
665 #else
666 #define AgentGetParameterArg AgentGetParameterArgA
667 #endif
668
669 void LIBNXAGENT_EXPORTABLE AgentWriteLog(int logLevel, const TCHAR *format, ...)
670 #if !defined(UNICODE) && (defined(__GNUC__) || defined(__clang__))
671 __attribute__ ((format(printf, 2, 3)))
672 #endif
673 ;
674 void LIBNXAGENT_EXPORTABLE AgentWriteLog2(int logLevel, const TCHAR *format, va_list args);
675 void LIBNXAGENT_EXPORTABLE AgentWriteDebugLog(int level, const TCHAR *format, ...)
676 #if !defined(UNICODE) && (defined(__GNUC__) || defined(__clang__))
677 __attribute__ ((format(printf, 2, 3)))
678 #endif
679 ;
680 void LIBNXAGENT_EXPORTABLE AgentWriteDebugLog2(int level, const TCHAR *format, va_list args);
681
682 void LIBNXAGENT_EXPORTABLE AgentSendTrap(UINT32 dwEvent, const TCHAR *eventName, const char *pszFormat, ...);
683 void LIBNXAGENT_EXPORTABLE AgentSendTrap2(UINT32 dwEvent, const TCHAR *eventName, int nCount, TCHAR **ppszArgList);
684
685 bool LIBNXAGENT_EXPORTABLE AgentEnumerateSessions(EnumerationCallbackResult (* callback)(AbstractCommSession *, void *), void *data);
686 AbstractCommSession LIBNXAGENT_EXPORTABLE *AgentFindServerSession(UINT64 serverId);
687
688 bool LIBNXAGENT_EXPORTABLE AgentSendFileToServer(void *session, UINT32 requestId, const TCHAR *file, long offset);
689
690 bool LIBNXAGENT_EXPORTABLE AgentPushParameterData(const TCHAR *parameter, const TCHAR *value);
691 bool LIBNXAGENT_EXPORTABLE AgentPushParameterDataInt32(const TCHAR *parameter, LONG value);
692 bool LIBNXAGENT_EXPORTABLE AgentPushParameterDataUInt32(const TCHAR *parameter, UINT32 value);
693 bool LIBNXAGENT_EXPORTABLE AgentPushParameterDataInt64(const TCHAR *parameter, INT64 value);
694 bool LIBNXAGENT_EXPORTABLE AgentPushParameterDataUInt64(const TCHAR *parameter, QWORD value);
695 bool LIBNXAGENT_EXPORTABLE AgentPushParameterDataDouble(const TCHAR *parameter, double value);
696
697 CONDITION LIBNXAGENT_EXPORTABLE AgentGetShutdownCondition();
698 bool LIBNXAGENT_EXPORTABLE AgentSleepAndCheckForShutdown(UINT32 sleepTime);
699 const TCHAR LIBNXAGENT_EXPORTABLE *AgentGetDataDirectory();
700
701 DB_HANDLE LIBNXAGENT_EXPORTABLE AgentGetLocalDatabaseHandle();
702
703 TCHAR LIBNXAGENT_EXPORTABLE *ReadRegistryAsString(const TCHAR *attr, TCHAR *buffer = NULL, int bufSize = 0, const TCHAR *defaultValue = NULL);
704 INT32 LIBNXAGENT_EXPORTABLE ReadRegistryAsInt32(const TCHAR *attr, INT32 defaultValue);
705 INT64 LIBNXAGENT_EXPORTABLE ReadRegistryAsInt64(const TCHAR *attr, INT64 defaultValue);
706 bool LIBNXAGENT_EXPORTABLE WriteRegistry(const TCHAR *attr, const TCHAR *value);
707 bool LIBNXAGENT_EXPORTABLE WriteRegistry(const TCHAR *attr, INT32 value);
708 bool LIBNXAGENT_EXPORTABLE WriteRegistry(const TCHAR *attr, INT64 value);
709 bool LIBNXAGENT_EXPORTABLE DeleteRegistryEntry(const TCHAR *attr);
710
711 #endif /* _nms_agent_h_ */