agent installer and all subagents synched
authorVictor Kirhenshtein <victor@netxms.org>
Fri, 1 May 2009 08:02:41 +0000 (08:02 +0000)
committerVictor Kirhenshtein <victor@netxms.org>
Fri, 1 May 2009 08:02:41 +0000 (08:02 +0000)
62 files changed:
.gitattributes
src/agent/install/nxagent-x64.iss
src/agent/install/nxagent.iss
src/agent/install/setup.iss
src/agent/subagents/ecs/Makefile.am
src/agent/subagents/ecs/ecs.dsp [deleted file]
src/agent/subagents/freebsd/Makefile.am
src/agent/subagents/freebsd/freebsd.cpp
src/agent/subagents/freebsd/proc.cpp [new file with mode: 0644]
src/agent/subagents/freebsd/system.cpp
src/agent/subagents/freebsd/system.h
src/agent/subagents/linux/Makefile.am
src/agent/subagents/linux/disk.cpp
src/agent/subagents/linux/disk.h [deleted file]
src/agent/subagents/linux/drbd.cpp
src/agent/subagents/linux/hddinfo.cpp
src/agent/subagents/linux/iostat.cpp
src/agent/subagents/linux/iostat.h [deleted file]
src/agent/subagents/linux/linux.cpp
src/agent/subagents/linux/linux_subagent.h [new file with mode: 0644]
src/agent/subagents/linux/net.cpp
src/agent/subagents/linux/net.h [deleted file]
src/agent/subagents/linux/proc.cpp
src/agent/subagents/linux/proc.h [deleted file]
src/agent/subagents/linux/system.cpp
src/agent/subagents/linux/system.h [deleted file]
src/agent/subagents/logwatch/Makefile.am
src/agent/subagents/logwatch/eventlog.cpp
src/agent/subagents/logwatch/logwatch.dsp [deleted file]
src/agent/subagents/logwatch/logwatch.h
src/agent/subagents/logwatch/main.cpp
src/agent/subagents/netbsd/Makefile.am
src/agent/subagents/netbsd/netbsd.cpp
src/agent/subagents/netbsd/proc.cpp [new file with mode: 0644]
src/agent/subagents/netbsd/proc2.cpp [new file with mode: 0644]
src/agent/subagents/netbsd/system.cpp
src/agent/subagents/netbsd/system.h
src/agent/subagents/odbcquery/Makefile.am
src/agent/subagents/odbcquery/odbcquery.dsp [deleted file]
src/agent/subagents/ping/Makefile.am
src/agent/subagents/ping/ping.dsp [deleted file]
src/agent/subagents/portCheck/Makefile.am
src/agent/subagents/portCheck/portcheck.dsp [deleted file]
src/agent/subagents/sms/Makefile.am
src/agent/subagents/sms/sms.dsp [deleted file]
src/agent/subagents/sunos/main.cpp
src/agent/subagents/sunos/process.cpp
src/agent/subagents/sunos/sunos_subagent.h
src/agent/subagents/ups/Makefile.am
src/agent/subagents/ups/ups.dsp [deleted file]
src/agent/subagents/win9x/Makefile.am
src/agent/subagents/win9x/win9x.dsp [deleted file]
src/agent/subagents/winnt/Makefile.am
src/agent/subagents/winnt/main.cpp
src/agent/subagents/winnt/procinfo.cpp
src/agent/subagents/winnt/winnt.dsp [deleted file]
src/agent/subagents/winnt/winnt_subagent.h
src/agent/subagents/winperf/Makefile.am
src/agent/subagents/winperf/winperf.cpp
src/agent/subagents/winperf/winperf.dsp [deleted file]
src/agent/subagents/wmi/Makefile.am
src/agent/subagents/wmi/wmi.dsp [deleted file]

index 15fb646..8077e7c 100644 (file)
@@ -45,28 +45,17 @@ include/nxlpapi.h -text
 netware/bin/.keep -text
 src/PPC_libs.vcw eol=crlf
 src/agent/core/nxagentd.vcproj -text
-src/agent/subagents/ecs/ecs.dsp eol=crlf
 src/agent/subagents/ecs/ecs.vcproj -text
-src/agent/subagents/logwatch/logwatch.dsp eol=crlf
 src/agent/subagents/logwatch/logwatch.vcproj -text
-src/agent/subagents/odbcquery/odbcquery.dsp eol=crlf
 src/agent/subagents/odbcquery/odbcquery.vcproj -text
-src/agent/subagents/ping/ping.dsp eol=crlf
 src/agent/subagents/ping/ping.vcproj -text
-src/agent/subagents/portCheck/portcheck.dsp eol=crlf
 src/agent/subagents/portCheck/portcheck.vcproj -text
-src/agent/subagents/sms/sms.dsp eol=crlf
 src/agent/subagents/sms/sms.vcproj -text
 src/agent/subagents/ups/doc/apc_protocol_files/nut-banner.png -text
 src/agent/subagents/ups/doc/apc_protocol_files/vh401.png -text
-src/agent/subagents/ups/ups.dsp eol=crlf
 src/agent/subagents/ups/ups.vcproj -text
-src/agent/subagents/win9x/win9x.dsp eol=crlf
-src/agent/subagents/winnt/winnt.dsp eol=crlf
 src/agent/subagents/winnt/winnt.vcproj -text
-src/agent/subagents/winperf/winperf.dsp eol=crlf
 src/agent/subagents/winperf/winperf.vcproj -text
-src/agent/subagents/wmi/wmi.dsp eol=crlf
 src/agent/subagents/wmi/wmi.vcproj -text
 src/client/console/libnxmc/libnxmc.dsp eol=crlf
 src/client/console/nxmc/eppEditor.cpp -text
index 40aa2de..10846e1 100644 (file)
@@ -3,28 +3,28 @@
 
 [Setup]
 #include "setup.iss"
-OutputBaseFilename=nxagent-0.9.0-rc1-x64
+OutputBaseFilename=nxagent-0.2.26-x64
 ArchitecturesInstallIn64BitMode=x64
 ArchitecturesAllowed=x64
 
 [Files]
-Source: "..\..\libnetxms\Release64\libnetxms.dll"; DestDir: "{app}\bin"; BeforeInstall: StopService; Flags: ignoreversion
-Source: "..\..\libnxlp\Release64\libnxlp.dll"; DestDir: "{app}\bin"; Flags: ignoreversion
-Source: "..\core\Release64\nxagentd.exe"; DestDir: "{app}\bin"; Flags: ignoreversion
-Source: "..\subagents\winnt\Release64\winnt.nsm"; DestDir: "{app}\bin"; Flags: ignoreversion
-Source: "..\subagents\winperf\Release64\winperf.nsm"; DestDir: "{app}\bin"; Flags: ignoreversion
-Source: "..\subagents\wmi\Release64\wmi.nsm"; DestDir: "{app}\bin"; Flags: ignoreversion
-Source: "..\subagents\ping\Release64\ping.nsm"; DestDir: "{app}\bin"; Flags: ignoreversion
-Source: "..\subagents\portCheck\Release64\portcheck.nsm"; DestDir: "{app}\bin"; Flags: ignoreversion
-Source: "..\subagents\logscan\Release64\logscan.nsm"; DestDir: "{app}\bin"; Flags: ignoreversion
-Source: "..\subagents\logwatch\Release64\logwatch.nsm"; DestDir: "{app}\bin"; Flags: ignoreversion
-Source: "..\subagents\sms\Release64\sms.nsm"; DestDir: "{app}\bin"; Flags: ignoreversion
-Source: "..\subagents\ups\Release64\ups.nsm"; DestDir: "{app}\bin"; Flags: ignoreversion
-Source: "..\subagents\ecs\Release64\ecs.nsm"; DestDir: "{app}\bin"; Flags: ignoreversion
-Source: "..\subagents\odbcquery\Release64\odbcquery.nsm"; DestDir: "{app}\bin"; Flags: ignoreversion
+Source: "..\..\..\x64\release\libnetxms.dll"; DestDir: "{app}\bin"; BeforeInstall: StopService; Flags: ignoreversion
+Source: "..\..\..\x64\release\libnxlp.dll"; DestDir: "{app}\bin"; Flags: ignoreversion
+Source: "..\..\..\x64\release\nxagentd.exe"; DestDir: "{app}\bin"; Flags: ignoreversion
+Source: "..\..\..\x64\release\winnt.nsm"; DestDir: "{app}\bin"; Flags: ignoreversion
+Source: "..\..\..\x64\release\winperf.nsm"; DestDir: "{app}\bin"; Flags: ignoreversion
+Source: "..\..\..\x64\release\wmi.nsm"; DestDir: "{app}\bin"; Flags: ignoreversion
+Source: "..\..\..\x64\release\ping.nsm"; DestDir: "{app}\bin"; Flags: ignoreversion
+Source: "..\..\..\x64\release\portcheck.nsm"; DestDir: "{app}\bin"; Flags: ignoreversion
+Source: "..\..\..\x64\release\logwatch.nsm"; DestDir: "{app}\bin"; Flags: ignoreversion
+Source: "..\..\..\x64\release\sms.nsm"; DestDir: "{app}\bin"; Flags: ignoreversion
+Source: "..\..\..\x64\release\ups.nsm"; DestDir: "{app}\bin"; Flags: ignoreversion
+Source: "..\..\..\x64\release\ecs.nsm"; DestDir: "{app}\bin"; Flags: ignoreversion
+Source: "..\..\..\x64\release\odbcquery.nsm"; DestDir: "{app}\bin"; Flags: ignoreversion
 Source: "..\..\..\contrib\nxagentd.conf-dist"; DestDir: "{app}\etc"; Flags: ignoreversion
-Source: "..\..\install\windows-x64\files\libeay32.dll"; DestDir: "{app}\bin"; Flags: ignoreversion
-Source: "..\..\install\windows-x64\files\libexpat.dll"; DestDir: "{app}\bin"; Flags: ignoreversion
+Source: "..\..\..\x64\release\libexpat.dll"; DestDir: "{app}\bin"; Flags: ignoreversion
+Source: "..\..\install\windows\files-x64\libeay32.dll"; DestDir: "{app}\bin"; Flags: ignoreversion
+Source: "..\..\install\windows\files-x64\Microsoft.VC80.CRT\*"; DestDir: "{app}\bin\Microsoft.VC80.CRT"; Flags: ignoreversion
 
 #include "common.iss"
 
index dc09714..5503daa 100644 (file)
@@ -7,20 +7,35 @@ OutputBaseFilename=nxagent-0.2.24
 
 [Files]
 Source: "..\..\libnetxms\Release\libnetxms.dll"; DestDir: "{app}\bin"; BeforeInstall: StopService; Flags: ignoreversion
+Source: "..\..\libnetxms\Release\libnetxms.pdb"; DestDir: "{app}\bin"; Flags: ignoreversion
 Source: "..\..\libnxlp\Release\libnxlp.dll"; DestDir: "{app}\bin"; Flags: ignoreversion
+Source: "..\..\libnxlp\Release\libnxlp.pdb"; DestDir: "{app}\bin"; Flags: ignoreversion
 Source: "..\core\Release\nxagentd.exe"; DestDir: "{app}\bin"; Flags: ignoreversion
+Source: "..\core\Release\nxagentd.pdb"; DestDir: "{app}\bin"; Flags: ignoreversion
 Source: "..\subagents\winnt\Release\winnt.nsm"; DestDir: "{app}\bin"; Flags: ignoreversion
+Source: "..\subagents\winnt\Release\winnt.pdb"; DestDir: "{app}\bin"; Flags: ignoreversion
 Source: "..\subagents\win9x\Release\win9x.nsm"; DestDir: "{app}\bin"; Flags: ignoreversion
+Source: "..\subagents\win9x\Release\win9x.pdb"; DestDir: "{app}\bin"; Flags: ignoreversion
 Source: "..\subagents\winperf\Release\winperf.nsm"; DestDir: "{app}\bin"; Flags: ignoreversion
+Source: "..\subagents\winperf\Release\winperf.pdb"; DestDir: "{app}\bin"; Flags: ignoreversion
 Source: "..\subagents\wmi\Release\wmi.nsm"; DestDir: "{app}\bin"; Flags: ignoreversion
+Source: "..\subagents\wmi\Release\wmi.pdb"; DestDir: "{app}\bin"; Flags: ignoreversion
 Source: "..\subagents\ping\Release\ping.nsm"; DestDir: "{app}\bin"; Flags: ignoreversion
+Source: "..\subagents\ping\Release\ping.pdb"; DestDir: "{app}\bin"; Flags: ignoreversion
 Source: "..\subagents\portCheck\Release\portcheck.nsm"; DestDir: "{app}\bin"; Flags: ignoreversion
+Source: "..\subagents\portCheck\Release\portcheck.pdb"; DestDir: "{app}\bin"; Flags: ignoreversion
 Source: "..\subagents\ecs\Release\ecs.nsm"; DestDir: "{app}\bin"; Flags: ignoreversion
+Source: "..\subagents\ecs\Release\ecs.pdb"; DestDir: "{app}\bin"; Flags: ignoreversion
 Source: "..\subagents\logscan\Release\logscan.nsm"; DestDir: "{app}\bin"; Flags: ignoreversion
+Source: "..\subagents\logscan\Release\logscan.pdb"; DestDir: "{app}\bin"; Flags: ignoreversion
 Source: "..\subagents\logwatch\Release\logwatch.nsm"; DestDir: "{app}\bin"; Flags: ignoreversion
+Source: "..\subagents\logwatch\Release\logwatch.pdb"; DestDir: "{app}\bin"; Flags: ignoreversion
 Source: "..\subagents\odbcquery\Release\odbcquery.nsm"; DestDir: "{app}\bin"; Flags: ignoreversion
+Source: "..\subagents\odbcquery\Release\odbcquery.pdb"; DestDir: "{app}\bin"; Flags: ignoreversion
 Source: "..\subagents\sms\Release\sms.nsm"; DestDir: "{app}\bin"; Flags: ignoreversion
+Source: "..\subagents\sms\Release\sms.pdb"; DestDir: "{app}\bin"; Flags: ignoreversion
 Source: "..\subagents\ups\Release\ups.nsm"; DestDir: "{app}\bin"; Flags: ignoreversion
+Source: "..\subagents\ups\Release\ups.pdb"; DestDir: "{app}\bin"; Flags: ignoreversion
 Source: "..\..\..\contrib\nxagentd.conf-dist"; DestDir: "{app}\etc"; Flags: ignoreversion
 Source: "..\..\install\windows\files\libeay32.dll"; DestDir: "{app}\bin"; Flags: ignoreversion
 Source: "..\..\install\windows\files\libexpat.dll"; DestDir: "{app}\bin"; Flags: ignoreversion
index e6cce96..7325e3d 100644 (file)
@@ -1,6 +1,6 @@
 AppName=NetXMS Agent
-AppVerName=NetXMS Agent 0.9.0-rc1
-AppVersion=0.9.0-rc1
+AppVerName=NetXMS Agent 0.2.26
+AppVersion=0.2.26
 AppPublisher=NetXMS Team
 AppPublisherURL=http://www.netxms.org
 AppSupportURL=http://www.netxms.org
index b22d0ec..684eb65 100644 (file)
@@ -4,7 +4,7 @@ lib_LTLIBRARIES = libnsm_ecs.la
 libnsm_ecs_la_SOURCES = ecs.cpp
 libnsm_ecs_la_LDFLAGS = ../../../libnetxms/libnetxms.la
 
-EXTRA_DIST = ecs.dsp ecs.dsw ecs.def Makefile.nw
+EXTRA_DIST = ecs.vcproj ecs.def Makefile.nw
 
 install-exec-hook:
        if test "x`uname -s`" = "xAIX" ; then \
diff --git a/src/agent/subagents/ecs/ecs.dsp b/src/agent/subagents/ecs/ecs.dsp
deleted file mode 100644 (file)
index 51495d8..0000000
+++ /dev/null
@@ -1,208 +0,0 @@
-# Microsoft Developer Studio Project File - Name="ecs" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=ecs - Win32 Debug AMD64
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "ecs.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "ecs.mak" CFG="ecs - Win32 Debug AMD64"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "ecs - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "ecs - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "ecs - Win32 Release AMD64" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "ecs - Win32 Debug AMD64" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "ecs - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ecs_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "..\..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ecs_EXPORTS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib ws2_32.lib /nologo /dll /debug /machine:I386 /out:"Release/ecs.nsm" /pdbtype:sept /libpath:"..\..\..\libnetxms\Release"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy files
-PostBuild_Cmds=copy Release\ecs.nsm C:\NetXMS\bin      copy Release\ecs.pdb C:\NetXMS\bin
-# End Special Build Tool
-
-!ELSEIF  "$(CFG)" == "ecs - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 1
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ecs_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ecs_EXPORTS" /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib ws2_32.lib /nologo /dll /debug /machine:I386 /out:"Debug/ecs.nsm" /pdbtype:sept /libpath:"..\..\..\libnetxms\Debug"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy files
-PostBuild_Cmds=copy Debug\ecs.nsm ..\..\..\..\bin      copy Debug\ecs.pdb ..\..\..\..\bin
-# End Special Build Tool
-
-!ELSEIF  "$(CFG)" == "ecs - Win32 Release AMD64"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "ecs___Win32_Release_AMD64"
-# PROP BASE Intermediate_Dir "ecs___Win32_Release_AMD64"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release64"
-# PROP Intermediate_Dir "Release64"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /O2 /I "..\..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ecs_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "..\..\..\..\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ecs_EXPORTS" /D "__64BIT__" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib ws2_32.lib /nologo /dll /machine:I386 /out:"Release/ecs.nsm" /libpath:"..\..\..\libnetxms\Release"
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib ws2_32.lib bufferoverflowU.lib /nologo /dll /debug /machine:I386 /out:"Release64/ecs.nsm" /pdbtype:sept /libpath:"..\..\..\libnetxms\Release64" /machine:AMD64
-# SUBTRACT LINK32 /pdb:none
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy files
-PostBuild_Cmds=copy Release64\ecs.nsm C:\NetXMS\bin64  copy Release64\ecs.pdb C:\NetXMS\bin64
-# End Special Build Tool
-
-!ELSEIF  "$(CFG)" == "ecs - Win32 Debug AMD64"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "ecs___Win32_Debug_AMD64"
-# PROP BASE Intermediate_Dir "ecs___Win32_Debug_AMD64"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug64"
-# PROP Intermediate_Dir "Debug64"
-# PROP Ignore_Export_Lib 1
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ecs_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /Zi /Od /I "..\..\..\..\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ecs_EXPORTS" /D "__64BIT__" /FD /GZ /Wp64 /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib ws2_32.lib /nologo /dll /debug /machine:I386 /out:"Debug/ecs.nsm" /pdbtype:sept /libpath:"..\..\..\libnetxms\Debug"
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib ws2_32.lib bufferoverflowU.lib /nologo /dll /debug /machine:I386 /out:"Debug64/ecs.nsm" /pdbtype:sept /libpath:"..\..\..\libnetxms\Debug64" /machine:AMD64
-# SUBTRACT LINK32 /pdb:none
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy files
-PostBuild_Cmds=copy Debug64\ecs.nsm ..\..\..\..\bin64  copy Debug64\ecs.pdb ..\..\..\..\bin64
-# End Special Build Tool
-
-!ENDIF 
-
-# Begin Target
-
-# Name "ecs - Win32 Release"
-# Name "ecs - Win32 Debug"
-# Name "ecs - Win32 Release AMD64"
-# Name "ecs - Win32 Debug AMD64"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\ecs.cpp
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE="..\..\..\..\include\netxms-version.h"
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\include\nms_agent.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\include\nms_common.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\include\nms_threads.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\include\nms_util.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
index 752bd5b..2cc354c 100644 (file)
@@ -1,8 +1,8 @@
 INCLUDES=-I@top_srcdir@/include
-AM_CXXFLAGS=-fpermissive 
+#AM_CXXFLAGS=-fpermissive 
 
 lib_LTLIBRARIES = libnsm_freebsd.la
-libnsm_freebsd_la_SOURCES = freebsd.cpp system.cpp disk.cpp net.cpp
+libnsm_freebsd_la_SOURCES = freebsd.cpp system.cpp disk.cpp net.cpp proc.cpp
 libnsm_freebsd_la_LDFLAGS = -lkvm
 
 EXTRA_DIST = disk.h net.h system.h
index 5fb1598..01c32be 100644 (file)
@@ -52,8 +52,16 @@ static NETXMS_SUBAGENT_PARAM m_parameters[] =
        { "Net.Interface.PacketsIn(*)",   H_NetIfInfoFromKVM, (char *)IF_INFO_PACKETS_IN,  DCI_DT_UINT64, DCIDESC_NET_INTERFACE_PACKETSIN },
        { "Net.Interface.PacketsOut(*)",  H_NetIfInfoFromKVM, (char *)IF_INFO_PACKETS_OUT, DCI_DT_UINT64, DCIDESC_NET_INTERFACE_PACKETSOUT },
 
-       { "Process.Count(*)",             H_ProcessCount,    (char *)0,                 DCI_DT_UINT,    DCIDESC_PROCESS_COUNT },
-       { "System.ProcessCount",          H_ProcessCount,    (char *)1,                 DCI_DT_UINT,    DCIDESC_SYSTEM_PROCESSCOUNT },
+       { "Process.Count(*)",             H_ProcessCount,    "P",                       DCI_DT_UINT,    DCIDESC_PROCESS_COUNT },
+       { "Process.CountEx(*)",           H_ProcessCount,    "E",                       DCI_DT_UINT,    DCIDESC_PROCESS_COUNTEX },
+       { "Process.CPUTime(*)",           H_ProcessInfo,     CAST_TO_POINTER(PROCINFO_CPUTIME, const char *),
+               DCI_DT_INT64,   DCIDESC_PROCESS_CPUTIME },
+       { "Process.Threads(*)",           H_ProcessInfo,     CAST_TO_POINTER(PROCINFO_THREADS, const char *),
+               DCI_DT_INT64,   DCIDESC_PROCESS_THREADS },
+       { "Process.VMSize(*)",            H_ProcessInfo,     CAST_TO_POINTER(PROCINFO_VMSIZE, const char *),
+               DCI_DT_INT64,   DCIDESC_PROCESS_VMSIZE },
+       { "Process.WkSet(*)",             H_ProcessInfo,     CAST_TO_POINTER(PROCINFO_WKSET, const char *),
+               DCI_DT_INT64,   DCIDESC_PROCESS_WKSET },
 
        { "System.CPU.Count",             H_CpuCount,        NULL,                              DCI_DT_INT,     DCIDESC_SYSTEM_CPU_COUNT },
 
@@ -64,12 +72,16 @@ static NETXMS_SUBAGENT_PARAM m_parameters[] =
        { "System.Memory.Physical.Free",  H_MemoryInfo,      (char *)PHYSICAL_FREE,             DCI_DT_UINT64,  DCIDESC_SYSTEM_MEMORY_PHYSICAL_FREE },
        { "System.Memory.Physical.Total", H_MemoryInfo,      (char *)PHYSICAL_TOTAL,            DCI_DT_UINT64,  DCIDESC_SYSTEM_MEMORY_PHYSICAL_TOTAL },
        { "System.Memory.Physical.Used",  H_MemoryInfo,      (char *)PHYSICAL_USED,             DCI_DT_UINT64,  DCIDESC_SYSTEM_MEMORY_PHYSICAL_USED },
+#if HAVE_KVM_SWAPINFO
        { "System.Memory.Swap.Free",      H_MemoryInfo,      (char *)SWAP_FREE,         DCI_DT_UINT64,  DCIDESC_SYSTEM_MEMORY_SWAP_FREE },
        { "System.Memory.Swap.Total",     H_MemoryInfo,      (char *)SWAP_TOTAL,                DCI_DT_UINT64,  DCIDESC_SYSTEM_MEMORY_SWAP_TOTAL },
        { "System.Memory.Swap.Used",      H_MemoryInfo,      (char *)SWAP_USED,         DCI_DT_UINT64,  DCIDESC_SYSTEM_MEMORY_SWAP_USED },
        { "System.Memory.Virtual.Free",   H_MemoryInfo,      (char *)VIRTUAL_FREE,              DCI_DT_UINT64,  DCIDESC_SYSTEM_MEMORY_VIRTUAL_FREE },
        { "System.Memory.Virtual.Total",  H_MemoryInfo,      (char *)VIRTUAL_TOTAL,             DCI_DT_UINT64,  DCIDESC_SYSTEM_MEMORY_VIRTUAL_TOTAL },
        { "System.Memory.Virtual.Used",   H_MemoryInfo,      (char *)VIRTUAL_USED,              DCI_DT_UINT64,  DCIDESC_SYSTEM_MEMORY_VIRTUAL_USED },
+#endif
+       { "System.ProcessCount",          H_ProcessCount,    "S",                       DCI_DT_UINT,    DCIDESC_SYSTEM_PROCESSCOUNT },
+       { "System.ThreadCount",           H_ProcessCount,    "T",                       DCI_DT_UINT,    DCIDESC_SYSTEM_THREADCOUNT },
        { "System.Uname",                 H_Uname,           NULL,                              DCI_DT_STRING,  DCIDESC_SYSTEM_UNAME },
        { "System.Uptime",                H_Uptime,          NULL,                              DCI_DT_UINT,    DCIDESC_SYSTEM_UPTIME },
 
@@ -124,53 +136,3 @@ extern "C" BOOL __NxSubAgentGetArpCache(NETXMS_VALUES_LIST *pValue)
 {
        return H_NetArpCache("Net.ArpCache", NULL, pValue) == SYSINFO_RC_SUCCESS;
 }
-
-
-///////////////////////////////////////////////////////////////////////////////
-/*
-
-$Log: not supported by cvs2svn $
-Revision 1.11  2007/06/08 00:02:35  alk
-DECLARE_SUBAGENT_INIT replaced with DECLARE_SUBAGENT_ENTRY_POINT
-
-NETXMS_SUBAGENT_INFO initialization fixed (actions)
-
-Revision 1.10  2007/06/07 23:46:33  alk
-DECLARE_SUBAGENT_INIT replaced w/ DECLARE_SUBAGENT_ENTRY_POINT
-
-Revision 1.9  2007/06/06 08:46:39  alk
-DCI descriptions replaced with defines
-
-Revision 1.8  2007/04/18 20:26:29  victor
-
-FreeBSD agent improved
-
-Revision 1.7  2005/09/15 21:47:02  victor
-Added macro DECLARE_SUBAGENT_INIT to simplify initialization function declaration
-
-Revision 1.6  2005/08/22 23:00:05  alk
-Net.IP.RoutingTable added
-
-Revision 1.5  2005/03/10 19:04:07  alk
-implemented:
-       Net.Interface.AdminStatus(*)
-       Net.Interface.Link(*)
-
-Revision 1.4  2005/01/24 19:51:16  alk
-reurn types/comments added
-Process.Count(*)/System.ProcessCount fixed
-
-Revision 1.3  2005/01/23 05:08:06  alk
-+ System.CPU.Count
-+ System.Memory.Physical.*
-+ System.ProcessCount
-+ System.ProcessList
-
-Revision 1.2  2005/01/17 23:25:47  alk
-Agent.SourcePackageSupport added
-
-Revision 1.1  2005/01/17 17:14:32  alk
-freebsd agent, incomplete (but working)
-
-
-*/
diff --git a/src/agent/subagents/freebsd/proc.cpp b/src/agent/subagents/freebsd/proc.cpp
new file mode 100644 (file)
index 0000000..84370ce
--- /dev/null
@@ -0,0 +1,323 @@
+/* 
+** NetXMS subagent for FreeBSD
+** Copyright (C) 2004-2009 Alex Kirhenshtein, Victor Kirhenshtein
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+**
+**/
+
+#undef _XOPEN_SOURCE
+
+#if __FreeBSD__ < 8
+#define _SYS_LOCK_PROFILE_H_   /* prevent include of sys/lock_profile.h which can be C++ incompatible) */
+#endif
+
+#include <nms_common.h>
+#include <nms_agent.h>
+#include <nms_util.h>
+
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/sysctl.h>
+#include <sys/utsname.h>
+#include <sys/param.h>
+
+#if __FreeBSD__ < 5
+#include <sys/proc.h>
+#endif
+
+#include <sys/user.h>
+#include <kvm.h>
+
+#include "system.h"
+
+#ifndef KERN_PROC_PROC
+#define KERN_PROC_PROC KERN_PROC_ALL
+#endif
+
+#if __FreeBSD__ >= 5
+#define PNAME p->ki_comm
+#else
+#define PNAME p->kp_proc.p_comm
+#endif
+
+
+//
+// Build process command line
+//
+
+static void BuildProcessCommandLine(kvm_t *kd, struct kinfo_proc *p, char *cmdLine, size_t maxSize)
+{
+       char **argv;
+       int i, pos, len;
+
+       *cmdLine = 0;
+       argv = kvm_getargv(kd, p, 0);
+       if (argv != NULL)
+       {
+               if (argv[0] != NULL)
+               {
+                       for(i = 0, pos = 0; (argv[i] != NULL) && (pos < maxSize); i++)
+                       {
+                               if (i > 0)
+                                       cmdLine[pos++] = ' ';
+                               nx_strncpy(&cmdLine[pos], argv[i], maxSize - pos);
+                               pos += strlen(argv[i]);
+                       }
+               }
+               else
+               {
+                       // Use process name if command line is empty
+                       cmdLine[0] = '[';
+                       nx_strncpy(&cmdLine[1], PNAME, maxSize - 2);
+                       strcat(cmdLine, "]");
+               }
+       }
+       else
+       {
+               // Use process name if command line cannot be obtained
+               cmdLine[0] = '[';
+               nx_strncpy(&cmdLine[1], PNAME, maxSize - 2);
+               strcat(cmdLine, "]");
+       }
+}
+
+
+//
+// Check if given process matches filter
+//
+
+static BOOL MatchProcess(kvm_t *kd, struct kinfo_proc *p, BOOL extMatch, const char *name, const char *cmdLine)
+{
+       char processCmdLine[32768];
+
+       if (extMatch)
+       {
+               BuildProcessCommandLine(kd, p, processCmdLine, sizeof(processCmdLine));
+               return ((*name != 0) ? RegexpMatch(PNAME, name, FALSE) : TRUE) &&
+                      ((*cmdLine != 0) ? RegexpMatch(processCmdLine, cmdLine, TRUE) : TRUE);
+       }
+       else
+       {
+               return strcasecmp(PNAME, name) == 0;
+       }
+}
+
+
+//
+// Handler for Process.Count, Process.CountEx and System.ProcessCount parameters
+//
+
+LONG H_ProcessCount(const char *param, const char *arg, char *value)
+{
+       int nRet = SYSINFO_RC_ERROR;
+       char name[128] = "", cmdLine[128] = "";
+       int nCount;
+       int nResult = -1;
+       int i;
+       kvm_t *kd;
+       struct kinfo_proc *kp;
+
+       if ((*arg != 'S') && (*arg != 'T'))  // Not System.ProcessCount nor System.ThreadCount
+       {
+               NxGetParameterArg(param, 1, name, sizeof(name));
+               if (*arg == 'E')        // Process.CountEx
+               {
+                       NxGetParameterArg(param, 2, cmdLine, sizeof(cmdLine));
+               }
+       }
+
+       kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, NULL);
+       if (kd != NULL)
+       {
+               kp = kvm_getprocs(kd, KERN_PROC_PROC, 0, &nCount);
+
+               if (kp != NULL)
+               {
+                       if (*arg != 'S')        // Not System.ProcessCount
+                       {
+                               nResult = 0;
+                               if (*arg == 'T')  // System.ThreadCount
+                               {
+                                       for (i = 0; i < nCount; i++)
+                                       {
+                                               nResult += kp[i].ki_numthreads;
+                                       }
+                               }
+                               else
+                               {
+                                       for (i = 0; i < nCount; i++)
+                                       {
+                                               if (MatchProcess(kd, &kp[i], *arg == 'E', name, cmdLine))
+                                               {
+                                                       nResult++;
+                                               }
+                                       }
+                               }
+                       }
+                       else
+                       {
+                               nResult = nCount;
+                       }
+               }
+
+               kvm_close(kd);
+       }
+
+       if (nResult >= 0)
+       {
+               ret_int(value, nResult);
+               nRet = SYSINFO_RC_SUCCESS;
+       }
+
+       return nRet;
+}
+
+
+//
+// Handler for Process.* parameters
+//
+
+LONG H_ProcessInfo(const char *param, const char *arg, char *value)
+{
+       int nRet = SYSINFO_RC_ERROR;
+       char name[128] = "", cmdLine[128] = "", buffer[64] = "";
+       int nCount, nMatched;
+       INT64 currValue, result;
+       int i, type;
+       kvm_t *kd;
+       struct kinfo_proc *kp;
+       static const char *typeList[]={ "min", "max", "avg", "sum", NULL };
+
+        // Get parameter type arguments
+       NxGetParameterArg(param, 2, buffer, sizeof(buffer));
+       if (buffer[0] == 0)     // Omited type
+       {
+               type = INFOTYPE_SUM;
+       }
+       else
+       {
+               for(type = 0; typeList[type] != NULL; type++)
+                       if (!stricmp(typeList[type], buffer))
+                               break;
+               if (typeList[type] == NULL)
+                       return SYSINFO_RC_UNSUPPORTED;     // Unsupported type
+       }
+
+       NxGetParameterArg(param, 1, name, sizeof(name));
+       NxGetParameterArg(param, 3, cmdLine, sizeof(cmdLine));
+
+       kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, NULL);
+       if (kd != NULL)
+       {
+               kp = kvm_getprocs(kd, KERN_PROC_PROC, 0, &nCount);
+
+               if (kp != NULL)
+               {
+                       result = 0;
+                       nMatched = 0;
+                       for (i = 0; i < nCount; i++)
+                       {
+                               if (MatchProcess(kd, &kp[i], *cmdLine != 0, name, cmdLine))
+                               {
+                                       nMatched++;
+                                       switch(CAST_FROM_POINTER(arg, int))
+                                       {
+                                               case PROCINFO_CPUTIME:
+                                                       currValue = kp[i].ki_runtime / 1000;  // microsec -> millisec
+                                                       break;
+                                               case PROCINFO_THREADS:
+                                                       currValue = kp[i].ki_numthreads;
+                                                       break;
+                                               case PROCINFO_VMSIZE:
+                                                       currValue = kp[i].ki_size;
+                                                       break;
+                                               case PROCINFO_WKSET:
+                                                       currValue = kp[i].ki_rssize * getpagesize();
+                                                       break;
+                                       }
+
+                                       switch(type)
+                                       {
+                                               case INFOTYPE_SUM:
+                                               case INFOTYPE_AVG:
+                                                       result += currValue;
+                                                       break;
+                                               case INFOTYPE_MIN:
+                                                       result = min(result, currValue);
+                                                       break;
+                                               case INFOTYPE_MAX:
+                                                       result = max(result, currValue);
+                                                       break;
+                                       }
+                               }
+                       }
+                       if ((type == INFOTYPE_AVG) && (nMatched > 0))
+                               result /= nMatched;
+                       ret_int64(value, result);
+                       nRet = SYSINFO_RC_SUCCESS;
+               }
+
+               kvm_close(kd);
+       }
+
+       return nRet;
+}
+
+
+//
+// Handler for System.ProcessList enum
+//
+
+LONG H_ProcessList(const char *pszParam, const char *pArg, NETXMS_VALUES_LIST *pValue)
+{
+       int nRet = SYSINFO_RC_ERROR;
+       int nCount = -1;
+       int i;
+       struct kinfo_proc *kp;
+       kvm_t *kd;
+
+       kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, NULL);
+       if (kd != 0)
+       {
+               kp = kvm_getprocs(kd, KERN_PROC_PROC, 0, &nCount);
+
+               if (kp != NULL)
+               {
+                       for (i = 0; i < nCount; i++)
+                       {
+                               char szBuff[128];
+
+                               snprintf(szBuff, sizeof(szBuff), "%d %s",
+#if __FreeBSD__ >= 5
+                                               kp[i].ki_pid, kp[i].ki_comm
+#else
+                                               kp[i].kp_proc.p_pid, kp[i].kp_proc.p_comm
+#endif
+                                               );
+                               NxAddResultString(pValue, szBuff);
+                       }
+               }
+
+               kvm_close(kd);
+       }
+
+       if (nCount >= 0)
+       {
+               nRet = SYSINFO_RC_SUCCESS;
+       }
+
+       return nRet;
+}
index 49ce00a..c5a2653 100644 (file)
@@ -168,59 +168,6 @@ LONG H_CpuCount(const char *pszParam, const char *pArg, char *pValue)
        return nRet;
 }
 
-LONG H_ProcessCount(const char *pszParam, const char *pArg, char *pValue)
-{
-       int nRet = SYSINFO_RC_ERROR;
-//     struct statvfs s;
-       char szArg[128] = {0};
-       int nCount;
-       int nResult = -1;
-       int i;
-       kvm_t *kd;
-       struct kinfo_proc *kp;
-
-       NxGetParameterArg(pszParam, 1, szArg, sizeof(szArg));
-
-       kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, NULL);
-       if (kd != NULL)
-       {
-               kp = kvm_getprocs(kd, KERN_PROC_ALL, 0, &nCount);
-
-               if (kp != NULL)
-               {
-                       if (szArg[0] != 0)
-                       {
-                               nResult = 0;
-                               for (i = 0; i < nCount; i++)
-                               {
-#if __FreeBSD__ >= 5
-                                       if (strcasecmp(kp[i].ki_comm, szArg) == 0)
-#else
-                                       if (strcasecmp(kp[i].kp_proc.p_comm, szArg) == 0)
-#endif
-                                       {
-                                               nResult++;
-                                       }
-                               }
-                       }
-                       else
-                       {
-                               nResult = nCount;
-                       }
-               }
-
-               kvm_close(kd);
-       }
-
-       if (nResult >= 0)
-       {
-               ret_int(pValue, nResult);
-               nRet = SYSINFO_RC_SUCCESS;
-       }
-
-       return nRet;
-}
-
 LONG H_MemoryInfo(const char *pszParam, const char *pArg, char *pValue)
 {
        int nRet = SYSINFO_RC_ERROR;
@@ -235,7 +182,9 @@ LONG H_MemoryInfo(const char *pszParam, const char *pArg, char *pValue)
        int nPageSize;
        char szArg[16] = {0};
        kvm_t *kd;
+#if HAVE_KWM_GETSWAPINFO
        struct kvm_swap swap[16];
+#endif
 
        nPageCount = nFreeCount = 0;
        nSwapTotal = nSwapUsed = 0;
@@ -271,7 +220,7 @@ LONG H_MemoryInfo(const char *pszParam, const char *pArg, char *pValue)
 #undef DOIT
 
        // Swap
-
+#if HAVE_KVM_GETSWAPINFO
        kd = kvm_open(NULL, NULL, NULL, O_RDONLY, "kvm_open");
        if (kd != NULL)
        {
@@ -291,6 +240,7 @@ LONG H_MemoryInfo(const char *pszParam, const char *pArg, char *pValue)
                                (int)pArg != PHYSICAL_USED)
                nRet = SYSINFO_RC_ERROR;
        }
+#endif
 
        if (nRet == SYSINFO_RC_SUCCESS)
        {
@@ -335,48 +285,6 @@ LONG H_MemoryInfo(const char *pszParam, const char *pArg, char *pValue)
        return nRet;
 }
 
-LONG H_ProcessList(const char *pszParam, const char *pArg, NETXMS_VALUES_LIST *pValue)
-{
-       int nRet = SYSINFO_RC_ERROR;
-       int nCount = -1;
-       int i;
-       struct kinfo_proc *kp;
-       kvm_t *kd;
-
-
-
-       kd = kvm_openfiles(_PATH_DEVNULL, _PATH_DEVNULL, NULL, O_RDONLY, NULL);
-       if (kd != 0)
-       {
-               kp = kvm_getprocs(kd, KERN_PROC_ALL, 0, &nCount);
-
-               if (kp != NULL)
-               {
-                       for (i = 0; i < nCount; i++)
-                       {
-                               char szBuff[128];
-
-                               snprintf(szBuff, sizeof(szBuff), "%d %s",
-#if __FreeBSD__ >= 5
-                                               kp[i].ki_pid, kp[i].ki_comm
-#else
-                                               kp[i].kp_proc.p_pid, kp[i].kp_proc.p_comm
-#endif
-                                               );
-                               NxAddResultString(pValue, szBuff);
-                       }
-               }
-
-               kvm_close(kd);
-       }
-
-       if (nCount >= 0)
-       {
-               nRet = SYSINFO_RC_SUCCESS;
-       }
-
-       return nRet;
-}
 
 //
 // stub
index 83e52e8..58c0e4b 100644 (file)
@@ -36,6 +36,23 @@ enum
        VIRTUAL_TOTAL,
 };
 
+enum
+{
+       PROCINFO_CPUTIME,
+       PROCINFO_KTIME,
+       PROCINFO_PAGEFAULTS,
+       PROCINFO_THREADS,
+       PROCINFO_UTIME,
+       PROCINFO_VMSIZE,
+       PROCINFO_WKSET
+};
+
+#define INFOTYPE_MIN             0
+#define INFOTYPE_MAX             1
+#define INFOTYPE_AVG             2
+#define INFOTYPE_SUM             3
+
+
 LONG H_ProcessList(const char *, const char *, NETXMS_VALUES_LIST *);
 LONG H_Uptime(const char *, const char *, char *);
 LONG H_Uname(const char *, const char *, char *);
@@ -45,30 +62,8 @@ LONG H_CpuCount(const char *, const char *, char *);
 LONG H_CpuLoad(const char *, const char *, char *);
 LONG H_CpuUsage(const char *, const char *, char *);
 LONG H_ProcessCount(const char *, const char *, char *);
+LONG H_ProcessInfo(const char *, const char *, char *);
 LONG H_MemoryInfo(const char *, const char *, char *);
 LONG H_SourcePkgSupport(const char *, const char *, char *);
 
 #endif // __SYSTEM_H__
-
-///////////////////////////////////////////////////////////////////////////////
-/*
-
-$Log: not supported by cvs2svn $
-Revision 1.2  2005/01/17 23:25:48  alk
-Agent.SourcePackageSupport added
-
-Revision 1.1  2005/01/17 17:14:32  alk
-freebsd agent, incomplete (but working)
-
-Revision 1.1  2004/10/22 22:08:35  alk
-source restructured;
-implemented:
-       Net.IP.Forwarding
-       Net.IP6.Forwarding
-       Process.Count(*)
-       Net.ArpCache
-       Net.InterfaceList (if-type not implemented yet)
-       System.ProcessList
-
-
-*/
index 27dbf0b..f95d3fd 100644 (file)
@@ -3,4 +3,4 @@ INCLUDES=-I@top_srcdir@/include
 lib_LTLIBRARIES = libnsm_linux.la
 libnsm_linux_la_SOURCES = disk.cpp drbd.cpp hddinfo.cpp linux.cpp net.cpp proc.cpp system.cpp iostat.cpp
 
-EXTRA_DIST = disk.h drbd.h drbd_config.h net.h proc.h system.h iostat.h
+EXTRA_DIST = drbd.h drbd_config.h linux_subagent.h
index b281517..b98a160 100644 (file)
 **
 **/
 
-#include <nms_common.h>
-#include <nms_agent.h>
+#include "linux_subagent.h"
 
-#include <paths.h>
-#include <mntent.h>
-#include <sys/vfs.h>
-
-#include "disk.h"
 
 static void findMountpointByDevice(char *dev, int size)
 {
@@ -67,7 +61,7 @@ LONG H_DiskInfo(const char *pszParam, const char *pArg, char *pValue)
                        
                        QWORD usedBlocks = (QWORD)(s.f_blocks - s.f_bfree);
                        QWORD totalBlocks = (QWORD)s.f_blocks;
-                       QWORD blockSize = (QWORD)s.f_frsize;
+                       QWORD blockSize = (QWORD)s.f_bsize;
                        QWORD freeBlocks = (QWORD)s.f_bfree;
                        QWORD availableBlocks = (QWORD)s.f_bavail;
                        
diff --git a/src/agent/subagents/linux/disk.h b/src/agent/subagents/linux/disk.h
deleted file mode 100644 (file)
index 0313c63..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/* $Id$ */
-
-/* 
-** NetXMS subagent for GNU/Linux
-** Copyright (C) 2004 Alex Kirhenshtein
-**
-** This program is free software; you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation; either version 2 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
-** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-**
-**/
-
-#ifndef __DISK_H__
-#define __DISK_H__
-
-enum
-{
-       DISK_FREE,
-       DISK_AVAIL,
-       DISK_USED,
-       DISK_TOTAL,
-       DISK_FREE_PERC,
-       DISK_AVAIL_PERC,
-       DISK_USED_PERC
-};
-
-LONG H_DiskInfo(const char *, const char *, char *);
-
-#endif // __DISK_H__
-
-///////////////////////////////////////////////////////////////////////////////
-/*
-
-$Log: not supported by cvs2svn $
-Revision 1.2  2005/08/19 15:23:50  victor
-Added new parameters
-
-Revision 1.1  2004/10/22 22:08:34  alk
-source restructured;
-implemented:
-       Net.IP.Forwarding
-       Net.IP6.Forwarding
-       Process.Count(*)
-       Net.ArpCache
-       Net.InterfaceList (if-type not implemented yet)
-       System.ProcessList
-
-
-*/
index be991b2..c1fa69f 100644 (file)
@@ -20,8 +20,7 @@
 **
 **/
 
-#include <nms_common.h>
-#include <nms_agent.h>
+#include <linux_subagent.h>
 #include "drbd.h"
 
 
index 60bee73..9ff06ca 100644 (file)
@@ -22,8 +22,7 @@
 **
 **/
 
-#include <nms_common.h>
-#include <nms_agent.h>
+#include <linux_subagent.h>
 #include <ata.h>
 #include <sys/ioctl.h>
 
index 7a605ff..ced7fad 100644 (file)
 **
 **/
 
-#include <nms_common.h>
-#include <nms_agent.h>
-
-#include <paths.h>
-#include <mntent.h>
-#include <sys/vfs.h>
-
-#include "iostat.h"
+#include <linux_subagent.h>
 
 
 #define IF_PARAM1 char szParam1[512] = {0}; NxGetParameterArg(pszParam, 1, szParam1, sizeof(szParam1)); if (szParam1[0] != 0)
diff --git a/src/agent/subagents/linux/iostat.h b/src/agent/subagents/linux/iostat.h
deleted file mode 100644 (file)
index d9f4d95..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/* $Id$ */
-
-/* 
-** NetXMS subagent for GNU/Linux
-** Copyright (C) 2008 Alex Kirhenshtein
-**
-** This program is free software; you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation; either version 2 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
-** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-**
-**/
-
-#ifndef __IOSTAT_H__
-#define __IOSTAT_H__
-
-LONG H_TransferRate(const char *, const char *, char *);
-LONG H_BlockReadRate(const char *, const char *, char *);
-LONG H_BlockWriteRate(const char *, const char *, char *);
-LONG H_BytesReadRate(const char *, const char *, char *);
-LONG H_BytesWriteRate(const char *, const char *, char *);
-LONG H_DiskQueue(const char *, const char *, char *);
-LONG H_DiskTime(const char *, const char *, char *);
-
-#endif // __DISK_H__
-
-///////////////////////////////////////////////////////////////////////////////
-/*
-
-$Log: not supported by cvs2svn $
-
-*/
-
index 60d0813..19e0253 100644 (file)
 **
 **/
 
-#include <nms_common.h>
-#include <nms_agent.h>
+#include "linux_subagent.h"
 
-#include "net.h"
-#include "system.h"
-#include "disk.h"
-#include "iostat.h"
 
 //
 // Initalization callback
@@ -130,8 +125,25 @@ static NETXMS_SUBAGENT_PARAM m_parameters[] =
                DCI_DT_UINT,    DCIDESC_PROCESS_COUNT },
        { "Process.CountEx(*)",           H_ProcessCount,    "E",
                DCI_DT_UINT,    DCIDESC_PROCESS_COUNTEX },
+       { "Process.CPUTime(*)",           H_ProcessDetails,  CAST_TO_POINTER(PROCINFO_CPUTIME, const char *),
+               DCI_DT_INT64,   DCIDESC_PROCESS_CPUTIME },
+       { "Process.KernelTime(*)",        H_ProcessDetails,  CAST_TO_POINTER(PROCINFO_KTIME, const char *),
+               DCI_DT_INT64,   DCIDESC_PROCESS_KERNELTIME },
+       { "Process.PageFaults(*)",        H_ProcessDetails,  CAST_TO_POINTER(PROCINFO_PAGEFAULTS, const char *),
+               DCI_DT_INT64,   DCIDESC_PROCESS_PAGEFAULTS },
+       { "Process.Threads(*)",           H_ProcessDetails,  CAST_TO_POINTER(PROCINFO_THREADS, const char *),
+               DCI_DT_INT64,   DCIDESC_PROCESS_THREADS },
+       { "Process.UserTime(*)",          H_ProcessDetails,  CAST_TO_POINTER(PROCINFO_UTIME, const char *),
+               DCI_DT_INT64,   DCIDESC_PROCESS_USERTIME },
+       { "Process.VMSize(*)",            H_ProcessDetails,  CAST_TO_POINTER(PROCINFO_VMSIZE, const char *),
+               DCI_DT_INT64,   DCIDESC_PROCESS_VMSIZE },
+       { "Process.WkSet(*)",             H_ProcessDetails,  CAST_TO_POINTER(PROCINFO_WKSET, const char *),
+               DCI_DT_INT64,   DCIDESC_PROCESS_WKSET },
+       
        { "System.ProcessCount",          H_ProcessCount,    "T",
                DCI_DT_UINT,    DCIDESC_SYSTEM_PROCESSCOUNT },
+       { "System.ThreadCount",           H_ThreadCount,     NULL,
+               DCI_DT_UINT,    DCIDESC_SYSTEM_THREADCOUNT },
 
        { "System.ConnectedUsers",        H_ConnectedUsers,  NULL,
                DCI_DT_INT,    DCIDESC_SYSTEM_CONNECTEDUSERS },
@@ -146,135 +158,132 @@ static NETXMS_SUBAGENT_PARAM m_parameters[] =
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_LOADAVG15 },
 
        /**************************************************************/
-#define P(q, w) (char *)&((struct CpuUsageParam){q, w})
        /* usage */
-       { "System.CPU.Usage",             H_CpuUsage,        P(INTERVAL_1MIN, CPU_USAGE_OVERAL),
+       { "System.CPU.Usage",             H_CpuUsage,        MAKE_CPU_USAGE_PARAM(INTERVAL_1MIN, CPU_USAGE_OVERAL),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE },
-       { "System.CPU.Usage5",            H_CpuUsage,        P(INTERVAL_5MIN, CPU_USAGE_OVERAL),
+       { "System.CPU.Usage5",            H_CpuUsage,        MAKE_CPU_USAGE_PARAM(INTERVAL_5MIN, CPU_USAGE_OVERAL),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE5 },
-       { "System.CPU.Usage15",           H_CpuUsage,        P(INTERVAL_15MIN, CPU_USAGE_OVERAL),
+       { "System.CPU.Usage15",           H_CpuUsage,        MAKE_CPU_USAGE_PARAM(INTERVAL_15MIN, CPU_USAGE_OVERAL),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE15 },
-       { "System.CPU.Usage(*)",          H_CpuUsageEx,      P(INTERVAL_1MIN, CPU_USAGE_OVERAL),
+       { "System.CPU.Usage(*)",          H_CpuUsageEx,      MAKE_CPU_USAGE_PARAM(INTERVAL_1MIN, CPU_USAGE_OVERAL),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE_EX },
-       { "System.CPU.Usage5(*)",         H_CpuUsageEx,      P(INTERVAL_5MIN, CPU_USAGE_OVERAL),
+       { "System.CPU.Usage5(*)",         H_CpuUsageEx,      MAKE_CPU_USAGE_PARAM(INTERVAL_5MIN, CPU_USAGE_OVERAL),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE5_EX },
-       { "System.CPU.Usage15(*)",        H_CpuUsageEx,      P(INTERVAL_15MIN, CPU_USAGE_OVERAL),
+       { "System.CPU.Usage15(*)",        H_CpuUsageEx,      MAKE_CPU_USAGE_PARAM(INTERVAL_15MIN, CPU_USAGE_OVERAL),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE15_EX },
 
        /* user */
-       { "System.CPU.Usage.User",             H_CpuUsage,        P(INTERVAL_1MIN, CPU_USAGE_USER),
+       { "System.CPU.Usage.User",             H_CpuUsage,        MAKE_CPU_USAGE_PARAM(INTERVAL_1MIN, CPU_USAGE_USER),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE_USER },
-       { "System.CPU.Usage5.User",            H_CpuUsage,        P(INTERVAL_5MIN, CPU_USAGE_USER),
+       { "System.CPU.Usage5.User",            H_CpuUsage,        MAKE_CPU_USAGE_PARAM(INTERVAL_5MIN, CPU_USAGE_USER),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE5_USER },
-       { "System.CPU.Usage15.User",           H_CpuUsage,        P(INTERVAL_15MIN, CPU_USAGE_USER),
+       { "System.CPU.Usage15.User",           H_CpuUsage,        MAKE_CPU_USAGE_PARAM(INTERVAL_15MIN, CPU_USAGE_USER),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE15_USER },
-       { "System.CPU.Usage.User(*)",          H_CpuUsageEx,      P(INTERVAL_1MIN, CPU_USAGE_USER),
+       { "System.CPU.Usage.User(*)",          H_CpuUsageEx,      MAKE_CPU_USAGE_PARAM(INTERVAL_1MIN, CPU_USAGE_USER),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE_USER_EX },
-       { "System.CPU.Usage5.User(*)",         H_CpuUsageEx,      P(INTERVAL_5MIN, CPU_USAGE_USER),
+       { "System.CPU.Usage5.User(*)",         H_CpuUsageEx,      MAKE_CPU_USAGE_PARAM(INTERVAL_5MIN, CPU_USAGE_USER),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE5_USER_EX },
-       { "System.CPU.Usage15.User(*)",        H_CpuUsageEx,      P(INTERVAL_15MIN, CPU_USAGE_USER),
+       { "System.CPU.Usage15.User(*)",        H_CpuUsageEx,      MAKE_CPU_USAGE_PARAM(INTERVAL_15MIN, CPU_USAGE_USER),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE15_USER_EX },
 
        /* nice */
-       { "System.CPU.Usage.Nice",             H_CpuUsage,        P(INTERVAL_1MIN, CPU_USAGE_NICE),
+       { "System.CPU.Usage.Nice",             H_CpuUsage,        MAKE_CPU_USAGE_PARAM(INTERVAL_1MIN, CPU_USAGE_NICE),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE_NICE },
-       { "System.CPU.Usage5.Nice",            H_CpuUsage,        P(INTERVAL_5MIN, CPU_USAGE_NICE),
+       { "System.CPU.Usage5.Nice",            H_CpuUsage,        MAKE_CPU_USAGE_PARAM(INTERVAL_5MIN, CPU_USAGE_NICE),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE5_NICE },
-       { "System.CPU.Usage15.Nice",           H_CpuUsage,        P(INTERVAL_15MIN, CPU_USAGE_NICE),
+       { "System.CPU.Usage15.Nice",           H_CpuUsage,        MAKE_CPU_USAGE_PARAM(INTERVAL_15MIN, CPU_USAGE_NICE),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE15_NICE },
-       { "System.CPU.Usage.Nice(*)",          H_CpuUsageEx,      P(INTERVAL_1MIN, CPU_USAGE_NICE),
+       { "System.CPU.Usage.Nice(*)",          H_CpuUsageEx,      MAKE_CPU_USAGE_PARAM(INTERVAL_1MIN, CPU_USAGE_NICE),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE_NICE_EX },
-       { "System.CPU.Usage5.Nice(*)",         H_CpuUsageEx,      P(INTERVAL_5MIN, CPU_USAGE_NICE),
+       { "System.CPU.Usage5.Nice(*)",         H_CpuUsageEx,      MAKE_CPU_USAGE_PARAM(INTERVAL_5MIN, CPU_USAGE_NICE),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE5_NICE_EX },
-       { "System.CPU.Usage15.Nice(*)",        H_CpuUsageEx,      P(INTERVAL_15MIN, CPU_USAGE_NICE),
+       { "System.CPU.Usage15.Nice(*)",        H_CpuUsageEx,      MAKE_CPU_USAGE_PARAM(INTERVAL_15MIN, CPU_USAGE_NICE),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE15_NICE_EX },
 
        /* system */
-       { "System.CPU.Usage.System",             H_CpuUsage,        P(INTERVAL_1MIN, CPU_USAGE_SYSTEM),
+       { "System.CPU.Usage.System",             H_CpuUsage,        MAKE_CPU_USAGE_PARAM(INTERVAL_1MIN, CPU_USAGE_SYSTEM),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE_SYSTEM },
-       { "System.CPU.Usage5.System",            H_CpuUsage,        P(INTERVAL_5MIN, CPU_USAGE_SYSTEM),
+       { "System.CPU.Usage5.System",            H_CpuUsage,        MAKE_CPU_USAGE_PARAM(INTERVAL_5MIN, CPU_USAGE_SYSTEM),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE5_SYSTEM },
-       { "System.CPU.Usage15.System",           H_CpuUsage,        P(INTERVAL_15MIN, CPU_USAGE_SYSTEM),
+       { "System.CPU.Usage15.System",           H_CpuUsage,        MAKE_CPU_USAGE_PARAM(INTERVAL_15MIN, CPU_USAGE_SYSTEM),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE15_SYSTEM },
-       { "System.CPU.Usage.System(*)",          H_CpuUsageEx,      P(INTERVAL_1MIN, CPU_USAGE_SYSTEM),
+       { "System.CPU.Usage.System(*)",          H_CpuUsageEx,      MAKE_CPU_USAGE_PARAM(INTERVAL_1MIN, CPU_USAGE_SYSTEM),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE_SYSTEM_EX },
-       { "System.CPU.Usage5.System(*)",         H_CpuUsageEx,      P(INTERVAL_5MIN, CPU_USAGE_SYSTEM),
+       { "System.CPU.Usage5.System(*)",         H_CpuUsageEx,      MAKE_CPU_USAGE_PARAM(INTERVAL_5MIN, CPU_USAGE_SYSTEM),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE5_SYSTEM_EX },
-       { "System.CPU.Usage15.System(*)",        H_CpuUsageEx,      P(INTERVAL_15MIN, CPU_USAGE_SYSTEM),
+       { "System.CPU.Usage15.System(*)",        H_CpuUsageEx,      MAKE_CPU_USAGE_PARAM(INTERVAL_15MIN, CPU_USAGE_SYSTEM),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE15_SYSTEM_EX },
 
        /* idle */
-       { "System.CPU.Usage.Idle",             H_CpuUsage,        P(INTERVAL_1MIN, CPU_USAGE_IDLE),
+       { "System.CPU.Usage.Idle",             H_CpuUsage,        MAKE_CPU_USAGE_PARAM(INTERVAL_1MIN, CPU_USAGE_IDLE),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE_IDLE },
-       { "System.CPU.Usage5.Idle",            H_CpuUsage,        P(INTERVAL_5MIN, CPU_USAGE_IDLE),
+       { "System.CPU.Usage5.Idle",            H_CpuUsage,        MAKE_CPU_USAGE_PARAM(INTERVAL_5MIN, CPU_USAGE_IDLE),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE5_IDLE },
-       { "System.CPU.Usage15.Idle",           H_CpuUsage,        P(INTERVAL_15MIN, CPU_USAGE_IDLE),
+       { "System.CPU.Usage15.Idle",           H_CpuUsage,        MAKE_CPU_USAGE_PARAM(INTERVAL_15MIN, CPU_USAGE_IDLE),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE15_IDLE },
-       { "System.CPU.Usage.Idle(*)",          H_CpuUsageEx,      P(INTERVAL_1MIN, CPU_USAGE_IDLE),
+       { "System.CPU.Usage.Idle(*)",          H_CpuUsageEx,      MAKE_CPU_USAGE_PARAM(INTERVAL_1MIN, CPU_USAGE_IDLE),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE_IDLE_EX },
-       { "System.CPU.Usage5.Idle5(*)",         H_CpuUsageEx,      P(INTERVAL_5MIN, CPU_USAGE_IDLE),
+       { "System.CPU.Usage5.Idle5(*)",         H_CpuUsageEx,      MAKE_CPU_USAGE_PARAM(INTERVAL_5MIN, CPU_USAGE_IDLE),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE5_IDLE_EX },
-       { "System.CPU.Usage15.Idle(*)",        H_CpuUsageEx,      P(INTERVAL_15MIN, CPU_USAGE_IDLE),
+       { "System.CPU.Usage15.Idle(*)",        H_CpuUsageEx,      MAKE_CPU_USAGE_PARAM(INTERVAL_15MIN, CPU_USAGE_IDLE),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE15_IDLE_EX },
 
        /* iowait */
-       { "System.CPU.Usage.IoWait",             H_CpuUsage,        P(INTERVAL_1MIN, CPU_USAGE_IOWAIT),
+       { "System.CPU.Usage.IoWait",             H_CpuUsage,        MAKE_CPU_USAGE_PARAM(INTERVAL_1MIN, CPU_USAGE_IOWAIT),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE_IOWAIT },
-       { "System.CPU.Usage5.IoWait",            H_CpuUsage,        P(INTERVAL_5MIN, CPU_USAGE_IOWAIT),
+       { "System.CPU.Usage5.IoWait",            H_CpuUsage,        MAKE_CPU_USAGE_PARAM(INTERVAL_5MIN, CPU_USAGE_IOWAIT),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE5_IOWAIT },
-       { "System.CPU.Usage15.IoWait",           H_CpuUsage,        P(INTERVAL_15MIN, CPU_USAGE_IOWAIT),
+       { "System.CPU.Usage15.IoWait",           H_CpuUsage,        MAKE_CPU_USAGE_PARAM(INTERVAL_15MIN, CPU_USAGE_IOWAIT),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE15_IOWAIT },
-       { "System.CPU.Usage.IoWait(*)",          H_CpuUsageEx,      P(INTERVAL_1MIN, CPU_USAGE_IOWAIT),
+       { "System.CPU.Usage.IoWait(*)",          H_CpuUsageEx,      MAKE_CPU_USAGE_PARAM(INTERVAL_1MIN, CPU_USAGE_IOWAIT),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE_IOWAIT_EX },
-       { "System.CPU.Usage5.IoWait(*)",         H_CpuUsageEx,      P(INTERVAL_5MIN, CPU_USAGE_IOWAIT),
+       { "System.CPU.Usage5.IoWait(*)",         H_CpuUsageEx,      MAKE_CPU_USAGE_PARAM(INTERVAL_5MIN, CPU_USAGE_IOWAIT),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE5_IOWAIT_EX },
-       { "System.CPU.Usage15.IoWait(*)",        H_CpuUsageEx,      P(INTERVAL_15MIN, CPU_USAGE_IOWAIT),
+       { "System.CPU.Usage15.IoWait(*)",        H_CpuUsageEx,      MAKE_CPU_USAGE_PARAM(INTERVAL_15MIN, CPU_USAGE_IOWAIT),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE15_IOWAIT_EX },
 
        /* irq */
-       { "System.CPU.Usage.Irq",             H_CpuUsage,        P(INTERVAL_1MIN, CPU_USAGE_IRQ),
+       { "System.CPU.Usage.Irq",             H_CpuUsage,        MAKE_CPU_USAGE_PARAM(INTERVAL_1MIN, CPU_USAGE_IRQ),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE_IRQ },
-       { "System.CPU.Usage5.Irq",            H_CpuUsage,        P(INTERVAL_5MIN, CPU_USAGE_IRQ),
+       { "System.CPU.Usage5.Irq",            H_CpuUsage,        MAKE_CPU_USAGE_PARAM(INTERVAL_5MIN, CPU_USAGE_IRQ),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE5_IRQ },
-       { "System.CPU.Usage15.Irq",           H_CpuUsage,        P(INTERVAL_15MIN, CPU_USAGE_IRQ),
+       { "System.CPU.Usage15.Irq",           H_CpuUsage,        MAKE_CPU_USAGE_PARAM(INTERVAL_15MIN, CPU_USAGE_IRQ),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE15_IRQ },
-       { "System.CPU.Usage.Irq(*)",          H_CpuUsageEx,      P(INTERVAL_1MIN, CPU_USAGE_IRQ),
+       { "System.CPU.Usage.Irq(*)",          H_CpuUsageEx,      MAKE_CPU_USAGE_PARAM(INTERVAL_1MIN, CPU_USAGE_IRQ),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE_IRQ_EX },
-       { "System.CPU.Usage5.Irq(*)",         H_CpuUsageEx,      P(INTERVAL_5MIN, CPU_USAGE_IRQ),
+       { "System.CPU.Usage5.Irq(*)",         H_CpuUsageEx,      MAKE_CPU_USAGE_PARAM(INTERVAL_5MIN, CPU_USAGE_IRQ),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE5_IRQ_EX },
-       { "System.CPU.Usage15.Irq(*)",        H_CpuUsageEx,      P(INTERVAL_15MIN, CPU_USAGE_IRQ),
+       { "System.CPU.Usage15.Irq(*)",        H_CpuUsageEx,      MAKE_CPU_USAGE_PARAM(INTERVAL_15MIN, CPU_USAGE_IRQ),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE15_IRQ_EX },
 
        /* softirq */
-       { "System.CPU.Usage.SoftIrq",             H_CpuUsage,        P(INTERVAL_1MIN, CPU_USAGE_SOFTIRQ),
+       { "System.CPU.Usage.SoftIrq",             H_CpuUsage,        MAKE_CPU_USAGE_PARAM(INTERVAL_1MIN, CPU_USAGE_SOFTIRQ),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE_SOFTIRQ },
-       { "System.CPU.Usage5.SoftIrq",            H_CpuUsage,        P(INTERVAL_5MIN, CPU_USAGE_SOFTIRQ),
+       { "System.CPU.Usage5.SoftIrq",            H_CpuUsage,        MAKE_CPU_USAGE_PARAM(INTERVAL_5MIN, CPU_USAGE_SOFTIRQ),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE5_SOFTIRQ },
-       { "System.CPU.Usage15.SoftIrq",           H_CpuUsage,        P(INTERVAL_15MIN, CPU_USAGE_SOFTIRQ),
+       { "System.CPU.Usage15.SoftIrq",           H_CpuUsage,        MAKE_CPU_USAGE_PARAM(INTERVAL_15MIN, CPU_USAGE_SOFTIRQ),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE15_SOFTIRQ },
-       { "System.CPU.Usage.SoftIrq(*)",          H_CpuUsageEx,      P(INTERVAL_1MIN, CPU_USAGE_SOFTIRQ),
+       { "System.CPU.Usage.SoftIrq(*)",          H_CpuUsageEx,      MAKE_CPU_USAGE_PARAM(INTERVAL_1MIN, CPU_USAGE_SOFTIRQ),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE_SOFTIRQ_EX },
-       { "System.CPU.Usage5.SoftIrq(*)",         H_CpuUsageEx,      P(INTERVAL_5MIN, CPU_USAGE_SOFTIRQ),
+       { "System.CPU.Usage5.SoftIrq(*)",         H_CpuUsageEx,      MAKE_CPU_USAGE_PARAM(INTERVAL_5MIN, CPU_USAGE_SOFTIRQ),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE5_SOFTIRQ_EX },
-       { "System.CPU.Usage15.SoftIrq(*)",        H_CpuUsageEx,      P(INTERVAL_15MIN, CPU_USAGE_SOFTIRQ),
+       { "System.CPU.Usage15.SoftIrq(*)",        H_CpuUsageEx,      MAKE_CPU_USAGE_PARAM(INTERVAL_15MIN, CPU_USAGE_SOFTIRQ),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE15_SOFTIRQ_EX },
 
        /* steal */
-       { "System.CPU.Usage.Steal",             H_CpuUsage,        P(INTERVAL_1MIN, CPU_USAGE_STEAL),
+       { "System.CPU.Usage.Steal",             H_CpuUsage,        MAKE_CPU_USAGE_PARAM(INTERVAL_1MIN, CPU_USAGE_STEAL),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE_STEAL },
-       { "System.CPU.Usage5.Steal",            H_CpuUsage,        P(INTERVAL_5MIN, CPU_USAGE_STEAL),
+       { "System.CPU.Usage5.Steal",            H_CpuUsage,        MAKE_CPU_USAGE_PARAM(INTERVAL_5MIN, CPU_USAGE_STEAL),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE5_STEAL },
-       { "System.CPU.Usage15.Steal",           H_CpuUsage,        P(INTERVAL_15MIN, CPU_USAGE_STEAL),
+       { "System.CPU.Usage15.Steal",           H_CpuUsage,        MAKE_CPU_USAGE_PARAM(INTERVAL_15MIN, CPU_USAGE_STEAL),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE15_STEAL },
-       { "System.CPU.Usage.Steal(*)",          H_CpuUsageEx,      P(INTERVAL_1MIN, CPU_USAGE_STEAL),
+       { "System.CPU.Usage.Steal(*)",          H_CpuUsageEx,      MAKE_CPU_USAGE_PARAM(INTERVAL_1MIN, CPU_USAGE_STEAL),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE_STEAL_EX },
-       { "System.CPU.Usage5.Steal(*)",         H_CpuUsageEx,      P(INTERVAL_5MIN, CPU_USAGE_STEAL),
+       { "System.CPU.Usage5.Steal(*)",         H_CpuUsageEx,      MAKE_CPU_USAGE_PARAM(INTERVAL_5MIN, CPU_USAGE_STEAL),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE5_STEAL_EX },
-       { "System.CPU.Usage15.Steal(*)",        H_CpuUsageEx,      P(INTERVAL_15MIN, CPU_USAGE_STEAL),
+       { "System.CPU.Usage15.Steal(*)",        H_CpuUsageEx,      MAKE_CPU_USAGE_PARAM(INTERVAL_15MIN, CPU_USAGE_STEAL),
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_USAGE15_STEAL_EX },
 
-#undef P
-
        /**************************************************************/
        { "System.Hostname",              H_Hostname,        NULL,
                DCI_DT_STRING,  DCIDESC_SYSTEM_HOSTNAME },
diff --git a/src/agent/subagents/linux/linux_subagent.h b/src/agent/subagents/linux/linux_subagent.h
new file mode 100644 (file)
index 0000000..ceeda5f
--- /dev/null
@@ -0,0 +1,215 @@
+/* 
+** NetXMS subagent for GNU/Linux
+** Copyright (C) 2004-2009 Alex Kirhenshtein and Victor Kirhenshtein
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+**
+**/
+
+#ifndef __LINUX_SUBAGENT_H__
+#define __LINUX_SUBAGENT_H__
+
+
+#include <nms_common.h>
+#include <nms_agent.h>
+
+#include <locale.h>
+#include <sys/utsname.h>
+#include <sys/statvfs.h>
+#include <utmp.h>
+#include <paths.h>
+#include <mntent.h>
+#include <sys/vfs.h>
+#include <sys/ioctl.h>
+#include <net/if.h>
+
+
+//
+// Attributes for H_ProcInfo
+//
+
+enum
+{
+       PROCINFO_CPUTIME,
+       PROCINFO_KTIME,
+       PROCINFO_PAGEFAULTS,
+       PROCINFO_THREADS,
+       PROCINFO_UTIME,
+       PROCINFO_VMSIZE,
+       PROCINFO_WKSET
+};
+
+#define INFOTYPE_MIN             0
+#define INFOTYPE_MAX             1
+#define INFOTYPE_AVG             2
+#define INFOTYPE_SUM             3
+
+
+//
+// Process entry
+//
+
+typedef struct t_ProcEnt
+{
+       unsigned int nPid;
+       char szProcName[128];
+       int parent;                                     // PID of parent process
+       int group;                                      // Group ID
+       char state;                                     // Process state
+       long threads;                           // Number of threads
+       unsigned long ktime;            // Number of ticks spent in kernel mode
+       unsigned long utime;            // Number of ticks spent in user mode
+       unsigned long vmsize;   // Size of process's virtual memory in bytes
+       long rss;                                       // Process's resident set size in pages
+       unsigned long minflt;   // Number of minor page faults
+       unsigned long majflt;   // Number of major page faults
+} PROC_ENT;
+
+
+//
+// FS info types
+//
+
+enum
+{
+       DISK_FREE,
+       DISK_AVAIL,
+       DISK_USED,
+       DISK_TOTAL,
+       DISK_FREE_PERC,
+       DISK_AVAIL_PERC,
+       DISK_USED_PERC
+};
+
+
+//
+// Network interface stats
+//
+
+#define IF_INFO_ADMIN_STATUS     0
+#define IF_INFO_OPER_STATUS      1
+#define IF_INFO_BYTES_IN         2
+#define IF_INFO_BYTES_OUT        3
+#define IF_INFO_DESCRIPTION      4
+#define IF_INFO_IN_ERRORS        5
+#define IF_INFO_OUT_ERRORS       6
+#define IF_INFO_PACKETS_IN       7
+#define IF_INFO_PACKETS_OUT      8
+#define IF_INFO_SPEED            9
+
+
+//
+// Memory stats
+//
+
+enum
+{
+       PHYSICAL_FREE,
+       PHYSICAL_FREE_PCT,
+       PHYSICAL_USED,
+       PHYSICAL_USED_PCT,
+       PHYSICAL_TOTAL,
+       SWAP_FREE,
+       SWAP_FREE_PCT,
+       SWAP_USED,
+       SWAP_USED_PCT,
+       SWAP_TOTAL,
+       VIRTUAL_FREE,
+       VIRTUAL_FREE_PCT,
+       VIRTUAL_USED,
+       VIRTUAL_USED_PCT,
+       VIRTUAL_TOTAL,
+};
+
+
+//
+// Load average intervals
+//
+
+enum
+{
+       INTERVAL_1MIN,
+       INTERVAL_5MIN,
+       INTERVAL_15MIN,
+};
+
+
+//
+// CPU stats
+//
+
+enum 
+{
+       CPU_USAGE_OVERAL,
+       CPU_USAGE_USER,
+       CPU_USAGE_NICE,
+       CPU_USAGE_SYSTEM,
+       CPU_USAGE_IDLE,
+       CPU_USAGE_IOWAIT,
+       CPU_USAGE_IRQ,
+       CPU_USAGE_SOFTIRQ,
+       CPU_USAGE_STEAL,
+};
+
+#define MAKE_CPU_USAGE_PARAM(interval, source) (const char *)((((DWORD)(interval)) << 16) | ((DWORD)(source)))
+#define CPU_USAGE_PARAM_INTERVAL(p)                                    ((CAST_FROM_POINTER((p), DWORD)) >> 16)
+#define CPU_USAGE_PARAM_SOURCE(p)                                      ((CAST_FROM_POINTER((p), DWORD)) & 0x0000FFFF)
+
+
+//
+// Functions
+//
+
+LONG H_DiskInfo(const char *, const char *, char *);
+
+LONG H_TransferRate(const char *, const char *, char *);
+LONG H_BlockReadRate(const char *, const char *, char *);
+LONG H_BlockWriteRate(const char *, const char *, char *);
+LONG H_BytesReadRate(const char *, const char *, char *);
+LONG H_BytesWriteRate(const char *, const char *, char *);
+LONG H_DiskQueue(const char *, const char *, char *);
+LONG H_DiskTime(const char *, const char *, char *);
+
+LONG H_NetIfInfoFromIOCTL(const char *, const char *, char *);
+LONG H_NetIfInfoFromProc(const char *, const char *, char *);
+LONG H_NetIpForwarding(const char *, const char *, char *);
+LONG H_NetArpCache(const char *, const char *, NETXMS_VALUES_LIST *);
+LONG H_NetRoutingTable(const char *, const char *, NETXMS_VALUES_LIST *);
+LONG H_NetIfList(const char *, const char *, NETXMS_VALUES_LIST *);
+
+LONG H_ProcessList(const char *, const char *, NETXMS_VALUES_LIST *);
+LONG H_Uptime(const char *, const char *, char *);
+LONG H_Uname(const char *, const char *, char *);
+LONG H_Hostname(const char *, const char *, char *);
+LONG H_Hostname(const char *, const char *, char *);
+LONG H_CpuCount(const char *, const char *, char *);
+LONG H_CpuLoad(const char *, const char *, char *);
+LONG H_CpuUsage(const char *, const char *, char *);
+LONG H_CpuUsageEx(const char *, const char *, char *);
+LONG H_ProcessCount(const char *, const char *, char *);
+LONG H_ProcessDetails(const char *, const char *, char *);
+LONG H_ThreadCount(const char *, const char *, char *);
+LONG H_MemoryInfo(const char *, const char *, char *);
+LONG H_SourcePkgSupport(const char *, const char *, char *);
+LONG H_ConnectedUsers(const char *, const char *, char *);
+LONG H_ActiveUserSessions(const char *, const char *, NETXMS_VALUES_LIST *);
+
+void StartCpuUsageCollector(void);
+void ShutdownCpuUsageCollector(void);
+
+int ProcRead(PROC_ENT **pEnt, char *szProcName, char *szCmdLine);
+
+#endif // __LINUX_SUBAGENT_H__
+
index 6630979..aa1201a 100644 (file)
 **
 **/
 
-#include <nms_common.h>
-#include <nms_agent.h>
-
-//#include <linux/sysctl.h>
-#include <stdio.h>
-#include <sys/ioctl.h>
-#include <stdlib.h>
-#include <string.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <net/if.h>
-
-#include "net.h"
+#include <linux_subagent.h>
 
 
 LONG H_NetIpForwarding(const char *pszParam, const char *pArg, char *pValue)
@@ -190,7 +178,7 @@ LONG H_NetRoutingTable(const char *pszParam, const char *pArg, NETXMS_VALUES_LIS
                        {
                                char szIF[64];
                                int nTmp, nType = 0;
-                               unsigned long nDestination, nGateway, nMask;
+                               unsigned int nDestination, nGateway, nMask;
 
                                if (sscanf(szLine,
                                                        "%s\t%08X\t%08X\t%d\t%d\t%d\t%d\t%08X",
diff --git a/src/agent/subagents/linux/net.h b/src/agent/subagents/linux/net.h
deleted file mode 100644 (file)
index d50c89a..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/* $Id$ */
-
-/* 
-** NetXMS subagent for GNU/Linux
-** Copyright (C) 2004 Alex Kirhenshtein
-**
-** This program is free software; you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation; either version 2 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
-** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-**
-**/
-
-#ifndef __NET_H__
-#define __NET_H__
-
-#define IF_INFO_ADMIN_STATUS     0
-#define IF_INFO_OPER_STATUS      1
-#define IF_INFO_BYTES_IN         2
-#define IF_INFO_BYTES_OUT        3
-#define IF_INFO_DESCRIPTION      4
-#define IF_INFO_IN_ERRORS        5
-#define IF_INFO_OUT_ERRORS       6
-#define IF_INFO_PACKETS_IN       7
-#define IF_INFO_PACKETS_OUT      8
-#define IF_INFO_SPEED            9
-
-
-LONG H_NetIfInfoFromIOCTL(const char *, const char *, char *);
-LONG H_NetIfInfoFromProc(const char *, const char *, char *);
-LONG H_NetIpForwarding(const char *, const char *, char *);
-LONG H_NetArpCache(const char *, const char *, NETXMS_VALUES_LIST *);
-LONG H_NetRoutingTable(const char *, const char *, NETXMS_VALUES_LIST *);
-LONG H_NetIfList(const char *, const char *, NETXMS_VALUES_LIST *);
-
-#endif // __NET_H__
-
-///////////////////////////////////////////////////////////////////////////////
-/*
-
-$Log: not supported by cvs2svn $
-Revision 1.3  2005/06/11 16:28:24  victor
-Implemented all Net.Interface.* parameters except Net.Interface.Speed
-
-Revision 1.2  2005/06/09 12:15:43  victor
-Added support for Net.Interface.AdminStatus and Net.Interface.Link parameters
-
-Revision 1.1  2004/10/22 22:08:34  alk
-source restructured;
-implemented:
-       Net.IP.Forwarding
-       Net.IP6.Forwarding
-       Process.Count(*)
-       Net.ArpCache
-       Net.InterfaceList (if-type not implemented yet)
-       System.ProcessList
-
-
-*/
index ffa4031..828e988 100644 (file)
 **
 **/
 
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <dirent.h>
-#include <nms_util.h>
+#include "linux_subagent.h"
 
-#include "proc.h"
 
+//
+// Filter for reading only pid directories from /proc
+//
 
 static int ProcFilter(const struct dirent *pEnt)
 {
@@ -52,14 +49,30 @@ static int ProcFilter(const struct dirent *pEnt)
        return 1;
 }
 
+
+//
+// Read process information from /proc system
+// Parameters:
+//    pEnt - If not NULL, ProcRead() will return pointer to dynamically
+//           allocated array of process information structures for
+//           matched processes. Caller should free it with free().
+//    szProcName - If not NULL, only processes with matched name will
+//                 be counted and read. If szCmdLine is NULL, then exact
+//                 match required to pass filter; otherwise szProcName can
+//                 be a regular expression.
+//    szCmdLine - If not NULL, only processes with command line matched to
+//                regular expression will be counted and read.
+// Return value: number of matched processes or -1 in case of error.
+//
+
 int ProcRead(PROC_ENT **pEnt, char *szProcName, char *szCmdLine)
 {
        struct dirent **pNameList;
        int nCount, nFound;
        BOOL bProcFound, bCmdFound;
-       BOOL bIgnoreCase = TRUE;
 
        nFound = -1;
+       NxWriteAgentLog(EVENTLOG_DEBUG_TYPE, "ProcRead(%p,\"%s\",\"%s\")", pEnt, CHECK_NULL(szProcName), CHECK_NULL(szCmdLine));
 
        nCount = scandir("/proc", &pNameList, &ProcFilter, alphasort);
        // if everything is null we can simply return nCount!!!
@@ -105,8 +118,9 @@ int ProcRead(PROC_ENT **pEnt, char *szProcName, char *szCmdLine)
                        bProcFound = bCmdFound = FALSE;
                        char szFileName[512];
                        FILE *hFile;
+                       char szProcStat[1024] = {0}; 
                        char szBuff[1024] = {0}; 
-                       char *pProcName = NULL;
+                       char *pProcName = NULL, *pProcStat = NULL;
                        unsigned long nPid;
 
                        snprintf(szFileName, sizeof(szFileName),
@@ -114,24 +128,25 @@ int ProcRead(PROC_ENT **pEnt, char *szProcName, char *szCmdLine)
                        hFile = fopen(szFileName, "r");
                        if (hFile != NULL)
                        {
-                               if (fgets(szBuff, sizeof(szBuff), hFile) != NULL)
+                               if (fgets(szProcStat, sizeof(szProcStat), hFile) != NULL)
                                {
-                                       if (sscanf(szBuff, "%lu ", &nPid) == 1)
+                                       if (sscanf(szProcStat, "%lu ", &nPid) == 1)
                                        {
-                                               pProcName = strchr(szBuff, ')');
+                                               pProcName = strchr(szProcStat, ')');
                                                if (pProcName != NULL)
                                                {
-                                                       *pProcName = 0;
-                                                       pProcName =  strchr(szBuff, '(');
+                                                       pProcStat = pProcName + 1;
+                                                       *pProcName = 0;                                                 
+                                                       pProcName =  strchr(szProcStat, '(');
                                                        if (pProcName != NULL)
                                                        {
                                                                pProcName++;
-                                                               if (szProcName != NULL)
+                                                               if ((szProcName != NULL) && (*szProcName != 0))
                                                                {
                                                                        if (szCmdLine == NULL) // use old style compare
-                                                                               bProcFound = strcasecmp(pProcName, szProcName) == 0;
+                                                                               bProcFound = strcmp(pProcName, szProcName) == 0;
                                                                        else
-                                                                               bProcFound = RegexpMatch(pProcName, szProcName, bIgnoreCase);
+                                                                               bProcFound = RegexpMatch(pProcName, szProcName, FALSE);
                                                                }
                                                                else
                                                                {
@@ -144,44 +159,46 @@ int ProcRead(PROC_ENT **pEnt, char *szProcName, char *szCmdLine)
                                fclose(hFile);
                        } // hFile
 
-                       if (szCmdLine != NULL)
+                       if ((szCmdLine != NULL) && (*szCmdLine != 0))
                        {
                                snprintf(szFileName, sizeof(szFileName),
                                                "/proc/%s/cmdline", pNameList[nCount]->d_name);
                                hFile = fopen(szFileName, "r");
                                if (hFile != NULL)
                                {
-                                       char szBuff[1024];
-                                       memset(szBuff, 0, sizeof(szBuff));
+                                       char processCmdLine[1024];
+                                       memset(processCmdLine, 0, sizeof(processCmdLine));
 
-                                       int len = fread(szBuff, 1, sizeof(szBuff) - 1, hFile);
+                                       int len = fread(processCmdLine, 1, sizeof(processCmdLine) - 1, hFile);
                                        if (len > 0) // got a valid record in format: argv[0]\x00argv[1]\x00...
                                        {
                                                int j;
-                                               char *pArgs;
+                                               //char *pArgs;
 
+                                               /* Commented out by victor: to behave identicaly on different platforms,
+                                                  argv[0] should be matched as well
                                                j = strlen(szBuff) + 1;
                                                pArgs = szBuff + j; // skip first (argv[0])
-                                               len -= j;
+                                               len -= j;*/
                                                // replace 0x00 with spaces
-                                               for (j = 0; j < len - 1; j++)
+                                               for(j = 0; j < len - 1; j++)
                                                {
-                                                       if (pArgs[j] == 0)
+                                                       if (processCmdLine[j] == 0)
                                                        {
-                                                               pArgs[j] = ' ';
+                                                               processCmdLine[j] = ' ';
                                                        }
                                                }
-                                               bCmdFound = RegexpMatch(pArgs, szCmdLine, bIgnoreCase);
+                                               bCmdFound = RegexpMatch(processCmdLine, szCmdLine, TRUE);
                                        }
                                        else
                                        {
-                                               bCmdFound = RegexpMatch("", szCmdLine, bIgnoreCase);
+                                               bCmdFound = RegexpMatch("", szCmdLine, TRUE);
                                        }
                                        fclose(hFile);
                                } // hFile != NULL
                                else
                                {
-                                       bCmdFound = RegexpMatch("", szCmdLine, bIgnoreCase);
+                                       bCmdFound = RegexpMatch("", szCmdLine, TRUE);
                                }
                        } // szCmdLine
                        else
@@ -191,12 +208,25 @@ int ProcRead(PROC_ENT **pEnt, char *szProcName, char *szCmdLine)
 
                        if (bProcFound && bCmdFound)
                        {
-                               nFound++;
-                               if (pEnt != NULL && pProcName != NULL )
+                               if (pEnt != NULL && pProcName != NULL)
                                {
                                        (*pEnt)[nFound].nPid = nPid;
                                        nx_strncpy((*pEnt)[nFound].szProcName, pProcName, sizeof((*pEnt)[nFound].szProcName));
+
+                                       // Parse rest of /proc/pid/stat file
+                                       if (pProcStat != NULL)
+                                       {
+                                               if (sscanf(pProcStat, " %c %d %d %*d %*d %*d %*u %lu %*u %lu %*u %lu %lu %*u %*u %*d %*d %ld %*d %*u %lu %ld ",
+                                                          &(*pEnt)[nFound].state, &(*pEnt)[nFound].parent, &(*pEnt)[nFound].group,
+                                                          &(*pEnt)[nFound].minflt, &(*pEnt)[nFound].majflt,
+                                                          &(*pEnt)[nFound].utime, &(*pEnt)[nFound].ktime, &(*pEnt)[nFound].threads,
+                                                          &(*pEnt)[nFound].vmsize, &(*pEnt)[nFound].rss) != 10)
+                                               {
+                                                       NxWriteAgentLog(EVENTLOG_DEBUG_TYPE, "Error parsing /proc/%d/stat", nPid);
+                                               }
+                                       }
                                }
+                               nFound++;
                        }
 
                        free(pNameList[nCount]);
@@ -207,43 +237,162 @@ int ProcRead(PROC_ENT **pEnt, char *szProcName, char *szCmdLine)
        return nFound;
 }
 
-///////////////////////////////////////////////////////////////////////////////
-/*
 
-$Log: not supported by cvs2svn $
-Revision 1.9  2007/04/24 11:58:24  alk
-Process.CountEx() fixed
+//
+// Handler for System.ProcessCount, Process.Count() and Process,CountEx() parameters
+//
 
-Revision 1.8  2007/01/22 09:16:43  victor
-Fixed bug in Process.CountEx()
+LONG H_ProcessCount(const char *pszParam, const char *pArg, char *pValue)
+{
+       int nRet = SYSINFO_RC_ERROR;
+       char szArg[128] = "", szCmdLine[128] = "";
+       int nCount = -1;
 
-Revision 1.7  2007/01/15 00:25:07  victor
-Minor fix
+       if (*pArg != 'T')
+       {
+               NxGetParameterArg(pszParam, 1, szArg, sizeof(szArg));
+               if (*pArg == 'E')
+               {
+                       NxGetParameterArg(pszParam, 2, szCmdLine, sizeof(szCmdLine));
+               }
+       }
 
-Revision 1.6  2007/01/15 00:16:07  victor
-Implemented Process.CountEx for Linux
+       nCount = ProcRead(NULL, (*pArg != 'T') ? szArg : NULL, (*pArg == 'E') ? szCmdLine : NULL);
 
-Revision 1.5  2005/11/04 23:00:07  victor
-Fixed some 64bit portability issues
+       if (nCount >= 0)
+       {
+               ret_int(pValue, nCount);
+               nRet = SYSINFO_RC_SUCCESS;
+       }
 
-Revision 1.4  2005/10/27 08:24:06  victor
-Minor changes
+       return nRet;
+}
 
-Revision 1.3  2005/10/17 20:45:46  victor
-Fixed incorrect usage of strncpy
 
-Revision 1.2  2005/01/18 17:09:33  alk
-process name matching chaged from patern to exact match
+//
+// Handler for System.ThreadCount parameter
+//
 
-Revision 1.1  2004/10/22 22:08:34  alk
-source restructured;
-implemented:
-        Net.IP.Forwarding
-        Net.IP6.Forwarding
-        Process.Count(*)
-        Net.ArpCache
-        Net.InterfaceList (if-type not implemented yet)
-        System.ProcessList
+LONG H_ThreadCount(const char *param, const char *arg, char *value)
+{
+       int i, sum, count, ret = SYSINFO_RC_ERROR;
+       PROC_ENT *procList;
 
+       count = ProcRead(&procList, NULL, NULL);
+       if (count >= 0)
+       {
+               for(i = 0, sum = 0; i < count; i++)
+                       sum += procList[i].threads;
+               ret_int(value, sum);
+               ret = SYSINFO_RC_SUCCESS;
+       }
+
+       return ret;
+}
+
+
+//
+// Handler for Process.xxx() parameters
+// Parameter has the following syntax:
+//    Process.XXX(<process>,<type>,<cmdline>)
+// where
+//    XXX        - requested process attribute (see documentation for list of valid attributes)
+//    <process>  - process name (same as in Process.Count() parameter)
+//    <type>     - representation type (meaningful when more than one process with the same
+//                 name exists). Valid values are:
+//         min - minimal value among all processes named <process>
+//         max - maximal value among all processes named <process>
+//         avg - average value for all processes named <process>
+//         sum - sum of values for all processes named <process>
+//    <cmdline>  - command line
+//
+
+LONG H_ProcessDetails(const char *param, const char *arg, char *value)
+{
+       int i, count, type;
+       long pageSize, ticksPerSecond;
+       INT64 currVal, finalVal;
+       PROC_ENT *procList;
+       char procName[MAX_PATH], cmdLine[MAX_PATH], buffer[256];
+   static const char *typeList[]={ "min", "max", "avg", "sum", NULL };
+
+   // Get parameter type arguments
+   NxGetParameterArg(param, 2, buffer, 256);
+   if (buffer[0] == 0)     // Omited type
+   {
+      type = INFOTYPE_SUM;
+   }
+   else
+   {
+      for(type = 0; typeList[type] != NULL; type++)
+         if (!stricmp(typeList[type], buffer))
+            break;
+      if (typeList[type] == NULL)
+         return SYSINFO_RC_UNSUPPORTED;     // Unsupported type
+   }
+
+   // Get process name
+   NxGetParameterArg(param, 1, procName, MAX_PATH);
+       NxGetParameterArg(param, 3, cmdLine, MAX_PATH);
+       StrStrip(cmdLine);
+
+       count = ProcRead(&procList, procName, (cmdLine[0] != 0) ? cmdLine : NULL);
+       NxWriteAgentLog(EVENTLOG_DEBUG_TYPE, "H_ProcessDetails(\"%s\"): ProcRead() returns %d", param, count);
+       if (count == -1)
+               return SYSINFO_RC_ERROR;
+
+       pageSize = getpagesize();
+       ticksPerSecond = sysconf(_SC_CLK_TCK);
+       for(i = 0, finalVal = 0; i < count; i++)
+       {
+               switch(CAST_FROM_POINTER(arg, int))
+               {
+                       case PROCINFO_CPUTIME:
+                               currVal = (procList[i].ktime + procList[i].utime) * 1000 / ticksPerSecond;
+                               break;
+                       case PROCINFO_KTIME:
+                               currVal = procList[i].ktime * 1000 / ticksPerSecond;
+                               break;
+                       case PROCINFO_UTIME:
+                               currVal = procList[i].utime * 1000 / ticksPerSecond;
+                               break;
+                       case PROCINFO_PAGEFAULTS:
+                               currVal = procList[i].majflt + procList[i].minflt;
+                               break;
+                       case PROCINFO_THREADS:
+                               currVal = procList[i].threads;
+                               break;
+                       case PROCINFO_VMSIZE:
+                               currVal = procList[i].vmsize;
+                               break;
+                       case PROCINFO_WKSET:
+                               currVal = procList[i].rss * pageSize;
+                               break;
+                       default:
+                               currVal = 0;
+                               break;
+               }
+
+               switch(type)
+               {
+                       case INFOTYPE_SUM:
+                       case INFOTYPE_AVG:
+                               finalVal += currVal;
+                               break;
+                       case INFOTYPE_MIN:
+                               finalVal = min(currVal, finalVal);
+                               break;
+                       case INFOTYPE_MAX:
+                               finalVal = max(currVal, finalVal);
+                               break;
+               }
+       }
+
+       safe_free(procList);
+       if (type == INFOTYPE_AVG)
+               finalVal /= count;
+
+       ret_int64(value, finalVal);
+       return SYSINFO_RC_SUCCESS;
+}
 
-*/
diff --git a/src/agent/subagents/linux/proc.h b/src/agent/subagents/linux/proc.h
deleted file mode 100644 (file)
index 614e70a..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/* $Id$ */
-
-/* 
-** NetXMS subagent for GNU/Linux
-** Copyright (C) 2004 Alex Kirhenshtein
-**
-** This program is free software; you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation; either version 2 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
-** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-**
-**/
-
-#ifndef __PROC_H__
-#define __PROC_H__
-
-typedef struct t_ProcEnt
-{
-       unsigned int nPid;
-       char szProcName[128];
-} PROC_ENT;
-
-int ProcRead(PROC_ENT **pEnt, char *szProcName, char *szCmdLine);
-
-#endif // __PROC_H__
-
-///////////////////////////////////////////////////////////////////////////////
-/*
-
-$Log: not supported by cvs2svn $
-Revision 1.1  2004/10/22 22:08:35  alk
-source restructured;
-implemented:
-       Net.IP.Forwarding
-       Net.IP6.Forwarding
-       Process.Count(*)
-       Net.ArpCache
-       Net.InterfaceList (if-type not implemented yet)
-       System.ProcessList
-
-
-*/
index 6d4f6d0..b5b6ae1 100644 (file)
 **
 **/
 
-#include <nms_common.h>
-#include <nms_agent.h>
-
-#include <locale.h>
-#include <sys/utsname.h>
-#include <sys/statvfs.h>
-#include <utmp.h>
-
-#include "system.h"
-#include "proc.h"
+#include "linux_subagent.h"
 
 
 //
@@ -210,33 +201,6 @@ LONG H_CpuLoad(const char *pszParam, const char *pArg, char *pValue)
        return nRet;
 }
 
-LONG H_ProcessCount(const char *pszParam, const char *pArg, char *pValue)
-{
-       int nRet = SYSINFO_RC_ERROR;
-       struct statvfs s;
-       char szArg[128] = "", szCmdLine[128] = "";
-       int nCount = -1;
-
-       if (*pArg != 'T')
-       {
-               NxGetParameterArg(pszParam, 1, szArg, sizeof(szArg));
-               if (*pArg == 'E')
-               {
-                       NxGetParameterArg(pszParam, 2, szCmdLine, sizeof(szCmdLine));
-               }
-       }
-
-       nCount = ProcRead(NULL, (*pArg != 'T') ? szArg : NULL, (*pArg == 'E') ? szCmdLine : NULL);
-
-       if (nCount >= 0)
-       {
-               ret_int(pValue, nCount);
-               nRet = SYSINFO_RC_SUCCESS;
-       }
-
-       return nRet;
-}
-
 LONG H_MemoryInfo(const char *pszParam, const char *pArg, char *pValue)
 {
        int nRet = SYSINFO_RC_ERROR;
@@ -640,10 +604,9 @@ static void GetUsage(int source, int slot, int count, char *value)
 
 LONG H_CpuUsage(const char *pszParam, const char *pArg, char *pValue)
 {
-       struct CpuUsageParam *p = (struct CpuUsageParam *)pArg;
        int count;
 
-       switch (p->timeInterval)
+       switch(CPU_USAGE_PARAM_INTERVAL(pArg))
        {
                case INTERVAL_5MIN:
                        count = 5 * 60;
@@ -656,7 +619,7 @@ LONG H_CpuUsage(const char *pszParam, const char *pArg, char *pValue)
                        break;
        }
 
-       GetUsage(p->source, 0, count, pValue);
+       GetUsage(CPU_USAGE_PARAM_SOURCE(pArg), 0, count, pValue);
        return SYSINFO_RC_SUCCESS;
 }
 
@@ -673,7 +636,7 @@ LONG H_CpuUsageEx(const char *pszParam, const char *pArg, char *pValue)
        if ((*eptr != 0) || (cpu < 0) || (cpu >= m_maxCPU))
                return SYSINFO_RC_UNSUPPORTED;
 
-       switch (p->timeInterval)
+       switch(CPU_USAGE_PARAM_INTERVAL(pArg))
        {
                case INTERVAL_5MIN:
                        count = 5 * 60;
@@ -686,7 +649,7 @@ LONG H_CpuUsageEx(const char *pszParam, const char *pArg, char *pValue)
                        break;
        }
 
-       GetUsage(p->source, cpu + 1, count, pValue);
+       GetUsage(CPU_USAGE_PARAM_SOURCE(pArg), cpu + 1, count, pValue);
 
        return SYSINFO_RC_SUCCESS;
 }
diff --git a/src/agent/subagents/linux/system.h b/src/agent/subagents/linux/system.h
deleted file mode 100644 (file)
index 376a265..0000000
+++ /dev/null
@@ -1,117 +0,0 @@
-/* $Id$ */
-
-/* 
-** NetXMS subagent for GNU/Linux
-** Copyright (C) 2004 Alex Kirhenshtein
-**
-** This program is free software; you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation; either version 2 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
-** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-**
-**/
-
-#ifndef __SYSTEM_H__
-#define __SYSTEM_H__
-
-enum
-{
-       PHYSICAL_FREE,
-       PHYSICAL_FREE_PCT,
-       PHYSICAL_USED,
-       PHYSICAL_USED_PCT,
-       PHYSICAL_TOTAL,
-       SWAP_FREE,
-       SWAP_FREE_PCT,
-       SWAP_USED,
-       SWAP_USED_PCT,
-       SWAP_TOTAL,
-       VIRTUAL_FREE,
-       VIRTUAL_FREE_PCT,
-       VIRTUAL_USED,
-       VIRTUAL_USED_PCT,
-       VIRTUAL_TOTAL,
-};
-
-enum
-{
-       INTERVAL_1MIN,
-       INTERVAL_5MIN,
-       INTERVAL_15MIN,
-};
-
-enum {
-       CPU_USAGE_OVERAL,
-       CPU_USAGE_USER,
-       CPU_USAGE_NICE,
-       CPU_USAGE_SYSTEM,
-       CPU_USAGE_IDLE,
-       CPU_USAGE_IOWAIT,
-       CPU_USAGE_IRQ,
-       CPU_USAGE_SOFTIRQ,
-       CPU_USAGE_STEAL,
-};
-
-struct CpuUsageParam
-{
-       int timeInterval;
-       int source;
-};
-
-LONG H_ProcessList(const char *, const char *, NETXMS_VALUES_LIST *);
-LONG H_Uptime(const char *, const char *, char *);
-LONG H_Uname(const char *, const char *, char *);
-LONG H_Hostname(const char *, const char *, char *);
-LONG H_Hostname(const char *, const char *, char *);
-LONG H_CpuCount(const char *, const char *, char *);
-LONG H_CpuLoad(const char *, const char *, char *);
-LONG H_CpuUsage(const char *, const char *, char *);
-LONG H_CpuUsageEx(const char *, const char *, char *);
-LONG H_ProcessCount(const char *, const char *, char *);
-LONG H_MemoryInfo(const char *, const char *, char *);
-LONG H_SourcePkgSupport(const char *, const char *, char *);
-LONG H_ConnectedUsers(const char *, const char *, char *);
-LONG H_ActiveUserSessions(const char *, const char *, NETXMS_VALUES_LIST *);
-
-void StartCpuUsageCollector(void);
-void ShutdownCpuUsageCollector(void);
-
-#endif // __SYSTEM_H__
-
-///////////////////////////////////////////////////////////////////////////////
-/*
-
-$Log: not supported by cvs2svn $
-Revision 1.5  2007/10/31 08:14:33  victor
-Added per-CPU usage statistics and System.CPU.Count parameter
-
-Revision 1.4  2006/10/30 17:25:10  victor
-Implemented System.ConnectedUsers and System.ActiveUserSessions
-
-Revision 1.3  2006/03/01 22:13:09  alk
-added System.CPU.Usage [broken]
-
-Revision 1.2  2005/01/17 23:31:01  alk
-Agent.SourcePackageSupport added
-
-Revision 1.1  2004/10/22 22:08:35  alk
-source restructured;
-implemented:
-       Net.IP.Forwarding
-       Net.IP6.Forwarding
-       Process.Count(*)
-       Net.ArpCache
-       Net.InterfaceList (if-type not implemented yet)
-       System.ProcessList
-
-
-*/
index e7e90ce..68b38ec 100644 (file)
@@ -2,9 +2,9 @@ INCLUDES=-I@top_srcdir@/include
 
 lib_LTLIBRARIES = libnsm_logwatch.la
 libnsm_logwatch_la_SOURCES = main.cpp
-libnsm_logwatch_la_LDFLAGS = ../../../libnetxms/libnetxms.la ../../../libnxlp/libnxlp.la
+libnsm_logwatch_la_LIBADD = @top_srcdir@/src/libnetxms/libnetxms.la @top_srcdir@/src/libnxlp/libnxlp.la
 
-EXTRA_DIST = logwatch.h logwatch.dsp logwatch.dsw logwatch.def Makefile.nw \
+EXTRA_DIST = logwatch.h logwatch.vcproj logwatch.def Makefile.nw \
              eventlog.cpp
 
 install-exec-hook:
index f8e3aed..8d3733b 100644 (file)
@@ -254,14 +254,19 @@ static THREAD_RESULT THREAD_CALL NotificationThread(void *arg)
 
 static void ParseEvent(LogParser *parser, EVENTLOGRECORD *rec)
 {
-       TCHAR msg[8192];
+       TCHAR msg[8192], *eventSourceName;
        EventSource *es;
 
-       es = LoadEventSource((TCHAR *)((BYTE *)rec + sizeof(EVENTLOGRECORD)));
+       eventSourceName = (TCHAR *)((BYTE *)rec + sizeof(EVENTLOGRECORD));
+       es = LoadEventSource(eventSourceName);
        if (es != NULL)
        {
                es->FormatMessage(rec, msg, 8192);
-               parser->MatchLine(msg);
+               parser->matchEvent(eventSourceName, rec->EventID & 0x0000FFFF, rec->EventType, msg);
+       }
+       else
+       {
+               NxWriteAgentLog(EVENTLOG_DEBUG_TYPE, _T("LogWatch: unable to load event source \"%s\""), eventSourceName);
        }
 }
 
@@ -282,7 +287,7 @@ THREAD_RESULT THREAD_CALL ParserThreadEventLog(void *arg)
 
    buffer = (BYTE *)malloc(bufferSize);
 
-   hLog = OpenEventLog(NULL, &(parser->GetFileName()[1]));
+   hLog = OpenEventLog(NULL, &(parser->getFileName()[1]));
    if (hLog != NULL)
    {
       nd.hLogEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
@@ -308,7 +313,7 @@ THREAD_RESULT THREAD_CALL ParserThreadEventLog(void *arg)
                        handles[0] = nd.hWakeupEvent;
                        handles[1] = g_hCondShutdown;
                        NxWriteAgentLog(EVENTLOG_DEBUG_TYPE, _T("LogWatch: Start watching event log \"%s\""),
-                                       &(parser->GetFileName()[1]));
+                                       &(parser->getFileName()[1]));
 
          while(1)
          {
@@ -335,23 +340,23 @@ retry_read:
 
             if (GetLastError() != ERROR_HANDLE_EOF)
                                        NxWriteAgentLog(EVENTLOG_ERROR_TYPE, _T("LogWatch: Unable to read event log \"%s\": %s"),
-                                                                                &(parser->GetFileName()[1]), GetSystemErrorText(GetLastError(), (TCHAR *)buffer, BUFFER_SIZE / sizeof(TCHAR)));
+                                                                                &(parser->getFileName()[1]), GetSystemErrorText(GetLastError(), (TCHAR *)buffer, BUFFER_SIZE / sizeof(TCHAR)));
          }
 
                        ThreadJoin(nt);
                        NxWriteAgentLog(EVENTLOG_DEBUG_TYPE, _T("LogWatch: Stop watching event log \"%s\""),
-                                       &(parser->GetFileName()[1]));
+                                       &(parser->getFileName()[1]));
       }
       else
       {
                        NxWriteAgentLog(EVENTLOG_ERROR_TYPE, _T("LogWatch: Unable to read event log \"%s\": %s"),
-                                       &(parser->GetFileName()[1]), GetSystemErrorText(GetLastError(), (TCHAR *)buffer, BUFFER_SIZE / sizeof(TCHAR)));
+                                       &(parser->getFileName()[1]), GetSystemErrorText(GetLastError(), (TCHAR *)buffer, BUFFER_SIZE / sizeof(TCHAR)));
       }
    }
    else
    {
                NxWriteAgentLog(EVENTLOG_ERROR_TYPE, _T("LogWatch: Unable to open event log \"%s\""),
-                               &(parser->GetFileName()[1]), GetSystemErrorText(GetLastError(), (TCHAR *)buffer, BUFFER_SIZE / sizeof(TCHAR)));
+                               &(parser->getFileName()[1]), GetSystemErrorText(GetLastError(), (TCHAR *)buffer, BUFFER_SIZE / sizeof(TCHAR)));
    }
 
        free(buffer);
diff --git a/src/agent/subagents/logwatch/logwatch.dsp b/src/agent/subagents/logwatch/logwatch.dsp
deleted file mode 100644 (file)
index 97ee31e..0000000
+++ /dev/null
@@ -1,220 +0,0 @@
-# Microsoft Developer Studio Project File - Name="logwatch" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=logwatch - Win32 Debug AMD64
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "logwatch.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "logwatch.mak" CFG="logwatch - Win32 Debug AMD64"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "logwatch - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "logwatch - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "logwatch - Win32 Release AMD64" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "logwatch - Win32 Debug AMD64" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "logwatch - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 1
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "logwatch_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "..\..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "logwatch_EXPORTS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib libnxlp.lib ws2_32.lib /nologo /dll /debug /machine:I386 /out:"Release/logwatch.nsm" /libpath:"..\..\..\libnetxms\Release" /libpath:"..\..\..\libnxlp\Release"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy files
-PostBuild_Cmds=copy Release\logwatch.nsm C:\NetXMS\bin
-# End Special Build Tool
-
-!ELSEIF  "$(CFG)" == "logwatch - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 1
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "logwatch_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "logwatch_EXPORTS" /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib libnxlp.lib ws2_32.lib /nologo /dll /debug /machine:I386 /out:"Debug/logwatch.nsm" /pdbtype:sept /libpath:"..\..\..\libnetxms\Debug" /libpath:"..\..\..\libnxlp\Debug"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy files
-PostBuild_Cmds=copy Debug\logwatch.nsm ..\..\..\..\bin
-# End Special Build Tool
-
-!ELSEIF  "$(CFG)" == "logwatch - Win32 Release AMD64"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "logwatch___Win32_Release_AMD64"
-# PROP BASE Intermediate_Dir "logwatch___Win32_Release_AMD64"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release64"
-# PROP Intermediate_Dir "Release64"
-# PROP Ignore_Export_Lib 1
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /O2 /I "..\..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "logwatch_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "..\..\..\..\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "logwatch_EXPORTS" /D "__64BIT__" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib ws2_32.lib /nologo /dll /machine:I386 /out:"Release/logwatch.nsm" /libpath:"..\..\..\libnetxms\Release"
-# ADD LINK32 bufferoverflowU.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib libnxlp.lib ws2_32.lib /nologo /dll /machine:I386 /out:"Release64/logwatch.nsm" /libpath:"..\..\..\libnetxms\Release64" /libpath:"..\..\..\libnxlp\Release64" /machine:AMD64
-# SUBTRACT LINK32 /pdb:none
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy files
-PostBuild_Cmds=copy Release64\logwatch.nsm C:\NetXMS\bin64
-# End Special Build Tool
-
-!ELSEIF  "$(CFG)" == "logwatch - Win32 Debug AMD64"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "logwatch___Win32_Debug_AMD64"
-# PROP BASE Intermediate_Dir "logwatch___Win32_Debug_AMD64"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug64"
-# PROP Intermediate_Dir "Debug64"
-# PROP Ignore_Export_Lib 1
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "logwatch_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /Zi /Od /I "..\..\..\..\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "logwatch_EXPORTS" /D "__64BIT__" /FD /GZ /Wp64 /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib ws2_32.lib /nologo /dll /debug /machine:I386 /out:"Debug/logwatch.nsm" /pdbtype:sept /libpath:"..\..\..\libnetxms\Debug"
-# ADD LINK32 bufferoverflowU.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib libnxlp.lib ws2_32.lib /nologo /dll /debug /machine:I386 /out:"Debug64/logwatch.nsm" /pdbtype:sept /libpath:"..\..\..\libnetxms\Debug64" /libpath:"..\..\..\libnxlp\Debug64" /machine:AMD64
-# SUBTRACT LINK32 /pdb:none
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy files
-PostBuild_Cmds=copy Debug64\logwatch.nsm ..\..\..\..\bin64
-# End Special Build Tool
-
-!ENDIF 
-
-# Begin Target
-
-# Name "logwatch - Win32 Release"
-# Name "logwatch - Win32 Debug"
-# Name "logwatch - Win32 Release AMD64"
-# Name "logwatch - Win32 Debug AMD64"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\eventlog.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\main.cpp
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\logwatch.h
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\..\..\include\netxms-version.h"
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\include\nms_agent.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\include\nms_common.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\include\nms_threads.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\include\nms_util.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\include\nxlpapi.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
index d2cb4af..21c8786 100644 (file)
@@ -44,7 +44,7 @@ void CleanupEventLogParsers();
 //
 
 extern CONDITION g_hCondShutdown;
-extern BOOL g_shutdownFlag;
+extern bool g_shutdownFlag;
 
 
 #endif
index 676d382..e1068b2 100644 (file)
@@ -37,7 +37,7 @@ THREAD_RESULT THREAD_CALL ParserThreadEventLog(void *);
 //
 
 CONDITION g_hCondShutdown = INVALID_CONDITION_HANDLE;
-BOOL g_shutdownFlag = FALSE;
+bool g_shutdownFlag = false;
 
 
 //
@@ -58,9 +58,9 @@ static LogParser **m_parserList = NULL;
 THREAD_RESULT THREAD_CALL ParserThreadFile(void *arg)
 {
 #ifdef _WIN32
-       ((LogParser *)arg)->MonitorFile(g_hCondShutdown, NxWriteAgentLog);
+       ((LogParser *)arg)->monitorFile(g_hCondShutdown, NxWriteAgentLog);
 #else
-       ((LogParser *)arg)->MonitorFile(g_hCondShutdown, &g_shutdownFlag, NxWriteAgentLog);
+       ((LogParser *)arg)->monitorFile(g_hCondShutdown, &g_shutdownFlag, NxWriteAgentLog);
 #endif
        return THREAD_OK;
 }
@@ -94,13 +94,13 @@ static void SubagentShutdown(void)
 {
        DWORD i;
 
-       g_shutdownFlag = TRUE;
+       g_shutdownFlag = true;
        if (g_hCondShutdown != INVALID_CONDITION_HANDLE)
                ConditionSet(g_hCondShutdown);
 
        for(i = 0; i < m_numParsers; i++)
        {
-               ThreadJoin(m_parserList[i]->GetThread());
+               ThreadJoin(m_parserList[i]->getThread());
                delete m_parserList[i];
        }
        safe_free(m_parserList);
@@ -120,8 +120,8 @@ static void SubagentShutdown(void)
 // Callback for matched log records
 //
 
-static void LogParserCallback(DWORD event, const TCHAR *text, int paramCount,
-                              TCHAR **paramList, DWORD objectId, void *userArg)
+static void LogParserMatch(DWORD event, const TCHAR *text, int paramCount,
+                           TCHAR **paramList, DWORD objectId, void *userArg)
 {
        NxSendTrap2(event, paramCount, paramList);
 }
@@ -152,15 +152,17 @@ static void AddParserFromConfig(const TCHAR *file)
        if (xml != NULL)
        {
                parser = new LogParser;
-               if (parser->CreateFromXML((const char *)xml, size, error, 1024))
+               if (parser->createFromXml((const char *)xml, size, error, 1024))
                {
-                       if (parser->GetFileName() != NULL)
+                       if (parser->getFileName() != NULL)
                        {
-                               parser->SetCallback(LogParserCallback);
-                               parser->SetTraceCallback(LogParserTrace);
+                               parser->setCallback(LogParserMatch);
+                               parser->setTraceCallback(LogParserTrace);
                                m_numParsers++;
                                m_parserList = (LogParser **)realloc(m_parserList, sizeof(LogParser *) * m_numParsers);
                                m_parserList[m_numParsers - 1] = parser;
+                               NxWriteAgentLog(EVENTLOG_DEBUG_TYPE, _T("LogWatch: registered parser for file %s, trace level set to %d"),
+                                               parser->getFileName(), parser->getTraceLevel());
                        }
                        else
                        {
@@ -231,12 +233,12 @@ static BOOL SubagentInit(TCHAR *pszConfigFile)
                for(i = 0; i < m_numParsers; i++)
                {
 #ifdef _WIN32
-                       if (m_parserList[i]->GetFileName()[0] == _T('*'))       // event log
-                               m_parserList[i]->SetThread(ThreadCreateEx(ParserThreadEventLog, 0, m_parserList[i]));
+                       if (m_parserList[i]->getFileName()[0] == _T('*'))       // event log
+                               m_parserList[i]->setThread(ThreadCreateEx(ParserThreadEventLog, 0, m_parserList[i]));
                        else    // regular file
-                               m_parserList[i]->SetThread(ThreadCreateEx(ParserThreadFile, 0, m_parserList[i]));
+                               m_parserList[i]->setThread(ThreadCreateEx(ParserThreadFile, 0, m_parserList[i]));
 #else
-                       m_parserList[i]->SetThread(ThreadCreateEx(ParserThreadFile, 0, m_parserList[i]));
+                       m_parserList[i]->setThread(ThreadCreateEx(ParserThreadFile, 0, m_parserList[i]));
 #endif
                }
        }
index fb4633e..968a4d0 100644 (file)
@@ -12,7 +12,7 @@ INCLUDES=-I@top_srcdir@/include
 AM_CXXFLAGS=-fpermissive 
 
 lib_LTLIBRARIES = libnsm_netbsd.la
-libnsm_netbsd_la_SOURCES = netbsd.cpp system.cpp disk.cpp net.cpp
+libnsm_netbsd_la_SOURCES = netbsd.cpp system.cpp disk.cpp net.cpp proc.cpp proc2.cpp
 libnsm_netbsd_la_LDFLAGS = -lkvm
 
 EXTRA_DIST = disk.h net.h system.h
index 50157c4..f6e44ac 100644 (file)
@@ -32,8 +32,8 @@
 
 static NETXMS_SUBAGENT_PARAM m_parameters[] =
 {
-       { "System.CPU.Count",             H_CpuCount,        NULL,
-               DCI_DT_UINT,    DCIDESC_PROCESS_COUNT },
+       { "Agent.SourcePackageSupport",   H_SourcePkgSupport,NULL,
+               DCI_DT_INT,             DCIDESC_AGENT_SOURCEPACKAGESUPPORT },
 
        { "Disk.Avail(*)",                H_DiskInfo,        (char *)DISK_AVAIL,
                DCI_DT_UINT64,  DCIDESC_DISK_AVAIL },
@@ -71,10 +71,27 @@ static NETXMS_SUBAGENT_PARAM m_parameters[] =
        { "Net.Interface.PacketsOut(*)",  H_NetIfInfoFromKVM, (char *)IF_INFO_PACKETS_OUT,
                DCI_DT_UINT64,          DCIDESC_NET_INTERFACE_PACKETSOUT },
 
-       { "Process.Count(*)",             H_ProcessCount,    (char *)0,
+       { "Process.Count(*)",             H_ProcessCount,    "P",                       DCI_DT_UINT,    DCIDESC_PROCESS_COUNT },
+       { "Process.CountEx(*)",           H_ProcessCount,    "E",                       DCI_DT_UINT,    DCIDESC_PROCESS_COUNTEX },
+#if HAVE_STRUCT_KINFO_PROC2
+       { "Process.CPUTime(*)",           H_ProcessInfo,     CAST_TO_POINTER(PROCINFO_CPUTIME, const char *),
+               DCI_DT_INT64,   DCIDESC_PROCESS_CPUTIME },
+       { "Process.KernelTime(*)",        H_ProcessInfo,     CAST_TO_POINTER(PROCINFO_KTIME, const char *),
+               DCI_DT_INT64,   DCIDESC_PROCESS_CPUTIME },
+       { "Process.PageFaults(*)",        H_ProcessInfo,     CAST_TO_POINTER(PROCINFO_PAGEFAULTS, const char *),
+               DCI_DT_INT64,   DCIDESC_PROCESS_PAGEFAULTS },
+       { "Process.Threads(*)",           H_ProcessInfo,     CAST_TO_POINTER(PROCINFO_THREADS, const char *),
+               DCI_DT_INT64,   DCIDESC_PROCESS_THREADS },
+       { "Process.UserTime(*)",          H_ProcessInfo,     CAST_TO_POINTER(PROCINFO_UTIME, const char *),
+               DCI_DT_INT64,   DCIDESC_PROCESS_CPUTIME },
+       { "Process.VMSize(*)",            H_ProcessInfo,     CAST_TO_POINTER(PROCINFO_VMSIZE, const char *),
+               DCI_DT_INT64,   DCIDESC_PROCESS_VMSIZE },
+       { "Process.WkSet(*)",             H_ProcessInfo,     CAST_TO_POINTER(PROCINFO_WKSET, const char *),
+               DCI_DT_INT64,   DCIDESC_PROCESS_WKSET },
+#endif
+
+       { "System.CPU.Count",             H_CpuCount,        NULL,
                DCI_DT_UINT,    DCIDESC_PROCESS_COUNT },
-       { "System.ProcessCount",          H_ProcessCount,    (char *)1,
-               DCI_DT_UINT,    DCIDESC_SYSTEM_PROCESSCOUNT },
 
        { "System.CPU.LoadAvg",           H_CpuLoad,         NULL,
                DCI_DT_FLOAT,   DCIDESC_SYSTEM_CPU_LOADAVG },
@@ -110,13 +127,18 @@ static NETXMS_SUBAGENT_PARAM m_parameters[] =
                DCI_DT_UINT64,  DCIDESC_SYSTEM_MEMORY_VIRTUAL_TOTAL },
        { "System.Memory.Virtual.Used",   H_MemoryInfo,      (char *)VIRTUAL_USED,
                DCI_DT_UINT64,  DCIDESC_SYSTEM_MEMORY_VIRTUAL_USED },
+
+       { "System.ProcessCount",          H_ProcessCount,    "S",
+               DCI_DT_UINT,    DCIDESC_SYSTEM_PROCESSCOUNT },
+#if HAVE_STRUCT_KINFO_PROC2
+       { "System.ThreadCount",           H_ProcessCount,    "T",
+               DCI_DT_UINT,    DCIDESC_SYSTEM_THREADCOUNT },
+#endif
+
        { "System.Uname",                 H_Uname,           NULL,
                DCI_DT_STRING,  DCIDESC_SYSTEM_UNAME },
        { "System.Uptime",                H_Uptime,          NULL,
                DCI_DT_UINT,    DCIDESC_SYSTEM_UPTIME },
-
-       { "Agent.SourcePackageSupport",   H_SourcePkgSupport,NULL,
-               DCI_DT_INT,             DCIDESC_AGENT_SOURCEPACKAGESUPPORT },
 };
 
 static NETXMS_SUBAGENT_ENUM m_enums[] =
diff --git a/src/agent/subagents/netbsd/proc.cpp b/src/agent/subagents/netbsd/proc.cpp
new file mode 100644 (file)
index 0000000..050abd4
--- /dev/null
@@ -0,0 +1,283 @@
+/* 
+** NetXMS subagent for NetBSD
+** Copyright (C) 2004-2009 Alex Kirhenshtein, Victor Kirhenshtein
+** Copyright (C) 2008 Mark Ibell
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+**
+**/
+
+#include <nms_common.h>
+#include <nms_agent.h>
+#include <nms_util.h>
+
+#if !HAVE_STRUCT_KINFO_PROC2
+
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/sysctl.h>
+#include <sys/utsname.h>
+#include <sys/param.h>
+#include <sys/proc.h>
+#include <kvm.h>
+#include "system.h"
+
+
+//
+// Build process command line
+//
+
+static void BuildProcessCommandLine(kvm_t *kd, struct kinfo_proc *p, char *cmdLine, size_t maxSize)
+{
+       char **argv;
+       int i, pos, len;
+
+       *cmdLine = 0;
+       argv = kvm_getargv(kd, p, 0);
+       if (argv != NULL)
+       {
+               if (argv[0] != NULL)
+               {
+                       for(i = 0, pos = 0; (argv[i] != NULL) && (pos < maxSize); i++)
+                       {
+                               if (i > 0)
+                                       cmdLine[pos++] = ' ';
+                               nx_strncpy(&cmdLine[pos], argv[i], maxSize - pos);
+                               pos += strlen(argv[i]);
+                       }
+               }
+               else
+               {
+                       // Use process name if command line is empty
+                       cmdLine[0] = '[';
+                       nx_strncpy(&cmdLine[1], p->kp_proc.p_comm, maxSize - 2);
+                       strcat(cmdLine, "]");
+               }
+       }
+       else
+       {
+               // Use process name if command line cannot be obtained
+               cmdLine[0] = '[';
+               nx_strncpy(&cmdLine[1], p->kp_proc.p_comm, maxSize - 2);
+               strcat(cmdLine, "]");
+       }
+}
+
+
+//
+// Check if given process matches filter
+//
+
+static BOOL MatchProcess(kvm_t *kd, struct kinfo_proc *p, BOOL extMatch, const char *name, const char *cmdLine)
+{
+       char processCmdLine[32768];
+
+       if (extMatch)
+       {
+               BuildProcessCommandLine(kd, p, processCmdLine, sizeof(processCmdLine));
+               return ((*name != 0) ? RegexpMatch(p->kp_proc.p_comm, name, FALSE) : TRUE) &&
+                      ((*cmdLine != 0) ? RegexpMatch(processCmdLine, cmdLine, TRUE) : TRUE);
+       }
+       else
+       {
+               return strcasecmp(p->kp_proc.p_comm, name) == 0;
+       }
+}
+
+
+//
+// Handler for Process.Count, Process.CountEx and System.ProcessCount parameters
+//
+
+LONG H_ProcessCount(const char *param, const char *arg, char *value)
+{
+       int nRet = SYSINFO_RC_ERROR;
+       char name[128] = "", cmdLine[128] = "";
+       int nCount;
+       int nResult = -1;
+       int i;
+       kvm_t *kd;
+       struct kinfo_proc *kp;
+
+       if ((*arg != 'S') && (*arg != 'T'))  // Not System.ProcessCount nor System.ThreadCount
+       {
+               NxGetParameterArg(param, 1, name, sizeof(name));
+               if (*arg == 'E')        // Process.CountEx
+               {
+                       NxGetParameterArg(param, 2, cmdLine, sizeof(cmdLine));
+               }
+       }
+
+       kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, NULL);
+       if (kd != NULL)
+       {
+               kp = kvm_getprocs(kd, KERN_PROC_ALL, 0, &nCount);
+
+               if (kp != NULL)
+               {
+                       if (*arg != 'S')        // Not System.ProcessCount
+                       {
+                               nResult = 0;
+                               for (i = 0; i < nCount; i++)
+                               {
+                                       if (MatchProcess(kd, &kp[i], *arg == 'E', name, cmdLine))
+                                       {
+                                               nResult++;
+                                       }
+                               }
+                       }
+                       else
+                       {
+                               nResult = nCount;
+                       }
+               }
+
+               kvm_close(kd);
+       }
+
+       if (nResult >= 0)
+       {
+               ret_int(value, nResult);
+               nRet = SYSINFO_RC_SUCCESS;
+       }
+
+       return nRet;
+}
+
+
+//
+// Handler for Process.* parameters
+//
+
+LONG H_ProcessInfo(const char *param, const char *arg, char *value)
+{
+       int nRet = SYSINFO_RC_ERROR;
+       char name[128] = "", cmdLine[128] = "", buffer[64] = "";
+       int nCount, nMatched;
+       INT64 currValue, result;
+       int i, type;
+       kvm_t *kd;
+       struct kinfo_proc *kp;
+       static const char *typeList[]={ "min", "max", "avg", "sum", NULL };
+
+        // Get parameter type arguments
+       NxGetParameterArg(param, 2, buffer, sizeof(buffer));
+       if (buffer[0] == 0)     // Omited type
+       {
+               type = INFOTYPE_SUM;
+       }
+       else
+       {
+               for(type = 0; typeList[type] != NULL; type++)
+                       if (!stricmp(typeList[type], buffer))
+                               break;
+               if (typeList[type] == NULL)
+                       return SYSINFO_RC_UNSUPPORTED;     // Unsupported type
+       }
+
+       NxGetParameterArg(param, 1, name, sizeof(name));
+       NxGetParameterArg(param, 3, cmdLine, sizeof(cmdLine));
+
+       kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, NULL);
+       if (kd != NULL)
+       {
+               kp = kvm_getprocs(kd, KERN_PROC_ALL, 0, &nCount);
+
+               if (kp != NULL)
+               {
+                       result = 0;
+                       nMatched = 0;
+                       for (i = 0; i < nCount; i++)
+                       {
+                               if (MatchProcess(kd, &kp[i], *cmdLine != 0, name, cmdLine))
+                               {
+                                       nMatched++;
+/* VK: this is just stub because I don't know how to retrieve any usable process information
+  using only kinfo_proc
+                                       switch(CAST_FROM_POINTER(arg, int))
+                                       {
+                                       }
+*/
+
+                                       switch(type)
+                                       {
+                                               case INFOTYPE_SUM:
+                                               case INFOTYPE_AVG:
+                                                       result += currValue;
+                                                       break;
+                                               case INFOTYPE_MIN:
+                                                       result = min(result, currValue);
+                                                       break;
+                                               case INFOTYPE_MAX:
+                                                       result = max(result, currValue);
+                                                       break;
+                                       }
+                               }
+                       }
+                       if ((type == INFOTYPE_AVG) && (nMatched > 0))
+                               result /= nMatched;
+                       ret_int64(value, result);
+                       nRet = SYSINFO_RC_SUCCESS;
+               }
+
+               kvm_close(kd);
+       }
+
+       return nRet;
+}
+
+
+//
+// Handler for System.ProcessList enum
+//
+
+LONG H_ProcessList(const char *pszParam, const char *pArg, NETXMS_VALUES_LIST *pValue)
+{
+       int nRet = SYSINFO_RC_ERROR;
+       int nCount = -1;
+       int i;
+       struct kinfo_proc *kp;
+       kvm_t *kd;
+
+       kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, NULL);
+       if (kd != 0)
+       {
+               kp = kvm_getprocs(kd, KERN_PROC_ALL, 0, &nCount);
+
+               if (kp != NULL)
+               {
+                       for (i = 0; i < nCount; i++)
+                       {
+                               char szBuff[128];
+
+                               snprintf(szBuff, sizeof(szBuff), "%d %s",
+                                               kp[i].kp_proc.p_pid, kp[i].kp_proc.p_comm
+                                               );
+                               NxAddResultString(pValue, szBuff);
+                       }
+               }
+
+               kvm_close(kd);
+       }
+
+       if (nCount >= 0)
+       {
+               nRet = SYSINFO_RC_SUCCESS;
+       }
+
+       return nRet;
+}
+
+#endif   /* !HAVE_STRUCT_KINFO_PROC2 */
diff --git a/src/agent/subagents/netbsd/proc2.cpp b/src/agent/subagents/netbsd/proc2.cpp
new file mode 100644 (file)
index 0000000..edb4247
--- /dev/null
@@ -0,0 +1,311 @@
+/* 
+** NetXMS subagent for NetBSD
+** Copyright (C) 2004-2009 Alex Kirhenshtein, Victor Kirhenshtein
+** Copyright (C) 2008 Mark Ibell
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+**
+**/
+
+#include <nms_common.h>
+#include <nms_agent.h>
+#include <nms_util.h>
+
+#if HAVE_STRUCT_KINFO_PROC2
+
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/sysctl.h>
+#include <sys/utsname.h>
+#include <sys/param.h>
+#include <sys/proc.h>
+#include <kvm.h>
+#include "system.h"
+
+
+//
+// Build process command line
+//
+
+static void BuildProcessCommandLine(kvm_t *kd, struct kinfo_proc2 *p, char *cmdLine, size_t maxSize)
+{
+       char **argv;
+       int i, pos, len;
+
+       *cmdLine = 0;
+       argv = kvm_getargv2(kd, p, 0);
+       if (argv != NULL)
+       {
+               if (argv[0] != NULL)
+               {
+                       for(i = 0, pos = 0; (argv[i] != NULL) && (pos < maxSize); i++)
+                       {
+                               if (i > 0)
+                                       cmdLine[pos++] = ' ';
+                               nx_strncpy(&cmdLine[pos], argv[i], maxSize - pos);
+                               pos += strlen(argv[i]);
+                       }
+               }
+               else
+               {
+                       // Use process name if command line is empty
+                       cmdLine[0] = '[';
+                       nx_strncpy(&cmdLine[1], p->p_comm, maxSize - 2);
+                       strcat(cmdLine, "]");
+               }
+       }
+       else
+       {
+               // Use process name if command line cannot be obtained
+               cmdLine[0] = '[';
+               nx_strncpy(&cmdLine[1], p->p_comm, maxSize - 2);
+               strcat(cmdLine, "]");
+       }
+}
+
+
+//
+// Check if given process matches filter
+//
+
+static BOOL MatchProcess(kvm_t *kd, struct kinfo_proc2 *p, BOOL extMatch, const char *name, const char *cmdLine)
+{
+       char processCmdLine[32768];
+
+       if (extMatch)
+       {
+               BuildProcessCommandLine(kd, p, processCmdLine, sizeof(processCmdLine));
+               return ((*name != 0) ? RegexpMatch(p->p_comm, name, FALSE) : TRUE) &&
+                      ((*cmdLine != 0) ? RegexpMatch(processCmdLine, cmdLine, TRUE) : TRUE);
+       }
+       else
+       {
+               return strcasecmp(p->p_comm, name) == 0;
+       }
+}
+
+
+//
+// Handler for Process.Count, Process.CountEx and System.ProcessCount parameters
+//
+
+LONG H_ProcessCount(const char *param, const char *arg, char *value)
+{
+       int nRet = SYSINFO_RC_ERROR;
+       char name[128] = "", cmdLine[128] = "";
+       int nCount;
+       int nResult = -1;
+       int i;
+       kvm_t *kd;
+       struct kinfo_proc2 *kp;
+
+       if ((*arg != 'S') && (*arg != 'T'))  // Not System.ProcessCount nor System.ThreadCount
+       {
+               NxGetParameterArg(param, 1, name, sizeof(name));
+               if (*arg == 'E')        // Process.CountEx
+               {
+                       NxGetParameterArg(param, 2, cmdLine, sizeof(cmdLine));
+               }
+       }
+
+       kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, NULL);
+       if (kd != NULL)
+       {
+               kp = kvm_getproc2(kd, KERN_PROC_ALL, 0, sizeof(struct kinfo_proc2), &nCount);
+
+               if (kp != NULL)
+               {
+                       if (*arg != 'S')        // Not System.ProcessCount
+                       {
+                               nResult = 0;
+                               if (*arg == 'T')  // System.ThreadCount
+                               {
+                                       for (i = 0; i < nCount; i++)
+                                       {
+                                               nResult += kp[i].p_nlwps;
+                                       }
+                               }
+                               else
+                               {
+                                       for (i = 0; i < nCount; i++)
+                                       {
+                                               if (MatchProcess(kd, &kp[i], *arg == 'E', name, cmdLine))
+                                               {
+                                                       nResult++;
+                                               }
+                                       }
+                               }
+                       }
+                       else
+                       {
+                               nResult = nCount;
+                       }
+               }
+
+               kvm_close(kd);
+       }
+
+       if (nResult >= 0)
+       {
+               ret_int(value, nResult);
+               nRet = SYSINFO_RC_SUCCESS;
+       }
+
+       return nRet;
+}
+
+
+//
+// Handler for Process.* parameters
+//
+
+LONG H_ProcessInfo(const char *param, const char *arg, char *value)
+{
+       int nRet = SYSINFO_RC_ERROR;
+       char name[128] = "", cmdLine[128] = "", buffer[64] = "";
+       int nCount, nMatched;
+       INT64 currValue, result;
+       int i, type;
+       kvm_t *kd;
+       struct kinfo_proc2 *kp;
+       static const char *typeList[]={ "min", "max", "avg", "sum", NULL };
+
+        // Get parameter type arguments
+       NxGetParameterArg(param, 2, buffer, sizeof(buffer));
+       if (buffer[0] == 0)     // Omited type
+       {
+               type = INFOTYPE_SUM;
+       }
+       else
+       {
+               for(type = 0; typeList[type] != NULL; type++)
+                       if (!stricmp(typeList[type], buffer))
+                               break;
+               if (typeList[type] == NULL)
+                       return SYSINFO_RC_UNSUPPORTED;     // Unsupported type
+       }
+
+       NxGetParameterArg(param, 1, name, sizeof(name));
+       NxGetParameterArg(param, 3, cmdLine, sizeof(cmdLine));
+
+       kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, NULL);
+       if (kd != NULL)
+       {
+               kp = kvm_getproc2(kd, KERN_PROC_ALL, 0, sizeof(struct kinfo_proc2), &nCount);
+
+               if (kp != NULL)
+               {
+                       result = 0;
+                       nMatched = 0;
+                       for (i = 0; i < nCount; i++)
+                       {
+                               if (MatchProcess(kd, &kp[i], *cmdLine != 0, name, cmdLine))
+                               {
+                                       nMatched++;
+                                       switch(CAST_FROM_POINTER(arg, int))
+                                       {
+                                               case PROCINFO_CPUTIME:
+                                                       currValue = ((INT64)kp[i].p_uutime_sec * 1000 + kp[i].p_uutime_usec / 1000) +
+                                                                   ((INT64)kp[i].p_ustime_sec * 1000 + kp[i].p_ustime_usec / 1000);
+                                                       break;
+                                               case PROCINFO_KTIME:
+                                                       currValue = (INT64)kp[i].p_ustime_sec * 1000 + kp[i].p_ustime_usec / 1000;
+                                                       break;
+                                               case PROCINFO_UTIME:
+                                                       currValue = (INT64)kp[i].p_uutime_sec * 1000 + kp[i].p_uutime_usec / 1000;
+                                                       break;
+                                               case PROCINFO_PAGEFAULTS:
+                                                       currValue = kp[i].p_uru_majflt + kp[i].p_uru_minflt;
+                                                       break;
+                                               case PROCINFO_THREADS:
+                                                       currValue = kp[i].p_nlwps;
+                                                       break;
+                                               case PROCINFO_VMSIZE:
+                                                       currValue = (INT64)(kp[i].p_vm_tsize + kp[i].p_vm_dsize + kp[i].p_vm_ssize) * (INT64)getpagesize();
+                                                       break;
+                                               case PROCINFO_WKSET:
+                                                       currValue = (INT64)kp[i].p_vm_rssize * (INT64)getpagesize();
+                                                       break;
+                                       }
+
+                                       switch(type)
+                                       {
+                                               case INFOTYPE_SUM:
+                                               case INFOTYPE_AVG:
+                                                       result += currValue;
+                                                       break;
+                                               case INFOTYPE_MIN:
+                                                       result = min(result, currValue);
+                                                       break;
+                                               case INFOTYPE_MAX:
+                                                       result = max(result, currValue);
+                                                       break;
+                                       }
+                               }
+                       }
+                       if ((type == INFOTYPE_AVG) && (nMatched > 0))
+                               result /= nMatched;
+                       ret_int64(value, result);
+                       nRet = SYSINFO_RC_SUCCESS;
+               }
+
+               kvm_close(kd);
+       }
+
+       return nRet;
+}
+
+
+//
+// Handler for System.ProcessList enum
+//
+
+LONG H_ProcessList(const char *pszParam, const char *pArg, NETXMS_VALUES_LIST *pValue)
+{
+       int nRet = SYSINFO_RC_ERROR;
+       int nCount = -1;
+       int i;
+       struct kinfo_proc2 *kp;
+       kvm_t *kd;
+
+       kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, NULL);
+       if (kd != 0)
+       {
+               kp = kvm_getproc2(kd, KERN_PROC_ALL, 0, sizeof(kinfo_proc2), &nCount);
+
+               if (kp != NULL)
+               {
+                       for (i = 0; i < nCount; i++)
+                       {
+                               char szBuff[128];
+
+                               snprintf(szBuff, sizeof(szBuff), "%d %s",
+                                               kp[i].p_pid, kp[i].p_comm);
+                               NxAddResultString(pValue, szBuff);
+                       }
+               }
+
+               kvm_close(kd);
+       }
+
+       if (nCount >= 0)
+       {
+               nRet = SYSINFO_RC_SUCCESS;
+       }
+
+       return nRet;
+}
+
+#endif   /* HAVE_STRUCT_KINFO_PROC2 */
index c2af788..b5008c4 100644 (file)
@@ -153,53 +153,6 @@ LONG H_CpuCount(const char *pszParam, const char *pArg, char *pValue)
        return nRet;
 }
 
-LONG H_ProcessCount(const char *pszParam, const char *pArg, char *pValue)
-{
-       int nRet = SYSINFO_RC_ERROR;
-       char szArg[128] = {0};
-       int nCount = -1;
-       int nResult = -1;
-       int i;
-       kvm_t *kd;
-       struct kinfo_proc *kp;
-
-       NxGetParameterArg(pszParam, 1, szArg, sizeof(szArg));
-
-       kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, NULL);
-       if (kd != 0)
-       {
-               kp = kvm_getprocs(kd, KERN_PROC_ALL, 0, &nCount);
-
-               if (kp != NULL)
-               {
-                       if (szArg[0] != 0)
-                       {
-                               for (nResult = 0, i = 0; i < nCount; i++)
-                               {
-                                               if (strcasecmp(kp[i].kp_proc.p_comm, szArg) == 0)
-                                               {
-                                                       nResult++;
-                                               }
-                               }
-                       }
-                       else
-                       {
-                               nResult = nCount;
-                       }
-               }
-
-               kvm_close(kd);
-       }
-
-       if (nResult >= 0)
-       {
-               ret_int(pValue, nResult);
-               nRet = SYSINFO_RC_SUCCESS;
-       }
-
-       return nRet;
-}
-
 LONG H_MemoryInfo(const char *pszParam, const char *pArg, char *pValue)
 {
        int nRet = SYSINFO_RC_ERROR;
@@ -299,45 +252,6 @@ LONG H_MemoryInfo(const char *pszParam, const char *pArg, char *pValue)
        return nRet;
 }
 
-LONG H_ProcessList(const char *pszParam, const char *pArg, NETXMS_VALUES_LIST *pValue)
-{
-       int nRet = SYSINFO_RC_ERROR;
-       int nCount = -1;
-       int i;
-       struct kinfo_proc *kp;
-       kvm_t *kd;
-
-
-
-       kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, NULL);
-       if (kd != 0)
-       {
-               kp = kvm_getprocs(kd, KERN_PROC_ALL, 0, &nCount);
-
-               if (kp != NULL)
-               {
-                       for (i = 0; i < nCount; i++)
-                       {
-                               char szBuff[128];
-
-                               snprintf(szBuff, sizeof(szBuff), "%d %s",
-                                               kp[i].kp_proc.p_pid, kp[i].kp_proc.p_comm
-                                               );
-                               NxAddResultString(pValue, szBuff);
-                       }
-               }
-
-               kvm_close(kd);
-       }
-
-       if (nCount >= 0)
-       {
-               nRet = SYSINFO_RC_SUCCESS;
-       }
-
-       return nRet;
-}
-
 //
 // stub
 //
@@ -346,54 +260,3 @@ LONG H_SourcePkgSupport(const char *pszParam, const char *pArg, char *pValue)
        ret_int(pValue, 1);
        return SYSINFO_RC_SUCCESS;
 }
-
-
-///////////////////////////////////////////////////////////////////////////////
-/*
-
-$Log: not supported by cvs2svn $
-Revision 1.8  2005/05/30 14:39:32  alk
-* process list now works via kvm, compatible with freebsd 5+
-
-Revision 1.7  2005/05/29 22:44:59  alk
-* configure: pthreads & fbsd5+; detection code should be rewriten!
-* another ugly hack: agent's process info disabled for fbsd5+: struct kinfo_proc changed; m/b fix it tomorow
-* server/nxadm & fbsd5.1: a**holes, in 5.1 there no define with version in readline.h...
-
-Revision 1.6  2005/01/24 19:51:16  alk
-reurn types/comments added
-Process.Count(*)/System.ProcessCount fixed
-
-Revision 1.5  2005/01/23 05:36:11  alk
-+ System.Memory.Swap.*
-+ System.Memory.Virtual.*
-
-NB! r/o access to /dev/mem required! (e.g. chgrp kmem ; chmod g+s)
-
-Revision 1.4  2005/01/23 05:14:49  alk
-System's PageSize used instead of Hardware PageSize
-
-Revision 1.3  2005/01/23 05:08:06  alk
-+ System.CPU.Count
-+ System.Memory.Physical.*
-+ System.ProcessCount
-+ System.ProcessList
-
-Revision 1.2  2005/01/17 23:25:47  alk
-Agent.SourcePackageSupport added
-
-Revision 1.1  2005/01/17 17:14:32  alk
-freebsd agent, incomplete (but working)
-
-Revision 1.1  2004/10/22 22:08:35  alk
-source restructured;
-implemented:
-       Net.IP.Forwarding
-       Net.IP6.Forwarding
-       Process.Count(*)
-       Net.ArpCache
-       Net.InterfaceList (if-type not implemented yet)
-       System.ProcessList
-
-
-*/
index 59aea53..841cd28 100644 (file)
@@ -35,6 +35,22 @@ enum
        VIRTUAL_TOTAL,
 };
 
+enum
+{
+       PROCINFO_CPUTIME,
+       PROCINFO_KTIME,
+       PROCINFO_PAGEFAULTS,
+       PROCINFO_THREADS,
+       PROCINFO_UTIME,
+       PROCINFO_VMSIZE,
+       PROCINFO_WKSET
+};
+
+#define INFOTYPE_MIN             0
+#define INFOTYPE_MAX             1
+#define INFOTYPE_AVG             2
+#define INFOTYPE_SUM             3
+
 LONG H_ProcessList(const char *, const char *, NETXMS_VALUES_LIST *);
 LONG H_Uptime(const char *, const char *, char *);
 LONG H_Uname(const char *, const char *, char *);
@@ -44,6 +60,7 @@ LONG H_CpuCount(const char *, const char *, char *);
 LONG H_CpuLoad(const char *, const char *, char *);
 LONG H_CpuUsage(const char *, const char *, char *);
 LONG H_ProcessCount(const char *, const char *, char *);
+LONG H_ProcessInfo(const char *, const char *, char *);
 LONG H_MemoryInfo(const char *, const char *, char *);
 LONG H_SourcePkgSupport(const char *, const char *, char *);
 
index 5eb0a01..ed9106d 100644 (file)
@@ -4,7 +4,7 @@ lib_LTLIBRARIES = libnsm_odbcquery.la
 libnsm_odbcquery_la_SOURCES = odbcquery.cpp odbcsapi.cpp
 libnsm_odbcquery_la_LDFLAGS = ../../../libnetxms/libnetxms.la
 
-EXTRA_DIST = odbcquery.h
+EXTRA_DIST = odbcquery.vcproj odbcquery.h
 
 install-exec-hook:
        if test "x`uname -s`" = "xAIX" ; then \
diff --git a/src/agent/subagents/odbcquery/odbcquery.dsp b/src/agent/subagents/odbcquery/odbcquery.dsp
deleted file mode 100644 (file)
index 94cc3d1..0000000
+++ /dev/null
@@ -1,216 +0,0 @@
-# Microsoft Developer Studio Project File - Name="odbcquery" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=odbcquery - Win32 Debug AMD64
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "odbcquery.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "odbcquery.mak" CFG="odbcquery - Win32 Debug AMD64"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "odbcquery - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "odbcquery - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "odbcquery - Win32 Release AMD64" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "odbcquery - Win32 Debug AMD64" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "odbcquery - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "odbcquery_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "..\..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "odbcquery_EXPORTS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib ws2_32.lib /nologo /dll /debug /machine:I386 /out:"Release/odbcquery.nsm" /libpath:"..\..\..\libnetxms\Release"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy files
-PostBuild_Cmds=copy Release\odbcquery.nsm C:\NetXMS\bin
-# End Special Build Tool
-
-!ELSEIF  "$(CFG)" == "odbcquery - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 1
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "odbcquery_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "odbcquery_EXPORTS" /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib ws2_32.lib /nologo /dll /debug /machine:I386 /out:"Debug/odbcquery.nsm" /pdbtype:sept /libpath:"..\..\..\libnetxms\Debug"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy files
-PostBuild_Cmds=copy Debug\odbcquery.nsm ..\..\..\..\bin
-# End Special Build Tool
-
-!ELSEIF  "$(CFG)" == "odbcquery - Win32 Release AMD64"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "odbcquery___Win32_Release_AMD64"
-# PROP BASE Intermediate_Dir "odbcquery___Win32_Release_AMD64"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release64"
-# PROP Intermediate_Dir "Release64"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /O2 /I "..\..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "odbcquery_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "..\..\..\..\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "odbcquery_EXPORTS" /D "__64BIT__" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib ws2_32.lib /nologo /dll /machine:I386 /out:"Release/odbcquery.nsm" /libpath:"..\..\..\libnetxms\Release"
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib ws2_32.lib bufferoverflowU.lib /nologo /dll /machine:I386 /out:"Release64/odbcquery.nsm" /libpath:"..\..\..\libnetxms\Release64" /machine:AMD64
-# SUBTRACT LINK32 /pdb:none
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy files
-PostBuild_Cmds=copy Release64\odbcquery.nsm C:\NetXMS\bin64
-# End Special Build Tool
-
-!ELSEIF  "$(CFG)" == "odbcquery - Win32 Debug AMD64"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "odbcquery___Win32_Debug_AMD64"
-# PROP BASE Intermediate_Dir "odbcquery___Win32_Debug_AMD64"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug64"
-# PROP Intermediate_Dir "Debug64"
-# PROP Ignore_Export_Lib 1
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "odbcquery_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /Zi /Od /I "..\..\..\..\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "odbcquery_EXPORTS" /D "__64BIT__" /FD /GZ /Wp64 /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib ws2_32.lib /nologo /dll /debug /machine:I386 /out:"Debug/odbcquery.nsm" /pdbtype:sept /libpath:"..\..\..\libnetxms\Debug"
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib ws2_32.lib bufferoverflowU.lib /nologo /dll /debug /machine:I386 /out:"Debug64/odbcquery.nsm" /pdbtype:sept /libpath:"..\..\..\libnetxms\Debug64" /machine:AMD64
-# SUBTRACT LINK32 /pdb:none
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy files
-PostBuild_Cmds=copy Debug64\odbcquery.nsm ..\..\..\..\bin64
-# End Special Build Tool
-
-!ENDIF 
-
-# Begin Target
-
-# Name "odbcquery - Win32 Release"
-# Name "odbcquery - Win32 Debug"
-# Name "odbcquery - Win32 Release AMD64"
-# Name "odbcquery - Win32 Debug AMD64"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\odbcquery.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\odbcsapi.cpp
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE="..\..\..\..\include\netxms-version.h"
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\include\nms_agent.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\include\nms_common.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\include\nms_threads.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\include\nms_util.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\odbcquery.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
index 9cd585a..e842a39 100644 (file)
@@ -4,7 +4,7 @@ lib_LTLIBRARIES = libnsm_ping.la
 libnsm_ping_la_SOURCES = ping.cpp
 libnsm_ping_la_LDFLAGS = ../../../libnetxms/libnetxms.la
 
-EXTRA_DIST = ping.h ping.dsp ping.dsw ping.def Makefile.nw
+EXTRA_DIST = ping.h ping.vcproj ping.def Makefile.nw
 
 install-exec-hook:
        if test "x`uname -s`" = "xAIX" ; then \
diff --git a/src/agent/subagents/ping/ping.dsp b/src/agent/subagents/ping/ping.dsp
deleted file mode 100644 (file)
index b91cf01..0000000
+++ /dev/null
@@ -1,212 +0,0 @@
-# Microsoft Developer Studio Project File - Name="ping" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=ping - Win32 Debug AMD64
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "ping.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "ping.mak" CFG="ping - Win32 Debug AMD64"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "ping - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "ping - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "ping - Win32 Release AMD64" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "ping - Win32 Debug AMD64" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "ping - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 1
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ping_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "..\..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ping_EXPORTS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib ws2_32.lib /nologo /dll /debug /machine:I386 /out:"Release/ping.nsm" /libpath:"..\..\..\libnetxms\Release"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy files
-PostBuild_Cmds=copy Release\ping.nsm C:\NetXMS\bin
-# End Special Build Tool
-
-!ELSEIF  "$(CFG)" == "ping - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 1
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ping_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ping_EXPORTS" /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib ws2_32.lib /nologo /dll /debug /machine:I386 /out:"Debug/ping.nsm" /pdbtype:sept /libpath:"..\..\..\libnetxms\Debug"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy files
-PostBuild_Cmds=copy Debug\ping.nsm ..\..\..\..\bin
-# End Special Build Tool
-
-!ELSEIF  "$(CFG)" == "ping - Win32 Release AMD64"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "ping___Win32_Release_AMD64"
-# PROP BASE Intermediate_Dir "ping___Win32_Release_AMD64"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release64"
-# PROP Intermediate_Dir "Release64"
-# PROP Ignore_Export_Lib 1
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /O2 /I "..\..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ping_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "..\..\..\..\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ping_EXPORTS" /D "__64BIT__" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib ws2_32.lib /nologo /dll /machine:I386 /out:"Release/ping.nsm" /libpath:"..\..\..\libnetxms\Release"
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib ws2_32.lib bufferoverflowU.lib /nologo /dll /machine:I386 /out:"Release64/ping.nsm" /libpath:"..\..\..\libnetxms\Release64" /machine:AMD64
-# SUBTRACT LINK32 /pdb:none
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy files
-PostBuild_Cmds=copy Release64\ping.nsm C:\NetXMS\bin64
-# End Special Build Tool
-
-!ELSEIF  "$(CFG)" == "ping - Win32 Debug AMD64"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "ping___Win32_Debug_AMD64"
-# PROP BASE Intermediate_Dir "ping___Win32_Debug_AMD64"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug64"
-# PROP Intermediate_Dir "Debug64"
-# PROP Ignore_Export_Lib 1
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ping_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /Zi /Od /I "..\..\..\..\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ping_EXPORTS" /D "__64BIT__" /FD /GZ /Wp64 /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib ws2_32.lib /nologo /dll /debug /machine:I386 /out:"Debug/ping.nsm" /pdbtype:sept /libpath:"..\..\..\libnetxms\Debug"
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib ws2_32.lib bufferoverflowU.lib /nologo /dll /debug /machine:I386 /out:"Debug64/ping.nsm" /pdbtype:sept /libpath:"..\..\..\libnetxms\Debug64" /machine:AMD64
-# SUBTRACT LINK32 /pdb:none
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy files
-PostBuild_Cmds=copy Debug64\ping.nsm ..\..\..\..\bin64
-# End Special Build Tool
-
-!ENDIF 
-
-# Begin Target
-
-# Name "ping - Win32 Release"
-# Name "ping - Win32 Debug"
-# Name "ping - Win32 Release AMD64"
-# Name "ping - Win32 Debug AMD64"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\ping.cpp
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE="..\..\..\..\include\netxms-version.h"
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\include\nms_agent.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\include\nms_common.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\include\nms_threads.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\include\nms_util.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\ping.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
index 87412d9..10af45b 100644 (file)
@@ -7,7 +7,7 @@ libnsm_portCheck_la_SOURCES = main.cpp net.cpp pop3.cpp ssh.cpp smtp.cpp \
        http.cpp custom.cpp telnet.cpp
 libnsm_portCheck_la_LDFLAGS = ../../../libnetxms/libnetxms.la
 
-EXTRA_DIST = net.h main.h
+EXTRA_DIST = portcheck.vcproj net.h main.h
 
 install-exec-hook:
        if test "x`uname -s`" = "xAIX" ; then \
diff --git a/src/agent/subagents/portCheck/portcheck.dsp b/src/agent/subagents/portCheck/portcheck.dsp
deleted file mode 100644 (file)
index 398e42c..0000000
+++ /dev/null
@@ -1,244 +0,0 @@
-# Microsoft Developer Studio Project File - Name="portcheck" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=portcheck - Win32 Debug AMD64
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "portcheck.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "portcheck.mak" CFG="portcheck - Win32 Debug AMD64"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "portcheck - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "portcheck - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "portcheck - Win32 Release AMD64" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "portcheck - Win32 Debug AMD64" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "portcheck - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "portcheck_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "..\..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "portcheck_EXPORTS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib ws2_32.lib /nologo /dll /debug /machine:I386 /out:"Release/portcheck.nsm" /libpath:"..\..\..\libnetxms\Release"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy files
-PostBuild_Cmds=copy Release\portcheck.nsm C:\NetXMS\bin
-# End Special Build Tool
-
-!ELSEIF  "$(CFG)" == "portcheck - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 1
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "portcheck_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "portcheck_EXPORTS" /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib ws2_32.lib /nologo /dll /debug /machine:I386 /out:"Debug/portcheck.nsm" /pdbtype:sept /libpath:"..\..\..\libnetxms\Debug"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy files
-PostBuild_Cmds=copy Debug\portcheck.nsm ..\..\..\..\bin
-# End Special Build Tool
-
-!ELSEIF  "$(CFG)" == "portcheck - Win32 Release AMD64"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "portcheck___Win32_Release_AMD64"
-# PROP BASE Intermediate_Dir "portcheck___Win32_Release_AMD64"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release64"
-# PROP Intermediate_Dir "Release64"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /O2 /I "..\..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "portcheck_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "..\..\..\..\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "portcheck_EXPORTS" /D "__64BIT__" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib libnxcscp.lib ws2_32.lib /nologo /dll /machine:I386 /out:"Release/portcheck.nsm" /libpath:"..\..\..\libnetxms\Release" /libpath:"..\..\..\libnxcscp\Release"
-# ADD LINK32 bufferoverflowU.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib ws2_32.lib /nologo /dll /machine:I386 /out:"Release64/portcheck.nsm" /libpath:"..\..\..\libnetxms\Release64" /machine:AMD64
-# SUBTRACT LINK32 /pdb:none
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy files
-PostBuild_Cmds=copy Release64\portcheck.nsm C:\NetXMS\bin64
-# End Special Build Tool
-
-!ELSEIF  "$(CFG)" == "portcheck - Win32 Debug AMD64"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "portcheck___Win32_Debug_AMD64"
-# PROP BASE Intermediate_Dir "portcheck___Win32_Debug_AMD64"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug64"
-# PROP Intermediate_Dir "Debug64"
-# PROP Ignore_Export_Lib 1
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "portcheck_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /Zi /Od /I "..\..\..\..\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "portcheck_EXPORTS" /D "__64BIT__" /FD /GZ /Wp64 /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib libnxcscp.lib ws2_32.lib /nologo /dll /debug /machine:I386 /out:"Debug/portcheck.nsm" /pdbtype:sept /libpath:"..\..\..\libnetxms\Debug" /libpath:"..\..\..\libnxcscp\Debug"
-# ADD LINK32 bufferoverflowU.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib ws2_32.lib /nologo /dll /debug /machine:I386 /out:"Debug64/portcheck.nsm" /pdbtype:sept /libpath:"..\..\..\libnetxms\Debug64" /machine:AMD64
-# SUBTRACT LINK32 /pdb:none
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy files
-PostBuild_Cmds=copy Debug64\portcheck.nsm ..\..\..\..\bin64
-# End Special Build Tool
-
-!ENDIF 
-
-# Begin Target
-
-# Name "portcheck - Win32 Release"
-# Name "portcheck - Win32 Debug"
-# Name "portcheck - Win32 Release AMD64"
-# Name "portcheck - Win32 Debug AMD64"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\custom.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\http.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\main.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\net.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\pop3.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\smtp.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\ssh.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\telnet.cpp
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\main.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\net.h
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\..\..\include\netxms-regex.h"
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\include\nms_agent.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\include\nms_common.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\pop3.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\ssh.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
index 728ab02..2a2c4fe 100644 (file)
@@ -4,7 +4,7 @@ lib_LTLIBRARIES = libnsm_sms.la
 libnsm_sms_la_SOURCES = main.cpp sender.cpp
 libnsm_sms_la_LDFLAGS = ../../../libnetxms/libnetxms.la
 
-EXTRA_DIST = sms.h sms.dsw sms.dsp
+EXTRA_DIST = sms.h sms.dsw sms.vcproj
 
 install-exec-hook:
        if test "x`uname -s`" = "xAIX" ; then \
diff --git a/src/agent/subagents/sms/sms.dsp b/src/agent/subagents/sms/sms.dsp
deleted file mode 100644 (file)
index 390eb46..0000000
+++ /dev/null
@@ -1,217 +0,0 @@
-# Microsoft Developer Studio Project File - Name="sms" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=sms - Win32 Debug AMD64
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "sms.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "sms.mak" CFG="sms - Win32 Debug AMD64"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "sms - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "sms - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "sms - Win32 Release AMD64" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "sms - Win32 Debug AMD64" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "sms - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "sms_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "..\..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "sms_EXPORTS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib ws2_32.lib hid.lib setupapi.lib /nologo /dll /machine:I386 /out:"Release/sms.nsm" /libpath:"..\..\..\libnetxms\Release"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy files
-PostBuild_Cmds=copy Release\sms.nsm C:\NetXMS\bin
-# End Special Build Tool
-
-!ELSEIF  "$(CFG)" == "sms - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 1
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "sms_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "sms_EXPORTS" /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib ws2_32.lib hid.lib setupapi.lib /nologo /dll /debug /machine:I386 /out:"Debug/sms.nsm" /pdbtype:sept /libpath:"..\..\..\libnetxms\Debug"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy files
-PostBuild_Cmds=copy Debug\sms.nsm ..\..\..\..\bin
-# End Special Build Tool
-
-!ELSEIF  "$(CFG)" == "sms - Win32 Release AMD64"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "sms___Win32_Release_AMD64"
-# PROP BASE Intermediate_Dir "sms___Win32_Release_AMD64"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release64"
-# PROP Intermediate_Dir "Release64"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /O2 /I "..\..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "sms_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "..\..\..\..\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "sms_EXPORTS" /D "__64BIT__" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib ws2_32.lib hid.lib setupapi.lib /nologo /dll /machine:I386 /out:"Release/sms.nsm" /libpath:"..\..\..\libnetxms\Release"
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib ws2_32.lib hid.lib setupapi.lib bufferoverflowU.lib /nologo /dll /machine:I386 /out:"Release64/sms.nsm" /libpath:"..\..\..\libnetxms\Release64" /machine:AMD64
-# SUBTRACT LINK32 /pdb:none
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy files
-PostBuild_Cmds=copy Release64\sms.nsm C:\NetXMS\bin64
-# End Special Build Tool
-
-!ELSEIF  "$(CFG)" == "sms - Win32 Debug AMD64"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "sms___Win32_Debug_AMD64"
-# PROP BASE Intermediate_Dir "sms___Win32_Debug_AMD64"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug64"
-# PROP Intermediate_Dir "Debug64"
-# PROP Ignore_Export_Lib 1
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "sms_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /Zi /Od /I "..\..\..\..\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "sms_EXPORTS" /D "__64BIT__" /FD /GZ /Wp64 /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib ws2_32.lib hid.lib setupapi.lib /nologo /dll /debug /machine:I386 /out:"Debug/sms.nsm" /pdbtype:sept /libpath:"..\..\..\libnetxms\Debug"
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib ws2_32.lib hid.lib setupapi.lib bufferoverflowU.lib /nologo /dll /debug /machine:I386 /out:"Debug64/sms.nsm" /pdbtype:sept /libpath:"..\..\..\libnetxms\Debug64" /machine:AMD64
-# SUBTRACT LINK32 /pdb:none
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy files
-PostBuild_Cmds=copy Debug64\sms.nsm ..\..\..\..\bin64
-# End Special Build Tool
-
-!ENDIF 
-
-# Begin Target
-
-# Name "sms - Win32 Release"
-# Name "sms - Win32 Debug"
-# Name "sms - Win32 Release AMD64"
-# Name "sms - Win32 Debug AMD64"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\main.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\sender.cpp
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE="..\..\..\..\include\netxms-version.h"
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\include\nms_agent.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\include\nms_common.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\include\nms_threads.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\include\nms_util.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\sms.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
index 040be0b..f91b578 100644 (file)
@@ -2,7 +2,7 @@
 
 /*
  ** NetXMS subagent for SunOS/Solaris
- ** Copyright (C) 2004, 2005 Victor Kirhenshtein
+ ** Copyright (C) 2004-2009 Victor Kirhenshtein
  **
  ** This program is free software; you can redistribute it and/or modify
  ** it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@
  ** along with this program; if not, write to the Free Software
  ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  **
- ** $module: main.cpp
+ ** File: main.cpp
  **
  **/
 
@@ -102,6 +102,7 @@ static void UnloadHandler(void)
 static NETXMS_SUBAGENT_PARAM m_parameters[] =
 {
        { "Agent.SourcePackageSupport", H_SourcePkg, NULL, DCI_DT_INT, DCIDESC_AGENT_SOURCEPACKAGESUPPORT },
+       
        { "Disk.Avail(*)", H_DiskInfo, (char *)DISK_AVAIL, DCI_DT_UINT64, DCIDESC_DISK_AVAIL },
        { "Disk.AvailPerc(*)", H_DiskInfo, (char *)DISK_AVAIL_PERC, DCI_DT_FLOAT, DCIDESC_DISK_AVAILPERC },
        { "Disk.Free(*)", H_DiskInfo, (char *)DISK_FREE, DCI_DT_UINT64, DCIDESC_DISK_FREE },
@@ -109,6 +110,7 @@ static NETXMS_SUBAGENT_PARAM m_parameters[] =
        { "Disk.Total(*)", H_DiskInfo, (char *)DISK_TOTAL, DCI_DT_UINT64, DCIDESC_DISK_TOTAL },
        { "Disk.Used(*)", H_DiskInfo, (char *)DISK_USED, DCI_DT_UINT64, DCIDESC_DISK_USED },
        { "Disk.UsedPerc(*)", H_DiskInfo, (char *)DISK_USED_PERC, DCI_DT_FLOAT, DCIDESC_DISK_USEDPERC },
+       
        { "Net.Interface.AdminStatus(*)", H_NetIfAdminStatus, NULL, DCI_DT_INT, DCIDESC_NET_INTERFACE_ADMINSTATUS },
        { "Net.Interface.BytesIn(*)", H_NetInterfaceStats, "rbytes", DCI_DT_UINT, DCIDESC_NET_INTERFACE_BYTESIN },
        { "Net.Interface.BytesOut(*)", H_NetInterfaceStats, "obytes", DCI_DT_UINT, DCIDESC_NET_INTERFACE_BYTESOUT },
@@ -119,10 +121,18 @@ static NETXMS_SUBAGENT_PARAM m_parameters[] =
        { "Net.Interface.PacketsIn(*)", H_NetInterfaceStats, "ipackets", DCI_DT_UINT, DCIDESC_NET_INTERFACE_PACKETSIN },
        { "Net.Interface.PacketsOut(*)", H_NetInterfaceStats, "opackets", DCI_DT_UINT, DCIDESC_NET_INTERFACE_PACKETSOUT },
        { "Net.Interface.Speed(*)", H_NetInterfaceStats, "ifspeed", DCI_DT_UINT, DCIDESC_NET_INTERFACE_SPEED },
-       { "Process.Count(*)", H_ProcessCount, NULL, DCI_DT_UINT, DCIDESC_PROCESS_COUNT },
-       { "Process.KernelTime(*)", H_ProcessInfo, (char *)PROCINFO_KTIME, DCI_DT_UINT64, DCIDESC_PROCESS_KERNELTIME },
-       { "Process.PageFaults(*)", H_ProcessInfo, (char *)PROCINFO_PF, DCI_DT_UINT64, DCIDESC_PROCESS_PAGEFAULTS },
-       { "Process.UserTime(*)", H_ProcessInfo, (char *)PROCINFO_UTIME, DCI_DT_UINT64, DCIDESC_PROCESS_USERTIME },
+
+       { "Process.Count(*)", H_ProcessCount, "S", DCI_DT_UINT, DCIDESC_PROCESS_COUNT },
+       { "Process.CountEx(*)", H_ProcessCount, "E", DCI_DT_UINT, DCIDESC_PROCESS_COUNTEX },
+       { "Process.CPUTime(*)", H_ProcessInfo, CAST_TO_POINTER(PROCINFO_CPUTIME, const char *), DCI_DT_UINT64, DCIDESC_PROCESS_CPUTIME },
+       { "Process.KernelTime(*)", H_ProcessInfo, CAST_TO_POINTER(PROCINFO_KTIME, const char *), DCI_DT_UINT64, DCIDESC_PROCESS_KERNELTIME },
+       { "Process.PageFaults(*)", H_ProcessInfo, CAST_TO_POINTER(PROCINFO_PF, const char *), DCI_DT_UINT64, DCIDESC_PROCESS_PAGEFAULTS },
+       { "Process.Syscalls(*)", H_ProcessInfo, CAST_TO_POINTER(PROCINFO_SYSCALLS, const char *), DCI_DT_UINT64, DCIDESC_PROCESS_SYSCALLS },
+       { "Process.Threads(*)", H_ProcessInfo, CAST_TO_POINTER(PROCINFO_THREADS, const char *), DCI_DT_UINT, DCIDESC_PROCESS_THREADS },
+       { "Process.UserTime(*)", H_ProcessInfo,  CAST_TO_POINTER(PROCINFO_UTIME, const char *), DCI_DT_UINT64, DCIDESC_PROCESS_USERTIME },
+       { "Process.VMSize(*)", H_ProcessInfo, CAST_TO_POINTER(PROCINFO_VMSIZE, const char *), DCI_DT_UINT64, DCIDESC_PROCESS_VMSIZE },
+       { "Process.WkSet(*)", H_ProcessInfo, CAST_TO_POINTER(PROCINFO_WKSET, const char *), DCI_DT_UINT64, DCIDESC_PROCESS_WKSET },
+
        { "System.CPU.Count", H_CPUCount, NULL, DCI_DT_UINT, DCIDESC_SYSTEM_CPU_COUNT },
        { "System.CPU.LoadAvg", H_LoadAvg, (char *)0, DCI_DT_FLOAT, DCIDESC_SYSTEM_CPU_LOADAVG },
        { "System.CPU.LoadAvg5", H_LoadAvg, (char *)1, DCI_DT_FLOAT, DCIDESC_SYSTEM_CPU_LOADAVG5 },
index b1d20cd..5d4d981 100644 (file)
@@ -1,8 +1,6 @@
-/* $Id$ */
-
 /*
  ** NetXMS subagent for SunOS/Solaris
- ** Copyright (C) 2004 Victor Kirhenshtein
+ ** Copyright (C) 2004-2009 Victor Kirhenshtein
  **
  ** This program is free software; you can redistribute it and/or modify
  ** it under the terms of the GNU General Public License as published by
@@ -18,7 +16,7 @@
  ** along with this program; if not, write to the Free Software
  ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  **
- ** $module: process.cpp
+ ** File: process.cpp
  **
  **/
 
@@ -64,13 +62,21 @@ static int ProcFilter(const struct dirent *pEnt)
 
 
 //
-// Read process list from /proc filesystem
-// Returns only processes with names matched to pszPattern
-// (currently with strcmp) ot, if pszPattern is NULL, all
-// processes in the system.
+// Read process information from /proc system
+// Parameters:
+//    pEnt - If not NULL, ProcRead() will return pointer to dynamically
+//           allocated array of process information structures for
+//           matched processes. Caller should free it with free().
+//    pszProcName - If not NULL, only processes with matched name will
+//                  be counted and read. If szCmdLine is NULL, then exact
+//                  match required to pass filter; otherwise szProcName can
+//                  be a regular expression.
+//    pszCmdLine - If not NULL, only processes with command line matched to
+//                 regular expression will be counted and read.
+// Return value: number of matched processes or -1 in case of error.
 //
 
-static int ProcRead(PROC_ENT **pEnt, char *pszPattern)
+static int ProcRead(PROC_ENT **pEnt, char *pszProcName, char *pszCmdLine)
 {
        struct dirent **pNameList;
        int nCount, nFound;
@@ -117,7 +123,22 @@ static int ProcRead(PROC_ENT **pEnt, char *pszPattern)
 
                                if (read(hFile, &psi, sizeof(psinfo_t)) == sizeof(psinfo_t))
                                {
-                                       if ((pszPattern == NULL) || (!strcmp(psi.pr_fname, CHECK_NULL_EX(pszPattern))))
+                                       BOOL nameMatch = TRUE, cmdLineMatch = TRUE;
+
+                                       if (pszProcName != NULL)
+                                       {
+                                               if (pszCmdLine == NULL)         // Match like in Process.Count()
+                                                       nameMatch = !strcmp(psi.pr_fname, pszProcName);
+                                               else
+                                                       nameMatch = RegexpMatch(psi.pr_fname, pszProcName, FALSE);
+                                       }
+
+                                       if ((pszCmdLine != NULL) && (*pszCmdLine != 0))
+                                       {
+                                               cmdLineMatch = RegexpMatch(psi.pr_psargs, pszCmdLine, TRUE);
+                                       }
+
+                                       if (nameMatch && cmdLineMatch)
                                        {
                                                if (pEnt != NULL)
                                                {
@@ -150,7 +171,7 @@ LONG H_ProcessList(const char *pszParam, const char *pArg, NETXMS_VALUES_LIST *p
        int i, nProc;
        char szBuffer[256];
 
-       nProc = ProcRead(&pList, NULL);
+       nProc = ProcRead(&pList, NULL, NULL);
        if (nProc != -1)
        {
                for(i = 0; i < nProc; i++)
@@ -171,20 +192,23 @@ LONG H_ProcessList(const char *pszParam, const char *pArg, NETXMS_VALUES_LIST *p
 
 
 //
-// Handler for Process.Count(*) parameter
+// Handler for Process.Count(*) and Process.CountEx(*) parameters
 //
 
-LONG H_ProcessCount(const char *pszParam, const char *pArg, char *pValue)
+LONG H_ProcessCount(const char *param, const char *arg, char *value)
 {
        int nRet = SYSINFO_RC_ERROR;
-       char szArg[128] = "";
+       char procName[256] = "", cmdLine[256] = "";
        int nCount;
 
-       NxGetParameterArg(pszParam, 1, szArg, sizeof(szArg));
-       nCount = ProcRead(NULL, szArg);
+       NxGetParameterArg(param, 1, procName, sizeof(procName));
+       if (*arg == 'E')        // Process.CountEx
+               NxGetParameterArg(param, 2, cmdLine, sizeof(cmdLine));
+
+       nCount = ProcRead(NULL, (procName[0] != 0) ? procName : NULL, (*arg == 'E') ? cmdLine : NULL);
        if (nCount >= 0)
        {
-               ret_int(pValue, nCount);
+               ret_int(value, nCount);
                nRet = SYSINFO_RC_SUCCESS;
        }
 
@@ -239,14 +263,31 @@ static BOOL GetProcessAttribute(pid_t nPid, int nAttr, int nType,
        char szFileName[MAX_PATH];
        prusage_t usage;
        pstatus_t status;
+       psinfo_t info;
        BOOL bResult = TRUE;
 
        // Get value for current process instance
        switch(nAttr)
        {
                case PROCINFO_VMSIZE:
+                       if (ReadProcFile(nPid, "psinfo", &info, sizeof(psinfo_t)))
+                       {
+                               qwValue = info.pr_size * 1024;
+                       }
+                       else
+                       {
+                               bResult = FALSE;
+                       }
                        break;
                case PROCINFO_WKSET:
+                       if (ReadProcFile(nPid, "psinfo", &info, sizeof(psinfo_t)))
+                       {
+                               qwValue = info.pr_rssize * 1024;
+                       }
+                       else
+                       {
+                               bResult = FALSE;
+                       }
                        break;
                case PROCINFO_PF:
                        if (ReadProcFile(nPid, "usage", &usage, sizeof(prusage_t)))
@@ -258,11 +299,31 @@ static BOOL GetProcessAttribute(pid_t nPid, int nAttr, int nType,
                                bResult = FALSE;
                        }
                        break;
+               case PROCINFO_SYSCALLS:
+                       if (ReadProcFile(nPid, "usage", &usage, sizeof(prusage_t)))
+                       {
+                               qwValue = usage.pr_sysc;
+                       }
+                       else
+                       {
+                               bResult = FALSE;
+                       }
+                       break;
+               case PROCINFO_THREADS:
+                       if (ReadProcFile(nPid, "status", &status, sizeof(pstatus_t)))
+                       {
+                               qwValue = status.pr_nlwp;
+                       }
+                       else
+                       {
+                               bResult = FALSE;
+                       }
+                       break;
                case PROCINFO_KTIME:
                        if (ReadProcFile(nPid, "status", &status, sizeof(pstatus_t)))
                        {
                                qwValue = status.pr_stime.tv_sec * 1000 + 
-                                       status.pr_stime.tv_nsec / 1000000;
+                                         status.pr_stime.tv_nsec / 1000000;
                        }
                        else
                        {
@@ -273,13 +334,25 @@ static BOOL GetProcessAttribute(pid_t nPid, int nAttr, int nType,
                        if (ReadProcFile(nPid, "status", &status, sizeof(pstatus_t)))
                        {
                                qwValue = status.pr_utime.tv_sec * 1000 + 
-                                       status.pr_utime.tv_nsec / 1000000;
+                                         status.pr_utime.tv_nsec / 1000000;
                        }
                        else
                        {
                                bResult = FALSE;
                        }
                        break;
+               case PROCINFO_CPUTIME:
+                       if (ReadProcFile(nPid, "status", &status, sizeof(pstatus_t)))
+                       {
+                               qwValue = status.pr_utime.tv_sec * 1000 + 
+                                         status.pr_utime.tv_nsec / 1000000 +
+                                         status.pr_stime.tv_sec * 1000 + 
+                                         status.pr_stime.tv_nsec / 1000000;
+                       }
+                       else
+                       {
+                               bResult = FALSE;
+                       }
                case PROCINFO_IO_READ_B:
                        break;
                case PROCINFO_IO_READ_OP:
@@ -327,17 +400,17 @@ static BOOL GetProcessAttribute(pid_t nPid, int nAttr, int nType,
 // Handler for Process.XXX parameters
 //
 
-LONG H_ProcessInfo(const char *pszParam, const char *pArg, char *pValue)
+LONG H_ProcessInfo(const char *param, const char *arg, char *value)
 {
        int nRet = SYSINFO_RC_ERROR;
-       char szBuffer[256] = "";
+       char szBuffer[256] = "", procName[256] = "", cmdLine[256] = "";
        int i, nCount, nType;
        PROC_ENT *pList;
        QWORD qwValue;
        static char *pszTypeList[]={ "min", "max", "avg", "sum", NULL };
 
        // Get parameter type arguments
-       NxGetParameterArg(pszParam, 2, szBuffer, sizeof(szBuffer));
+       NxGetParameterArg(param, 2, szBuffer, sizeof(szBuffer));
        if (szBuffer[0] == 0)     // Omited type
        {
                nType = INFOTYPE_SUM;
@@ -351,16 +424,20 @@ LONG H_ProcessInfo(const char *pszParam, const char *pArg, char *pValue)
                        return SYSINFO_RC_UNSUPPORTED;     // Unsupported type
        }
 
-       NxGetParameterArg(pszParam, 1, szBuffer, sizeof(szBuffer));
-       nCount = ProcRead(&pList, szBuffer);
+       // Get process name
+       NxGetParameterArg(param, 1, procName, MAX_PATH);
+       NxGetParameterArg(param, 3, cmdLine, MAX_PATH);
+       StrStrip(cmdLine);
+
+       nCount = ProcRead(&pList, (procName[0] != 0) ? procName : NULL, (cmdLine[0] != 0) ? cmdLine : NULL);
        if (nCount > 0)
        {
                for(i = 0, qwValue = 0; i < nCount; i++)
-                       if (!GetProcessAttribute(pList[i].nPid, (int)pArg, nType, i, &qwValue))
+                       if (!GetProcessAttribute(pList[i].nPid, CAST_FROM_POINTER(arg, int), nType, i, &qwValue))
                                break;
                if (i == nCount)
                {
-                       ret_uint64(pValue, qwValue);
+                       ret_uint64(value, qwValue);
                        nRet = SYSINFO_RC_SUCCESS;
                }
        }
index ac16c34..f6322c2 100644 (file)
@@ -73,6 +73,9 @@
 #define PROCINFO_UTIME           7
 #define PROCINFO_VMSIZE          8
 #define PROCINFO_WKSET           9
+#define PROCINFO_SYSCALLS        10
+#define PROCINFO_THREADS         11
+#define PROCINFO_CPUTIME         12
 
 
 //
index ddbeda8..5398ef3 100644 (file)
@@ -5,7 +5,7 @@ libnsm_ups_la_SOURCES = apc.cpp bcmxcp.cpp main.cpp serial.cpp ups.cpp \
                                                                microdowell.cpp
 libnsm_ups_la_LDFLAGS = ../../../libnetxms/libnetxms.la
 
-EXTRA_DIST = ups.h ups.dsw ups.dsp usb.cpp
+EXTRA_DIST = ups.h ups.vcproj usb.cpp
 
 install-exec-hook:
        if test "x`uname -s`" = "xAIX" ; then \
diff --git a/src/agent/subagents/ups/ups.dsp b/src/agent/subagents/ups/ups.dsp
deleted file mode 100644 (file)
index c05759d..0000000
+++ /dev/null
@@ -1,237 +0,0 @@
-# Microsoft Developer Studio Project File - Name="ups" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=ups - Win32 Debug AMD64
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "ups.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "ups.mak" CFG="ups - Win32 Debug AMD64"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "ups - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "ups - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "ups - Win32 Release AMD64" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "ups - Win32 Debug AMD64" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "ups - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ups_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "..\..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ups_EXPORTS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib ws2_32.lib hid.lib setupapi.lib /nologo /dll /debug /machine:I386 /out:"Release/ups.nsm" /libpath:"..\..\..\libnetxms\Release"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy files
-PostBuild_Cmds=copy Release\ups.nsm C:\NetXMS\bin
-# End Special Build Tool
-
-!ELSEIF  "$(CFG)" == "ups - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 1
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ups_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ups_EXPORTS" /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib ws2_32.lib hid.lib setupapi.lib /nologo /dll /debug /machine:I386 /out:"Debug/ups.nsm" /pdbtype:sept /libpath:"..\..\..\libnetxms\Debug"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy files
-PostBuild_Cmds=copy Debug\ups.nsm ..\..\..\..\bin
-# End Special Build Tool
-
-!ELSEIF  "$(CFG)" == "ups - Win32 Release AMD64"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "ups___Win32_Release_AMD64"
-# PROP BASE Intermediate_Dir "ups___Win32_Release_AMD64"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release64"
-# PROP Intermediate_Dir "Release64"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /O2 /I "..\..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ups_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "..\..\..\..\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ups_EXPORTS" /D "__64BIT__" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib ws2_32.lib hid.lib setupapi.lib /nologo /dll /machine:I386 /out:"Release/ups.nsm" /libpath:"..\..\..\libnetxms\Release"
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib ws2_32.lib hid.lib setupapi.lib bufferoverflowU.lib /nologo /dll /machine:I386 /out:"Release64/ups.nsm" /libpath:"..\..\..\libnetxms\Release64" /machine:AMD64
-# SUBTRACT LINK32 /pdb:none
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy files
-PostBuild_Cmds=copy Release64\ups.nsm C:\NetXMS\bin64
-# End Special Build Tool
-
-!ELSEIF  "$(CFG)" == "ups - Win32 Debug AMD64"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "ups___Win32_Debug_AMD64"
-# PROP BASE Intermediate_Dir "ups___Win32_Debug_AMD64"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug64"
-# PROP Intermediate_Dir "Debug64"
-# PROP Ignore_Export_Lib 1
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ups_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /Zi /Od /I "..\..\..\..\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ups_EXPORTS" /D "__64BIT__" /FD /GZ /Wp64 /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib ws2_32.lib hid.lib setupapi.lib /nologo /dll /debug /machine:I386 /out:"Debug/ups.nsm" /pdbtype:sept /libpath:"..\..\..\libnetxms\Debug"
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib ws2_32.lib hid.lib setupapi.lib bufferoverflowU.lib /nologo /dll /debug /machine:I386 /out:"Debug64/ups.nsm" /pdbtype:sept /libpath:"..\..\..\libnetxms\Debug64" /machine:AMD64
-# SUBTRACT LINK32 /pdb:none
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy files
-PostBuild_Cmds=copy Debug64\ups.nsm ..\..\..\..\bin64
-# End Special Build Tool
-
-!ENDIF 
-
-# Begin Target
-
-# Name "ups - Win32 Release"
-# Name "ups - Win32 Debug"
-# Name "ups - Win32 Release AMD64"
-# Name "ups - Win32 Debug AMD64"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\apc.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\bcmxcp.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\main.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\microdowell.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\serial.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\ups.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\usb.cpp
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE="..\..\..\..\include\netxms-version.h"
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\include\nms_agent.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\include\nms_common.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\include\nms_threads.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\include\nms_util.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\ups.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
index 5ac2131..bf0d74e 100644 (file)
@@ -11,6 +11,4 @@
 EXTRA_DIST = \
        main.cpp \
        procinfo.cpp \
-       win9x.dsp \
-       win9x.dsw \
        win9x_subagent.h
diff --git a/src/agent/subagents/win9x/win9x.dsp b/src/agent/subagents/win9x/win9x.dsp
deleted file mode 100644 (file)
index 3d79fa1..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-# Microsoft Developer Studio Project File - Name="win9x" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=win9x - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "win9x.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "win9x.mak" CFG="win9x - Win32 Debug"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "win9x - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "win9x - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "win9x - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "win9x_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX- /O2 /I "..\..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "win9x_EXPORTS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib /nologo /dll /machine:I386 /out:"Release/win9x.nsm" /libpath:"..\..\..\libnetxms\Release"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy files
-PostBuild_Cmds=copy Release\win9x.nsm C:\NetXMS\bin
-# End Special Build Tool
-
-!ELSEIF  "$(CFG)" == "win9x - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "win9x_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX- /ZI /Od /I "..\..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "win9x_EXPORTS" /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib /nologo /dll /debug /machine:I386 /out:"Debug/win9x.nsm" /pdbtype:sept /libpath:"..\..\..\libnetxms\Debug"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy files
-PostBuild_Cmds=copy Debug\win9x.nsm ..\..\..\..\bin
-# End Special Build Tool
-
-!ENDIF 
-
-# Begin Target
-
-# Name "win9x - Win32 Release"
-# Name "win9x - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\main.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\procinfo.cpp
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=..\..\..\..\include\nms_agent.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\include\nms_threads.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\include\nms_util.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\win9x_subagent.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
index a6b5893..a3947a0 100644 (file)
@@ -13,6 +13,5 @@ EXTRA_DIST = \
        net.cpp \
        procinfo.cpp \
        system.cpp \
-       winnt.dsp \
-       winnt.dsw \
+       winnt.vcproj \
        winnt_subagent.h
index 4ecb06e..64512ea 100644 (file)
@@ -121,7 +121,8 @@ static NETXMS_SUBAGENT_PARAM m_parameters[] =
        { "Net.RemoteShareStatusText(*)", H_RemoteShareStatus, "T", DCI_DT_STRING, _T("Status of remote shared resource as text") },
        { "Process.Count(*)", H_ProcCountSpecific, "N", DCI_DT_INT, DCIDESC_PROCESS_COUNT },
        { "Process.CountEx(*)", H_ProcCountSpecific, "E", DCI_DT_INT, DCIDESC_PROCESS_COUNTEX },
-       { "Process.GdiObj(*)", H_ProcInfo, (char *)PROCINFO_GDI_OBJ, DCI_DT_UINT64, DCIDESC_PROCESS_GDIOBJ },
+       { "Process.CPUTime(*)", H_ProcInfo, (char *)PROCINFO_CPUTIME, DCI_DT_UINT64, DCIDESC_PROCESS_CPUTIME },
+       { "Process.GDIObjects(*)", H_ProcInfo, (char *)PROCINFO_GDI_OBJ, DCI_DT_UINT64, DCIDESC_PROCESS_GDIOBJ },
        { "Process.IO.OtherB(*)", H_ProcInfo, (char *)PROCINFO_IO_OTHER_B, DCI_DT_UINT64, DCIDESC_PROCESS_IO_OTHERB },
        { "Process.IO.OtherOp(*)", H_ProcInfo, (char *)PROCINFO_IO_OTHER_OP, DCI_DT_UINT64, DCIDESC_PROCESS_IO_OTHEROP },
        { "Process.IO.ReadB(*)", H_ProcInfo, (char *)PROCINFO_IO_READ_B, DCI_DT_UINT64, DCIDESC_PROCESS_IO_READB },
@@ -130,14 +131,14 @@ static NETXMS_SUBAGENT_PARAM m_parameters[] =
        { "Process.IO.WriteOp(*)", H_ProcInfo, (char *)PROCINFO_IO_WRITE_OP, DCI_DT_UINT64, DCIDESC_PROCESS_IO_WRITEOP },
        { "Process.KernelTime(*)", H_ProcInfo, (char *)PROCINFO_KTIME, DCI_DT_UINT64, DCIDESC_PROCESS_KERNELTIME },
        { "Process.PageFaults(*)", H_ProcInfo, (char *)PROCINFO_PF, DCI_DT_UINT64, DCIDESC_PROCESS_PAGEFAULTS },
-       { "Process.UserObj(*)", H_ProcInfo, (char *)PROCINFO_USER_OBJ, DCI_DT_UINT64, DCIDESC_PROCESS_USEROBJ },
+       { "Process.UserObjects(*)", H_ProcInfo, (char *)PROCINFO_USER_OBJ, DCI_DT_UINT64, DCIDESC_PROCESS_USEROBJ },
        { "Process.UserTime(*)", H_ProcInfo, (char *)PROCINFO_UTIME, DCI_DT_UINT64, DCIDESC_PROCESS_USERTIME },
        { "Process.VMSize(*)", H_ProcInfo, (char *)PROCINFO_VMSIZE, DCI_DT_UINT64, DCIDESC_PROCESS_VMSIZE },
        { "Process.WkSet(*)", H_ProcInfo, (char *)PROCINFO_WKSET, DCI_DT_UINT64, DCIDESC_PROCESS_WKSET },
        { "System.ConnectedUsers", H_ConnectedUsers, NULL, DCI_DT_INT, DCIDESC_SYSTEM_CONNECTEDUSERS },
-       { "System.ProcessCount", H_ProcCount, NULL, DCI_DT_INT, DCIDESC_SYSTEM_PROCESSCOUNT },
+       { "System.ProcessCount", H_ProcCount, NULL, DCI_DT_UINT, DCIDESC_SYSTEM_PROCESSCOUNT },
        { "System.ServiceState(*)", H_ServiceState, NULL, DCI_DT_INT, DCIDESC_SYSTEM_SERVICESTATE },
-       { "System.ThreadCount", H_ThreadCount, NULL, DCI_DT_INT, DCIDESC_SYSTEM_THREADCOUNT }
+       { "System.ThreadCount", H_ThreadCount, NULL, DCI_DT_UINT, DCIDESC_SYSTEM_THREADCOUNT }
 };
 static NETXMS_SUBAGENT_ENUM m_enums[] =
 {
index c2d8484..07d1b48 100644 (file)
@@ -85,11 +85,11 @@ static unsigned __int64 GetProcessAttribute(HANDLE hProcess, int attr, int type,
    {
       case PROCINFO_VMSIZE:
          GetProcessMemoryInfo(hProcess, &mc, sizeof(PROCESS_MEMORY_COUNTERS));
-         value = mc.PagefileUsage/1024;   // Convert to Kbytes
+         value = mc.PagefileUsage;
          break;
       case PROCINFO_WKSET:
          GetProcessMemoryInfo(hProcess, &mc, sizeof(PROCESS_MEMORY_COUNTERS));
-         value = mc.WorkingSetSize/1024;   // Convert to Kbytes
+         value = mc.WorkingSetSize;
          break;
       case PROCINFO_PF:
          GetProcessMemoryInfo(hProcess, &mc, sizeof(PROCESS_MEMORY_COUNTERS));
@@ -100,6 +100,10 @@ static unsigned __int64 GetProcessAttribute(HANDLE hProcess, int attr, int type,
          GetProcessTimes(hProcess, &ftCreate, &ftExit, &ftKernel, &ftUser);
          value = ConvertProcessTime(attr == PROCINFO_KTIME ? &ftKernel : &ftUser);
          break;
+      case PROCINFO_CPUTIME:
+         GetProcessTimes(hProcess, &ftCreate, &ftExit, &ftKernel, &ftUser);
+         value = ConvertProcessTime(&ftKernel) + ConvertProcessTime(&ftUser);
+         break;
       case PROCINFO_GDI_OBJ:
       case PROCINFO_USER_OBJ:
          value = imp_GetGuiResources(hProcess, attr == PROCINFO_GDI_OBJ ? GR_GDIOBJECTS : GR_USEROBJECTS);
diff --git a/src/agent/subagents/winnt/winnt.dsp b/src/agent/subagents/winnt/winnt.dsp
deleted file mode 100644 (file)
index febcf34..0000000
+++ /dev/null
@@ -1,217 +0,0 @@
-# Microsoft Developer Studio Project File - Name="winnt" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=winnt - Win32 Debug AMD64
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "winnt.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "winnt.mak" CFG="winnt - Win32 Debug AMD64"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "winnt - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "winnt - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "winnt - Win32 Release AMD64" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "winnt - Win32 Debug AMD64" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "winnt - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 1
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "winnt_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "..\..\..\..\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "winnt_EXPORTS" /D _WIN32_WINNT=0x0400 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib psapi.lib netapi32.lib /nologo /dll /debug /machine:I386 /out:"Release/winnt.nsm" /pdbtype:sept /libpath:"..\..\..\libnetxms\Release"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy files
-PostBuild_Cmds=copy Release\winnt.nsm C:\NetXMS\bin    copy Release\winnt.pdb C:\NetXMS\bin
-# End Special Build Tool
-
-!ELSEIF  "$(CFG)" == "winnt - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 1
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "winnt_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\..\..\..\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "winnt_EXPORTS" /D _WIN32_WINNT=0x0400 /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib psapi.lib netapi32.lib /nologo /dll /debug /machine:I386 /out:"Debug/winnt.nsm" /pdbtype:sept /libpath:"..\..\..\libnetxms\Debug"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy files
-PostBuild_Cmds=copy Debug\winnt.nsm ..\..\..\..\bin    copy Debug\winnt.pdb ..\..\..\..\bin
-# End Special Build Tool
-
-!ELSEIF  "$(CFG)" == "winnt - Win32 Release AMD64"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "winnt___Win32_Release_AMD64"
-# PROP BASE Intermediate_Dir "winnt___Win32_Release_AMD64"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release64"
-# PROP Intermediate_Dir "Release64"
-# PROP Ignore_Export_Lib 1
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "winnt_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "..\..\..\..\include" /D "NDEBUG" /D "__64BIT__" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "winnt_EXPORTS" /D _WIN32_WINNT=0x0400 /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib psapi.lib /nologo /dll /machine:I386 /out:"Release/winnt.nsm" /libpath:"..\..\..\libnetxms\Release"
-# ADD LINK32 bufferoverflowU.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib psapi.lib netapi32.lib /nologo /dll /debug /machine:I386 /out:"Release64/winnt.nsm" /pdbtype:sept /libpath:"..\..\..\libnetxms\Release64" /machine:AMD64
-# SUBTRACT LINK32 /pdb:none
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy files
-PostBuild_Cmds=copy Release64\winnt.nsm C:\NetXMS\bin64        copy Release64\winnt.pdb C:\NetXMS\bin64
-# End Special Build Tool
-
-!ELSEIF  "$(CFG)" == "winnt - Win32 Debug AMD64"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "winnt___Win32_Debug_AMD64"
-# PROP BASE Intermediate_Dir "winnt___Win32_Debug_AMD64"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug64"
-# PROP Intermediate_Dir "Debug64"
-# PROP Ignore_Export_Lib 1
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "winnt_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\..\..\..\include" /D "_DEBUG" /D "__64BIT__" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "winnt_EXPORTS" /D _WIN32_WINNT=0x0400 /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib psapi.lib /nologo /dll /debug /machine:I386 /out:"Debug/winnt.nsm" /pdbtype:sept /libpath:"..\..\..\libnetxms\Debug"
-# ADD LINK32 bufferoverflowU.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib psapi.lib netapi32.lib /nologo /dll /debug /machine:I386 /out:"Debug64/winnt.nsm" /pdbtype:sept /libpath:"..\..\..\libnetxms\Debug64" /machine:AMD64
-# SUBTRACT LINK32 /pdb:none
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy files
-PostBuild_Cmds=copy Debug64\winnt.nsm ..\..\..\..\bin64        copy Debug64\winnt.pdb ..\..\..\..\bin64
-# End Special Build Tool
-
-!ENDIF 
-
-# Begin Target
-
-# Name "winnt - Win32 Release"
-# Name "winnt - Win32 Debug"
-# Name "winnt - Win32 Release AMD64"
-# Name "winnt - Win32 Debug AMD64"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\main.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\net.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\procinfo.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\system.cpp
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=..\..\..\..\include\nms_agent.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\include\nms_threads.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\include\nms_util.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\winnt_subagent.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
index ee0120b..a1d9b4b 100644 (file)
@@ -50,6 +50,7 @@
 #define PROCINFO_UTIME           11
 #define PROCINFO_VMSIZE          12
 #define PROCINFO_WKSET           13
+#define PROCINFO_CPUTIME         14
 
 #define INFOTYPE_MIN             0
 #define INFOTYPE_MAX             1
index 006d42a..97cff4a 100644 (file)
@@ -10,4 +10,4 @@
 
 EXTRA_DIST = \
     collect.cpp tools.cpp winperf.cpp winperf.h \
-    winperf.dsp winperf.dsw
+    winperf.vcproj
index c324c8e..67a56c6 100644 (file)
@@ -381,7 +381,7 @@ static NETXMS_SUBAGENT_PARAM m_parameters[] =
    { _T("System.CPU.Usage(*)"), H_CPUUsage, "1", DCI_DT_INT, "Average CPU {instance} utilization for last minute" },
    { _T("System.CPU.Usage5(*)"), H_CPUUsage, "2", DCI_DT_INT, "Average CPU {instance} utilization for last 5 minutes" },
    { _T("System.CPU.Usage15(*)"), H_CPUUsage, "3", DCI_DT_INT, "Average CPU {instance} utilization for last 15 minutes" },
-   { _T("System.ThreadCount"), H_CounterAlias, _T("\\System\\Threads"), DCI_DT_INT, _T("Total number of threads") },
+   { _T("System.ThreadCount"), H_CounterAlias, _T("\\System\\Threads"), DCI_DT_UINT, _T("Total number of threads") },
    { _T("System.Uptime"), H_CounterAlias, _T("\\System\\System Up Time"), DCI_DT_UINT, _T("System uptime") }
 };
 static NETXMS_SUBAGENT_ENUM m_enums[] =
diff --git a/src/agent/subagents/winperf/winperf.dsp b/src/agent/subagents/winperf/winperf.dsp
deleted file mode 100644 (file)
index abfee7b..0000000
+++ /dev/null
@@ -1,213 +0,0 @@
-# Microsoft Developer Studio Project File - Name="winperf" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=winperf - Win32 Debug AMD64
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "winperf.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "winperf.mak" CFG="winperf - Win32 Debug AMD64"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "winperf - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "winperf - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "winperf - Win32 Release AMD64" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "winperf - Win32 Debug AMD64" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "winperf - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 1
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "winperf_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "..\..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "winperf_EXPORTS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib pdh.lib /nologo /dll /debug /machine:I386 /out:"Release/winperf.nsm" /pdbtype:sept /libpath:"..\..\..\libnetxms\Release"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy files
-PostBuild_Cmds=copy Release\winperf.nsm C:\NetXMS\bin  copy Release\winperf.pdb C:\NetXMS\bin
-# End Special Build Tool
-
-!ELSEIF  "$(CFG)" == "winperf - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 1
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "winperf_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "winperf_EXPORTS" /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib pdh.lib /nologo /dll /debug /machine:I386 /out:"Debug/winperf.nsm" /pdbtype:sept /libpath:"..\..\..\libnetxms\Debug"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy files
-PostBuild_Cmds=copy Debug\winperf.nsm ..\..\..\..\bin  copy Debug\winperf.pdb ..\..\..\..\bin
-# End Special Build Tool
-
-!ELSEIF  "$(CFG)" == "winperf - Win32 Release AMD64"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "winperf___Win32_Release_AMD64"
-# PROP BASE Intermediate_Dir "winperf___Win32_Release_AMD64"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release64"
-# PROP Intermediate_Dir "Release64"
-# PROP Ignore_Export_Lib 1
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "winperf_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "..\..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "winperf_EXPORTS" /D "__64BIT__" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib pdh.lib /nologo /dll /machine:I386 /out:"Release/winperf.nsm" /libpath:"..\..\..\libnetxms\Release"
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib pdh.lib bufferoverflowU.lib /nologo /dll /debug /machine:I386 /out:"Release64/winperf.nsm" /pdbtype:sept /libpath:"..\..\..\libnetxms\Release64" /machine:AMD64
-# SUBTRACT LINK32 /pdb:none
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy files
-PostBuild_Cmds=copy Release64\winperf.nsm C:\NetXMS\bin64      copy Release64\winperf.pdb C:\NetXMS\bin64
-# End Special Build Tool
-
-!ELSEIF  "$(CFG)" == "winperf - Win32 Debug AMD64"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "winperf___Win32_Debug_AMD64"
-# PROP BASE Intermediate_Dir "winperf___Win32_Debug_AMD64"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug64"
-# PROP Intermediate_Dir "Debug64"
-# PROP Ignore_Export_Lib 1
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "winperf_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /Zi /Od /I "..\..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "winperf_EXPORTS" /D "__64BIT__" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib pdh.lib /nologo /dll /debug /machine:I386 /out:"Debug/winperf.nsm" /pdbtype:sept /libpath:"..\..\..\libnetxms\Debug"
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib pdh.lib bufferoverflowU.lib /nologo /dll /debug /machine:I386 /out:"Debug64/winperf.nsm" /pdbtype:sept /libpath:"..\..\..\libnetxms\Debug64" /machine:AMD64
-# SUBTRACT LINK32 /pdb:none
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy files
-PostBuild_Cmds=copy Debug64\winperf.nsm ..\..\..\..\bin64      copy Debug64\winperf.pdb ..\..\..\..\bin64
-# End Special Build Tool
-
-!ENDIF 
-
-# Begin Target
-
-# Name "winperf - Win32 Release"
-# Name "winperf - Win32 Debug"
-# Name "winperf - Win32 Release AMD64"
-# Name "winperf - Win32 Debug AMD64"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\collect.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\tools.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\winperf.cpp
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=..\..\..\..\include\nms_agent.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\include\nms_threads.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\include\nms_util.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\winperf.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
index f1898b6..06db06a 100644 (file)
@@ -9,4 +9,4 @@
 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 EXTRA_DIST = \
-    acpi.cpp wmi.cpp wmi.h wmi.dsp wmi.dsw
+    acpi.cpp wmi.cpp wmi.h wmi.vcproj
diff --git a/src/agent/subagents/wmi/wmi.dsp b/src/agent/subagents/wmi/wmi.dsp
deleted file mode 100644 (file)
index 06b34d4..0000000
+++ /dev/null
@@ -1,211 +0,0 @@
-# Microsoft Developer Studio Project File - Name="wmi" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=wmi - Win32 Debug AMD64
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "wmi.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "wmi.mak" CFG="wmi - Win32 Debug AMD64"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "wmi - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "wmi - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "wmi - Win32 Release AMD64" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "wmi - Win32 Debug AMD64" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "wmi - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 1
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "wmi_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "..\..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "wmi_EXPORTS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib wbemuuid.lib /nologo /dll /machine:I386 /out:"Release/wmi.nsm" /pdbtype:sept /libpath:"..\..\..\libnetxms\Release"
-# SUBTRACT LINK32 /debug
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy files
-PostBuild_Cmds=copy Release\wmi.nsm C:\NetXMS\bin
-# End Special Build Tool
-
-!ELSEIF  "$(CFG)" == "wmi - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 1
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "wmi_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "wmi_EXPORTS" /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib wbemuuid.lib /nologo /dll /machine:I386 /out:"Debug/wmi.nsm" /pdbtype:sept /libpath:"..\..\..\libnetxms\Debug"
-# SUBTRACT LINK32 /debug
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy files
-PostBuild_Cmds=copy Debug\wmi.nsm ..\..\..\..\bin
-# End Special Build Tool
-
-!ELSEIF  "$(CFG)" == "wmi - Win32 Release AMD64"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "wmi___Win32_Release_AMD64"
-# PROP BASE Intermediate_Dir "wmi___Win32_Release_AMD64"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release64"
-# PROP Intermediate_Dir "Release64"
-# PROP Ignore_Export_Lib 1
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "wmi_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "..\..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "wmi_EXPORTS" /D "__64BIT__" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib pdh.lib /nologo /dll /machine:I386 /out:"Release/wmi.nsm" /libpath:"..\..\..\libnetxms\Release"
-# ADD LINK32 bufferoverflowU.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib wbemuuid.lib /nologo /dll /debug /machine:I386 /out:"Release64/wmi.nsm" /pdbtype:sept /libpath:"..\..\..\libnetxms\Release64" /machine:AMD64
-# SUBTRACT LINK32 /pdb:none
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy files
-PostBuild_Cmds=copy Release64\wmi.nsm C:\NetXMS\bin64  copy Release64\wmi.pdb C:\NetXMS\bin64
-# End Special Build Tool
-
-!ELSEIF  "$(CFG)" == "wmi - Win32 Debug AMD64"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "wmi___Win32_Debug_AMD64"
-# PROP BASE Intermediate_Dir "wmi___Win32_Debug_AMD64"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug64"
-# PROP Intermediate_Dir "Debug64"
-# PROP Ignore_Export_Lib 1
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "wmi_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /Zi /Od /I "..\..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "wmi_EXPORTS" /D "__64BIT__" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib pdh.lib /nologo /dll /debug /machine:I386 /out:"Debug/wmi.nsm" /pdbtype:sept /libpath:"..\..\..\libnetxms\Debug"
-# ADD LINK32 bufferoverflowU.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnetxms.lib wbemuuid.lib /nologo /dll /debug /machine:I386 /out:"Debug64/wmi.nsm" /pdbtype:sept /libpath:"..\..\..\libnetxms\Debug64" /machine:AMD64
-# SUBTRACT LINK32 /pdb:none
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy files
-PostBuild_Cmds=copy Debug64\wmi.nsm ..\..\..\..\bin64  copy Debug64\wmi.pdb ..\..\..\..\bin64
-# End Special Build Tool
-
-!ENDIF 
-
-# Begin Target
-
-# Name "wmi - Win32 Release"
-# Name "wmi - Win32 Debug"
-# Name "wmi - Win32 Release AMD64"
-# Name "wmi - Win32 Debug AMD64"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\acpi.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\wmi.cpp
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=..\..\..\..\include\nms_agent.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\include\nms_threads.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\include\nms_util.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\wmi.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project