- Added signal handlers to agent
[public/netxms.git] / src / agent / subagents / sunos / main.cpp
1 /*
2 ** NetXMS subagent for SunOS/Solaris
3 ** Copyright (C) 2004 Victor Kirhenshtein
4 **
5 ** This program is free software; you can redistribute it and/or modify
6 ** it under the terms of the GNU General Public License as published by
7 ** the Free Software Foundation; either version 2 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 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 ** $module: main.cpp
20 **
21 **/
22
23 #include "sunos_subagent.h"
24
25
26 //
27 // Hanlder functions
28 //
29
30 LONG H_DiskInfo(char *pszParam, char *pArg, char *pValue);
31 LONG H_NetIfList(char *pszParam, char *pArg, NETXMS_VALUES_LIST *pValue);
32 LONG H_ProcessCount(char *pszParam, char *pArg, char *pValue);
33 LONG H_ProcessInfo(char *pszParam, char *pArg, char *pValue);
34 LONG H_ProcessList(char *pszParam, char *pArg, NETXMS_VALUES_LIST *pValue);
35 LONG H_SysProcCount(char *pszParam, char *pArg, char *pValue);
36
37
38 //
39 // Called by master agent at unload
40 //
41
42 static void UnloadHandler(void)
43 {
44 }
45
46
47 //
48 // Subagent information
49 //
50
51 static NETXMS_SUBAGENT_PARAM m_parameters[] =
52 {
53 { "Disk.Free(*)", H_DiskInfo, (char *)DISK_FREE },
54 { "Disk.Total(*)", H_DiskInfo, (char *)DISK_TOTAL },
55 { "Disk.Used(*)", H_DiskInfo, (char *)DISK_USED },
56 { "Process.Count(*)", H_ProcessCount, NULL },
57 { "System.ProcessCount", H_SysProcCount, NULL }
58 };
59 static NETXMS_SUBAGENT_ENUM m_enums[] =
60 {
61 { "Net.InterfaceList", H_NetIfList, NULL },
62 { "System.ProcessList", H_ProcessList, NULL }
63 };
64
65 static NETXMS_SUBAGENT_INFO m_info =
66 {
67 NETXMS_SUBAGENT_INFO_MAGIC,
68 _T("SUNOS"), NETXMS_VERSION_STRING,
69 UnloadHandler, NULL,
70 sizeof(m_parameters) / sizeof(NETXMS_SUBAGENT_PARAM),
71 m_parameters,
72 sizeof(m_enums) / sizeof(NETXMS_SUBAGENT_ENUM),
73 m_enums
74 };
75
76
77 //
78 // Entry point for NetXMS agent
79 //
80
81 extern "C" BOOL NxSubAgentInit(NETXMS_SUBAGENT_INFO **ppInfo, TCHAR *pszConfigFile)
82 {
83 *ppInfo = &m_info;
84 return TRUE;
85 }