minor changes
[public/netxms.git] / include / nms_agent.h
CommitLineData
cbcaf8c8 1/*
7ac71e60 2** NetXMS - Network Management System
c303351c 3** Copyright (C) 2003-2010 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
VK
29
30
b5138dfb
VK
31//
32// Initialization function declaration macro
33//
34
a0a945fb 35#if defined(_STATIC_AGENT) || defined(_NETWARE)
e6c91aac 36#define DECLARE_SUBAGENT_ENTRY_POINT(name) extern "C" BOOL NxSubAgentRegister_##name(NETXMS_SUBAGENT_INFO **ppInfo, Config *config)
a0a945fb 37#else
b5138dfb 38#ifdef _WIN32
a0a945fb 39#define DECLSPEC_EXPORT __declspec(dllexport) __cdecl
b5138dfb
VK
40#else
41#define DECLSPEC_EXPORT
42#endif
e6c91aac 43#define DECLARE_SUBAGENT_ENTRY_POINT(name) extern "C" BOOL DECLSPEC_EXPORT NxSubAgentRegister(NETXMS_SUBAGENT_INFO **ppInfo, Config *config)
b5138dfb
VK
44#endif
45
46
cbcaf8c8
VK
47//
48// Some constants
49//
50
51#define AGENT_LISTEN_PORT 4700
deaa4491 52#define AGENT_PROTOCOL_VERSION 2
cbcaf8c8 53#define MAX_RESULT_LENGTH 256
e22f1644
VK
54#define MAX_CMD_LEN 256
55#define COMMAND_TIMEOUT 60
47e0446b 56#define MAX_SUBAGENT_NAME 64
cbcaf8c8
VK
57
58
6ca3b41c
VK
59//
60// Agent policy types
61//
62
63#define AGENT_POLICY_CONFIG 1
64
65
cbcaf8c8
VK
66//
67// Error codes
68//
69
deaa4491
VK
70#define ERR_SUCCESS ((DWORD)0)
71#define ERR_UNKNOWN_COMMAND ((DWORD)400)
72#define ERR_AUTH_REQUIRED ((DWORD)401)
d096bcdd 73#define ERR_ACCESS_DENIED ((DWORD)403)
deaa4491
VK
74#define ERR_UNKNOWN_PARAMETER ((DWORD)404)
75#define ERR_REQUEST_TIMEOUT ((DWORD)408)
76#define ERR_AUTH_FAILED ((DWORD)440)
77#define ERR_ALREADY_AUTHENTICATED ((DWORD)441)
78#define ERR_AUTH_NOT_REQUIRED ((DWORD)442)
79#define ERR_INTERNAL_ERROR ((DWORD)500)
80#define ERR_NOT_IMPLEMENTED ((DWORD)501)
81#define ERR_OUT_OF_RESOURCES ((DWORD)503)
82#define ERR_NOT_CONNECTED ((DWORD)900)
83#define ERR_CONNECTION_BROKEN ((DWORD)901)
1a17feb0 84#define ERR_BAD_RESPONSE ((DWORD)902)
d096bcdd
VK
85#define ERR_IO_FAILURE ((DWORD)903)
86#define ERR_RESOURCE_BUSY ((DWORD)904)
e925a5fc 87#define ERR_EXEC_FAILED ((DWORD)905)
e44ac467
VK
88#define ERR_ENCRYPTION_REQUIRED ((DWORD)906)
89#define ERR_NO_CIPHERS ((DWORD)907)
90#define ERR_INVALID_PUBLIC_KEY ((DWORD)908)
91#define ERR_INVALID_SESSION_KEY ((DWORD)909)
1ba3c17a 92#define ERR_CONNECT_FAILED ((DWORD)910)
78e570e6 93#define ERR_MALFORMED_COMMAND ((DWORD)911)
f1448d17 94#define ERR_SOCKET_ERROR ((DWORD)912)
dbca7ed1 95#define ERR_BAD_ARGUMENTS ((DWORD)913)
5405ce0b 96#define ERR_SUBAGENT_LOAD_FAILED ((DWORD)914)
deb10d32
VK
97#define ERR_FILE_OPEN_ERROR ((DWORD)915)
98#define ERR_FILE_STAT_FAILED ((DWORD)916)
99#define ERR_MEM_ALLOC_FAILED ((DWORD)917)
100#define ERR_FILE_DELETE_FAILED ((DWORD)918)
cbcaf8c8
VK
101
102
103//
104// Parameter handler return codes
105//
106
107#define SYSINFO_RC_SUCCESS 0
108#define SYSINFO_RC_UNSUPPORTED 1
109#define SYSINFO_RC_ERROR 2
110
111
30c68fa1
AK
112//
113// Descriptions for common parameters
114//
115
8f9299d1
VK
116#define DCIDESC_FS_AVAIL "Available space on file system {instance}"
117#define DCIDESC_FS_AVAILPERC "Percentage of available space on file system {instance}"
118#define DCIDESC_FS_FREE "Free space on file system {instance}"
119#define DCIDESC_FS_FREEPERC "Percentage of free space on file system {instance}"
120#define DCIDESC_FS_TOTAL "Total space on file system {instance}"
121#define DCIDESC_FS_USED "Used space on file system {instance}"
122#define DCIDESC_FS_USEDPERC "Percentage of used space on file system {instance}"
123#define DCIDESC_NET_INTERFACE_ADMINSTATUS "Administrative status of interface {instance}"
124#define DCIDESC_NET_INTERFACE_BYTESIN "Number of input bytes on interface {instance}"
125#define DCIDESC_NET_INTERFACE_BYTESOUT "Number of output bytes on interface {instance}"
126#define DCIDESC_NET_INTERFACE_DESCRIPTION "Description of interface {instance}"
127#define DCIDESC_NET_INTERFACE_INERRORS "Number of input errors on interface {instance}"
128#define DCIDESC_NET_INTERFACE_LINK "Link status for interface {instance}"
f09c2d05
VK
129#define DCIDESC_NET_INTERFACE_MTU "MTU for interface {instance}"
130#define DCIDESC_NET_INTERFACE_OPERSTATUS "Operational status of interface {instance}"
8f9299d1
VK
131#define DCIDESC_NET_INTERFACE_OUTERRORS "Number of output errors on interface {instance}"
132#define DCIDESC_NET_INTERFACE_PACKETSIN "Number of input packets on interface {instance}"
133#define DCIDESC_NET_INTERFACE_PACKETSOUT "Number of output packets on interface {instance}"
134#define DCIDESC_NET_INTERFACE_SPEED "Speed of interface {instance}"
135#define DCIDESC_NET_IP_FORWARDING "IP forwarding status"
136#define DCIDESC_NET_IP6_FORWARDING "IPv6 forwarding status"
137#define DCIDESC_PHYSICALDISK_FIRMWARE "Firmware version of hard disk {instance}"
138#define DCIDESC_PHYSICALDISK_MODEL "Model of hard disk {instance}"
139#define DCIDESC_PHYSICALDISK_SERIALNUMBER "Serial number of hard disk {instance}"
140#define DCIDESC_PHYSICALDISK_SMARTATTR ""
141#define DCIDESC_PHYSICALDISK_SMARTSTATUS "Status of hard disk {instance} reported by SMART"
86920454
VK
142#define DCIDESC_PHYSICALDISK_TEMPERATURE "Temperature of hard disk {instance}"
143#define DCIDESC_SYSTEM_CPU_COUNT "Number of CPU in the system"
144#define DCIDESC_SYSTEM_HOSTNAME "Host name"
145#define DCIDESC_SYSTEM_MEMORY_PHYSICAL_FREE "Free physical memory"
146#define DCIDESC_SYSTEM_MEMORY_PHYSICAL_FREE_PCT "Percentage of free physical memory"
147#define DCIDESC_SYSTEM_MEMORY_PHYSICAL_TOTAL "Total amount of physical memory"
148#define DCIDESC_SYSTEM_MEMORY_PHYSICAL_USED "Used physical memory"
149#define DCIDESC_SYSTEM_MEMORY_PHYSICAL_USED_PCT "Percentage of used physical memory"
ecd1dc40
AK
150#define DCIDESC_SYSTEM_MEMORY_PHYSICAL_AVAILABLE "Available physical memory"
151#define DCIDESC_SYSTEM_MEMORY_PHYSICAL_AVAILABLE_PCT "Percentage of available physical memory"
86920454
VK
152#define DCIDESC_SYSTEM_MEMORY_VIRTUAL_FREE "Free virtual memory"
153#define DCIDESC_SYSTEM_MEMORY_VIRTUAL_FREE_PCT "Percentage of free virtual memory"
154#define DCIDESC_SYSTEM_MEMORY_VIRTUAL_TOTAL "Total amount of virtual memory"
155#define DCIDESC_SYSTEM_MEMORY_VIRTUAL_USED "Used virtual memory"
156#define DCIDESC_SYSTEM_MEMORY_VIRTUAL_USED_PCT "Percentage of used virtual memory"
ecd1dc40
AK
157#define DCIDESC_SYSTEM_MEMORY_VIRTUAL_AVAILABLE "Available virtual memory"
158#define DCIDESC_SYSTEM_MEMORY_VIRTUAL_AVAILABLE_PCT "Percentage of available virtual memory"
86920454
VK
159#define DCIDESC_SYSTEM_MEMORY_SWAP_FREE "Free swap space"
160#define DCIDESC_SYSTEM_MEMORY_SWAP_FREE_PCT "Percentage of free swap space"
161#define DCIDESC_SYSTEM_MEMORY_SWAP_TOTAL "Total amount of swap space"
162#define DCIDESC_SYSTEM_MEMORY_SWAP_USED "Used swap space"
163#define DCIDESC_SYSTEM_MEMORY_SWAP_USED_PCT "Percentage of used swap space"
164#define DCIDESC_SYSTEM_UNAME "System uname"
165#define DCIDESC_AGENT_ACCEPTEDCONNECTIONS "Number of connections accepted by agent"
166#define DCIDESC_AGENT_ACCEPTERRORS "Number of accept() call errors"
167#define DCIDESC_AGENT_ACTIVECONNECTIONS "Number of active connections to agent"
168#define DCIDESC_AGENT_AUTHENTICATIONFAILURES "Number of authentication failures"
169#define DCIDESC_AGENT_CONFIG_SERVER "Configuration server address set on agent startup"
170#define DCIDESC_AGENT_FAILEDREQUESTS "Number of failed requests to agent"
7f78ab75
VK
171#define DCIDESC_AGENT_GENERATED_TRAPS "Number of traps generated by agent"
172#define DCIDESC_AGENT_LAST_TRAP_TIME "Timestamp of last generated trap"
86920454
VK
173#define DCIDESC_AGENT_PROCESSEDREQUESTS "Number of requests processed by agent"
174#define DCIDESC_AGENT_REGISTRAR "Registrar server address set on agent startup"
175#define DCIDESC_AGENT_REJECTEDCONNECTIONS "Number of connections rejected by agent"
7f78ab75 176#define DCIDESC_AGENT_SENT_TRAPS "Number of traps successfully sent to server"
86920454
VK
177#define DCIDESC_AGENT_SOURCEPACKAGESUPPORT ""
178#define DCIDESC_AGENT_SUPPORTEDCIPHERS "List of ciphers supported by agent"
179#define DCIDESC_AGENT_TIMEDOUTREQUESTS "Number of timed out requests to agent"
180#define DCIDESC_AGENT_UNSUPPORTEDREQUESTS "Number of requests for unsupported parameters"
181#define DCIDESC_AGENT_UPTIME "Agent's uptime"
182#define DCIDESC_AGENT_VERSION "Agent's version"
183#define DCIDESC_FILE_COUNT "Number of files {instance}"
184#define DCIDESC_FILE_HASH_CRC32 "CRC32 checksum of {instance}"
185#define DCIDESC_FILE_HASH_MD5 "MD5 hash of {instance}"
186#define DCIDESC_FILE_HASH_SHA1 "SHA1 hash of {instance}"
187#define DCIDESC_FILE_SIZE "Size of file {instance}"
188#define DCIDESC_FILE_TIME_ACCESS "Time of last access to file {instance}"
189#define DCIDESC_FILE_TIME_CHANGE "Time of last status change of file {instance}"
190#define DCIDESC_FILE_TIME_MODIFY "Time of last modification of file {instance}"
191#define DCIDESC_SYSTEM_PLATFORMNAME "Platform name"
192#define DCIDESC_PROCESS_COUNT "Number of {instance} processes"
193#define DCIDESC_PROCESS_COUNTEX "Number of {instance} processes (extended)"
194#define DCIDESC_PROCESS_CPUTIME "Total execution time for process {instance}"
195#define DCIDESC_PROCESS_GDIOBJ "GDI objects used by process {instance}"
196#define DCIDESC_PROCESS_IO_OTHERB ""
197#define DCIDESC_PROCESS_IO_OTHEROP ""
198#define DCIDESC_PROCESS_IO_READB ""
199#define DCIDESC_PROCESS_IO_READOP ""
200#define DCIDESC_PROCESS_IO_WRITEB ""
201#define DCIDESC_PROCESS_IO_WRITEOP ""
202#define DCIDESC_PROCESS_KERNELTIME "Total execution time in kernel mode for process {instance}"
203#define DCIDESC_PROCESS_PAGEFAULTS "Page faults for process {instance}"
204#define DCIDESC_PROCESS_SYSCALLS "Number of system calls made by process {instance}"
205#define DCIDESC_PROCESS_THREADS "Number of threads in process {instance}"
206#define DCIDESC_PROCESS_USEROBJ "USER objects used by process {instance}"
207#define DCIDESC_PROCESS_USERTIME "Total execution time in user mode for process {instance}"
208#define DCIDESC_PROCESS_VMSIZE "Virtual memory used by process {instance}"
209#define DCIDESC_PROCESS_WKSET "Physical memory used by process {instance}"
210#define DCIDESC_SYSTEM_APPADDRESSSPACE "Address space available to applications (MB)"
211#define DCIDESC_SYSTEM_CONNECTEDUSERS "Number of logged in users"
212#define DCIDESC_SYSTEM_PROCESSCOUNT "Total number of processes"
213#define DCIDESC_SYSTEM_SERVICESTATE "State of {instance} service"
214#define DCIDESC_SYSTEM_PROCESSCOUNT "Total number of processes"
215#define DCIDESC_SYSTEM_THREADCOUNT "Total number of threads"
216#define DCIDESC_PDH_COUNTERVALUE "Value of PDH counter {instance}"
217#define DCIDESC_PDH_VERSION "Version of PDH.DLL"
218#define DCIDESC_SYSTEM_UPTIME "System uptime"
219#define DCIDESC_SYSTEM_CPU_LOADAVG "Average CPU load for last minute"
220#define DCIDESC_SYSTEM_CPU_LOADAVG5 "Average CPU load for last 5 minutes"
221#define DCIDESC_SYSTEM_CPU_LOADAVG15 "Average CPU load for last 15 minutes"
ea242c94
AK
222
223
8f9299d1
VK
224#define DCIDESC_SYSTEM_CPU_USAGE_EX "Average CPU {instance} utilization for last minute"
225#define DCIDESC_SYSTEM_CPU_USAGE5_EX "Average CPU {instance} utilization for last 5 minutes"
226#define DCIDESC_SYSTEM_CPU_USAGE15_EX "Average CPU {instance} utilization for last 15 minutes"
227#define DCIDESC_SYSTEM_CPU_USAGE "Average CPU utilization for last minute"
228#define DCIDESC_SYSTEM_CPU_USAGE5 "Average CPU utilization for last 5 minutes"
229#define DCIDESC_SYSTEM_CPU_USAGE15 "Average CPU utilization for last 15 minutes"
ea242c94 230
ba8db57b
VK
231#define DCIDESC_SYSTEM_CPU_USAGE_USER_EX "Average CPU {instance} utilization (user) for last minute"
232#define DCIDESC_SYSTEM_CPU_USAGE5_USER_EX "Average CPU {instance} utilization (user) for last 5 minutes"
233#define DCIDESC_SYSTEM_CPU_USAGE15_USER_EX "Average CPU {instance} utilization (user) for last 15 minutes"
234#define DCIDESC_SYSTEM_CPU_USAGE_USER "Average CPU utilization (user) for last minute"
235#define DCIDESC_SYSTEM_CPU_USAGE5_USER "Average CPU utilization (user) for last 5 minutes"
236#define DCIDESC_SYSTEM_CPU_USAGE15_USER "Average CPU utilization (user) for last 15 minutes"
237
238#define DCIDESC_SYSTEM_CPU_USAGE_NICE_EX "Average CPU {instance} utilization (nice) for last minute"
239#define DCIDESC_SYSTEM_CPU_USAGE5_NICE_EX "Average CPU {instance} utilization (nice) for last 5 minutes"
240#define DCIDESC_SYSTEM_CPU_USAGE15_NICE_EX "Average CPU {instance} utilization (nice) for last 15 minutes"
241#define DCIDESC_SYSTEM_CPU_USAGE_NICE "Average CPU utilization (nice) for last minute"
242#define DCIDESC_SYSTEM_CPU_USAGE5_NICE "Average CPU utilization (nice) for last 5 minutes"
243#define DCIDESC_SYSTEM_CPU_USAGE15_NICE "Average CPU utilization (nice) for last 15 minutes"
244
245#define DCIDESC_SYSTEM_CPU_USAGE_SYSTEM_EX "Average CPU {instance} utilization (system) for last minute"
246#define DCIDESC_SYSTEM_CPU_USAGE5_SYSTEM_EX "Average CPU {instance} utilization (system) for last 5 minutes"
247#define DCIDESC_SYSTEM_CPU_USAGE15_SYSTEM_EX "Average CPU {instance} utilization (system) for last 15 minutes"
248#define DCIDESC_SYSTEM_CPU_USAGE_SYSTEM "Average CPU utilization (system) for last minute"
249#define DCIDESC_SYSTEM_CPU_USAGE5_SYSTEM "Average CPU utilization (system) for last 5 minutes"
250#define DCIDESC_SYSTEM_CPU_USAGE15_SYSTEM "Average CPU utilization (system) for last 15 minutes"
ea242c94
AK
251
252#define DCIDESC_SYSTEM_CPU_USAGE_IDLE_EX "Average CPU {instance} utilization (idle) for last minute"
253#define DCIDESC_SYSTEM_CPU_USAGE5_IDLE_EX "Average CPU {instance} utilization (idle) for last 5 minutes"
254#define DCIDESC_SYSTEM_CPU_USAGE15_IDLE_EX "Average CPU {instance} utilization (idle) for last 15 minutes"
255#define DCIDESC_SYSTEM_CPU_USAGE_IDLE "Average CPU utilization (idle) for last minute"
256#define DCIDESC_SYSTEM_CPU_USAGE5_IDLE "Average CPU utilization (idle) for last 5 minutes"
257#define DCIDESC_SYSTEM_CPU_USAGE15_IDLE "Average CPU utilization (idle) for last 15 minutes"
258
259#define DCIDESC_SYSTEM_CPU_USAGE_IOWAIT_EX "Average CPU {instance} utilization (iowait) for last minute"
260#define DCIDESC_SYSTEM_CPU_USAGE5_IOWAIT_EX "Average CPU {instance} utilization (iowait) for last 5 minutes"
261#define DCIDESC_SYSTEM_CPU_USAGE15_IOWAIT_EX "Average CPU {instance} utilization (iowait) for last 15 minutes"
262#define DCIDESC_SYSTEM_CPU_USAGE_IOWAIT "Average CPU utilization (iowait) for last minute"
263#define DCIDESC_SYSTEM_CPU_USAGE5_IOWAIT "Average CPU utilization (iowait) for last 5 minutes"
264#define DCIDESC_SYSTEM_CPU_USAGE15_IOWAIT "Average CPU utilization (iowait) for last 15 minutes"
265
266#define DCIDESC_SYSTEM_CPU_USAGE_IRQ_EX "Average CPU {instance} utilization (irq) for last minute"
267#define DCIDESC_SYSTEM_CPU_USAGE5_IRQ_EX "Average CPU {instance} utilization (irq) for last 5 minutes"
268#define DCIDESC_SYSTEM_CPU_USAGE15_IRQ_EX "Average CPU {instance} utilization (irq) for last 15 minutes"
269#define DCIDESC_SYSTEM_CPU_USAGE_IRQ "Average CPU utilization (irq) for last minute"
270#define DCIDESC_SYSTEM_CPU_USAGE5_IRQ "Average CPU utilization (irq) for last 5 minutes"
271#define DCIDESC_SYSTEM_CPU_USAGE15_IRQ "Average CPU utilization (irq) for last 15 minutes"
272
273#define DCIDESC_SYSTEM_CPU_USAGE_SOFTIRQ_EX "Average CPU {instance} utilization (softirq) for last minute"
274#define DCIDESC_SYSTEM_CPU_USAGE5_SOFTIRQ_EX "Average CPU {instance} utilization (softirq) for last 5 minutes"
275#define DCIDESC_SYSTEM_CPU_USAGE15_SOFTIRQ_EX "Average CPU {instance} utilization (softirq) for last 15 minutes"
276#define DCIDESC_SYSTEM_CPU_USAGE_SOFTIRQ "Average CPU utilization (softirq) for last minute"
277#define DCIDESC_SYSTEM_CPU_USAGE5_SOFTIRQ "Average CPU utilization (softirq) for last 5 minutes"
278#define DCIDESC_SYSTEM_CPU_USAGE15_SOFTIRQ "Average CPU utilization (softirq) for last 15 minutes"
279
ba8db57b
VK
280#define DCIDESC_SYSTEM_CPU_USAGE_STEAL_EX "Average CPU {instance} utilization (steal) for last minute"
281#define DCIDESC_SYSTEM_CPU_USAGE5_STEAL_EX "Average CPU {instance} utilization (steal) for last 5 minutes"
282#define DCIDESC_SYSTEM_CPU_USAGE15_STEAL_EX "Average CPU {instance} utilization (steal) for last 15 minutes"
283#define DCIDESC_SYSTEM_CPU_USAGE_STEAL "Average CPU utilization (steal) for last minute"
284#define DCIDESC_SYSTEM_CPU_USAGE5_STEAL "Average CPU utilization (steal) for last 5 minutes"
285#define DCIDESC_SYSTEM_CPU_USAGE15_STEAL "Average CPU utilization (steal) for last 15 minutes"
ea242c94 286
e9ff42ed
AK
287#define DCIDESC_SYSTEM_CPU_USAGE_GUEST_EX "Average CPU {instance} utilization (guest) for last minute"
288#define DCIDESC_SYSTEM_CPU_USAGE5_GUEST_EX "Average CPU {instance} utilization (guest) for last 5 minutes"
289#define DCIDESC_SYSTEM_CPU_USAGE15_GUEST_EX "Average CPU {instance} utilization (guest) for last 15 minutes"
290#define DCIDESC_SYSTEM_CPU_USAGE_GUEST "Average CPU utilization (guest) for last minute"
291#define DCIDESC_SYSTEM_CPU_USAGE5_GUEST "Average CPU utilization (guest) for last 5 minutes"
292#define DCIDESC_SYSTEM_CPU_USAGE15_GUEST "Average CPU utilization (guest) for last 15 minutes"
ea242c94 293
8f9299d1
VK
294#define DCIDESC_SYSTEM_IO_DISKQUEUE "Average disk queue length for last minute"
295#define DCIDESC_SYSTEM_IO_DISKQUEUE_EX "Average disk queue length of device {instance} for last minute"
296#define DCIDESC_SYSTEM_IO_DISKTIME "Percent of CPU time spent on I/O for last minute"
297#define DCIDESC_SYSTEM_IO_DISKTIME_EX "Percent of CPU time spent on I/O on device {instance} for last minute"
ba8db57b
VK
298#define DCIDESC_SYSTEM_IO_WAITTIME "Average I/O request wait time"
299#define DCIDESC_SYSTEM_IO_WAITTIME_EX "Average I/O request wait time for device {instance}"
8f9299d1
VK
300#define DCIDESC_SYSTEM_IO_READS "Average number of read operations for last minute"
301#define DCIDESC_SYSTEM_IO_READS_EX "Average number of read operations on device {instance} for last minute"
302#define DCIDESC_SYSTEM_IO_WRITES "Average number of write operations for last minute"
303#define DCIDESC_SYSTEM_IO_WRITES_EX "Average number of write operations on device {instance} for last minute"
939df0f1
VK
304#define DCIDESC_SYSTEM_IO_XFERS "Average number of I/O transfers for last minute"
305#define DCIDESC_SYSTEM_IO_XFERS_EX "Average number of I/O transfers on device {instance} for last minute"
8f9299d1
VK
306#define DCIDESC_SYSTEM_IO_BYTEREADS "Average number of bytes read for last minute"
307#define DCIDESC_SYSTEM_IO_BYTEREADS_EX "Average number of bytes read on device {instance} for last minute"
308#define DCIDESC_SYSTEM_IO_BYTEWRITES "Average number of bytes written for last minute"
309#define DCIDESC_SYSTEM_IO_BYTEWRITES_EX "Average number of bytes written on device {instance} for last minute"
914c8d2a 310#define DCIDESC_SYSTEM_IO_OPENFILES "Number of open files"
8f9299d1
VK
311
312
313#define DCIDESC_DEPRECATED "<deprecated>"
30c68fa1
AK
314
315
3b376ea0 316//
6827d635 317// Subagent's parameter information
3b376ea0
VK
318//
319
6827d635
VK
320typedef struct
321{
018fda4d 322 TCHAR szName[MAX_PARAM_NAME];
e2d68ddd 323 LONG (* fpHandler)(const TCHAR *, const TCHAR *, TCHAR *);
a765d97c 324 const TCHAR *pArg;
8f9299d1 325 int iDataType; // Use DT_DEPRECATED to indicate deprecated parameter
a72a1fb1 326 TCHAR szDescription[MAX_DB_STRING];
6827d635
VK
327} NETXMS_SUBAGENT_PARAM;
328
329
f480bdd4
VK
330//
331// Subagent's push parameter information
332//
333
334typedef struct
335{
336 TCHAR name[MAX_PARAM_NAME];
337 int dataType;
338 TCHAR description[MAX_DB_STRING];
339} NETXMS_SUBAGENT_PUSHPARAM;
340
341
901c96c7
VK
342//
343// Subagent's enum information
344//
345
346typedef struct
347{
018fda4d 348 TCHAR szName[MAX_PARAM_NAME];
6173bea8 349 LONG (* fpHandler)(const TCHAR *, const TCHAR *, StringList *);
a765d97c 350 const TCHAR *pArg;
901c96c7
VK
351} NETXMS_SUBAGENT_ENUM;
352
353
37778a1d
VK
354//
355// Subagent's action information
356//
357
358typedef struct
359{
360 TCHAR szName[MAX_PARAM_NAME];
6173bea8 361 LONG (* fpHandler)(const TCHAR *, StringList *, const TCHAR *);
a765d97c 362 const TCHAR *pArg;
37778a1d
VK
363 TCHAR szDescription[MAX_DB_STRING];
364} NETXMS_SUBAGENT_ACTION;
365
366
6827d635
VK
367//
368// Subagent initialization structure
369//
3b376ea0 370
f480bdd4 371#define NETXMS_SUBAGENT_INFO_MAGIC ((DWORD)0x20091206)
ded831ac
VK
372
373class CSCPMessage;
d618c3ae 374
6827d635
VK
375typedef struct
376{
d618c3ae 377 DWORD dwMagic; // Magic number to check if subagent uses correct version of this structure
018fda4d 378 TCHAR szName[MAX_SUBAGENT_NAME];
43caa61e 379 TCHAR szVersion[32];
42a96a81 380 BOOL (* pInit)(Config *); // Called to initialize subagent. Can be NULL.
f0be41a4 381 void (* pShutdown)(void); // Called at subagent unload. Can be NULL.
2e5d6a1e 382 BOOL (* pCommandHandler)(DWORD dwCommand, CSCPMessage *pRequest,
6173bea8 383 CSCPMessage *pResponse, void *session);
6827d635
VK
384 DWORD dwNumParameters;
385 NETXMS_SUBAGENT_PARAM *pParamList;
901c96c7
VK
386 DWORD dwNumEnums;
387 NETXMS_SUBAGENT_ENUM *pEnumList;
37778a1d
VK
388 DWORD dwNumActions;
389 NETXMS_SUBAGENT_ACTION *pActionList;
f480bdd4
VK
390 DWORD dwNumPushParameters;
391 NETXMS_SUBAGENT_PUSHPARAM *pPushParamList;
6827d635 392} NETXMS_SUBAGENT_INFO;
3b376ea0
VK
393
394
cbcaf8c8
VK
395//
396// Inline functions for returning parameters
397//
398
a765d97c 399inline void ret_string(TCHAR *rbuf, const TCHAR *value)
cbcaf8c8 400{
a23d8e0d 401 nx_strncpy(rbuf, value, MAX_RESULT_LENGTH);
cbcaf8c8
VK
402}
403
0212dc5a 404inline void ret_int(TCHAR *rbuf, LONG value)
cbcaf8c8 405{
66d07089 406#if defined(_WIN32) && (_MSC_VER >= 1300)
6e38075b 407 _sntprintf_s(rbuf, MAX_RESULT_LENGTH, _TRUNCATE, _T("%ld"), (long)value);
a23d8e0d 408#else
6e38075b 409 _sntprintf(rbuf, MAX_RESULT_LENGTH, _T("%ld"), (long)value);
a23d8e0d 410#endif
cbcaf8c8
VK
411}
412
0212dc5a 413inline void ret_uint(TCHAR *rbuf, DWORD value)
cbcaf8c8 414{
66d07089 415#if defined(_WIN32) && (_MSC_VER >= 1300)
6e38075b 416 _sntprintf_s(rbuf, MAX_RESULT_LENGTH, _TRUNCATE, _T("%lu"), (unsigned long)value);
a23d8e0d 417#else
6e38075b 418 _sntprintf(rbuf, MAX_RESULT_LENGTH, _T("%lu"), (unsigned long)value);
a23d8e0d 419#endif
cbcaf8c8
VK
420}
421
018fda4d 422inline void ret_double(TCHAR *rbuf, double value)
cbcaf8c8 423{
66d07089 424#if defined(_WIN32) && (_MSC_VER >= 1300)
a23d8e0d
VK
425 _sntprintf_s(rbuf, MAX_RESULT_LENGTH, _TRUNCATE, _T("%f"), value);
426#else
8b86c5dc 427 _sntprintf(rbuf, MAX_RESULT_LENGTH, _T("%f"), value);
a23d8e0d 428#endif
cbcaf8c8
VK
429}
430
018fda4d 431inline void ret_int64(TCHAR *rbuf, INT64 value)
cbcaf8c8 432{
66d07089 433#if defined(_WIN32) && (_MSC_VER >= 1300)
a23d8e0d 434 _sntprintf_s(rbuf, MAX_RESULT_LENGTH, _TRUNCATE, _T("%I64d"), value);
cbcaf8c8 435#else /* _WIN32 */
ccc34207 436 _sntprintf(rbuf, MAX_RESULT_LENGTH, INT64_FMT, value);
cbcaf8c8
VK
437#endif /* _WIN32 */
438}
439
018fda4d 440inline void ret_uint64(TCHAR *rbuf, QWORD value)
cbcaf8c8 441{
66d07089 442#if defined(_WIN32) && (_MSC_VER >= 1300)
a23d8e0d 443 _sntprintf_s(rbuf, MAX_RESULT_LENGTH, _TRUNCATE, _T("%I64u"), value);
cbcaf8c8 444#else /* _WIN32 */
ccc34207 445 _sntprintf(rbuf, MAX_RESULT_LENGTH, UINT64_FMT, value);
cbcaf8c8
VK
446#endif /* _WIN32 */
447}
448
6827d635
VK
449
450//
6173bea8 451// API for subagents
6827d635
VK
452//
453
6173bea8 454BOOL LIBNETXMS_EXPORTABLE AgentGetParameterArg(const TCHAR *param, int index, TCHAR *arg, int maxSize);
c303351c
VK
455void LIBNETXMS_EXPORTABLE AgentWriteLog(int logLevel, const TCHAR *format, ...);
456void LIBNETXMS_EXPORTABLE AgentWriteLog2(int logLevel, const TCHAR *format, va_list args);
457void LIBNETXMS_EXPORTABLE AgentWriteDebugLog(int level, const TCHAR *format, ...);
458void LIBNETXMS_EXPORTABLE AgentWriteDebugLog2(int level, const TCHAR *format, va_list args);
6173bea8
VK
459void LIBNETXMS_EXPORTABLE AgentSendTrap(DWORD dwEvent, const char *pszFormat, ...);
460void LIBNETXMS_EXPORTABLE AgentSendTrap2(DWORD dwEvent, int nCount, TCHAR **ppszArgList);
6f1abd2c 461BOOL LIBNETXMS_EXPORTABLE AgentSendFileToServer(void *session, DWORD requestId, const TCHAR *file, long offset);
f480bdd4 462BOOL LIBNETXMS_EXPORTABLE AgentPushParameterData(const TCHAR *parameter, const TCHAR *value);
9309ac95
VK
463BOOL LIBNETXMS_EXPORTABLE AgentPushParameterDataInt32(const TCHAR *parameter, LONG value);
464BOOL LIBNETXMS_EXPORTABLE AgentPushParameterDataUInt32(const TCHAR *parameter, DWORD value);
465BOOL LIBNETXMS_EXPORTABLE AgentPushParameterDataInt64(const TCHAR *parameter, INT64 value);
466BOOL LIBNETXMS_EXPORTABLE AgentPushParameterDataUInt64(const TCHAR *parameter, QWORD value);
467BOOL LIBNETXMS_EXPORTABLE AgentPushParameterDataDouble(const TCHAR *parameter, double value);
6827d635 468
cbcaf8c8 469#endif /* _nms_agent_h_ */