Merge branch 'develop' into feature/NewView

This commit is contained in:
m-lopez-f 2015-04-28 11:37:27 +02:00
commit e093853691
36 changed files with 605 additions and 60 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 6.0dev-150427
Version: 6.0dev-150428
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="6.0dev-150427"
pandora_version="6.0dev-150428"
echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -41,7 +41,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '6.0dev';
use constant AGENT_BUILD => '150427';
use constant AGENT_BUILD => '150428';
# Commands to retrieve total memory information in kB
use constant TOTALMEMORY_CMDS => {

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 6.0dev
%define release 150427
%define release 150428
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 6.0dev
%define release 150427
%define release 150428
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -191,15 +191,72 @@ module_exec dir "%ProgramFiles%\Avira\AntiVir Desktop\aevdf.dat" | grep aevdf.da
module_description Last update for Antivirus Signature file
module_end
# Windows inventory module (This information will be displayed only in enterprise version)
# Windows inventory module (This information will be displayed only in enterprise version)^M
module_begin
module_name Inventory
module_interval 7
module_type generic_data_string
module_inventory CPU RAM CDROM Video HD Patches Services NIC
module_description Inventory
module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\cpuinfo.vbs"
module_crontab * 12-15 * * 1
module_end
module_begin
module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\moboinfo.vbs"
module_crontab * 12-15 * * 1
module_end
module_begin
module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\diskdrives.vbs"
module_crontab * 12-15 * * 1
module_end
module_begin
module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\cdromdrives.vbs"
module_crontab * 12-15 * * 1
module_end
module_begin
module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\videocardinfo.vbs"
module_crontab * 12-15 * * 1
module_end
module_begin
module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\ifaces.vbs"
module_crontab * 12-15 * * 1
module_end
module_begin
module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\monitors.vbs"
module_crontab * 12-15 * * 1
module_end
module_begin
module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\printers.vbs"
module_crontab * 12-15 * * 1
module_end
module_begin
module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\raminfo.vbs"
module_crontab * 12-15 * * 1
module_end
module_begin
module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\software_installed.vbs"
module_crontab * 12-15 * * 1
module_end
module_begin
module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\userslogged.vbs"
module_crontab * 12-15 * * 1
module_end
module_begin
module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\productkey.vbs"
module_crontab * 12-15 * * 1
module_end
module_begin
module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\productID.vbs"
module_crontab * 12-15 * * 1
module_end
# ----------------------------------------------------------------------------------------------------
# This samples below need to be reconfigured and uncommented. Please read documentation
# on how to setup pandora fms windows agent at http://wiki.pandorafms.com

View File

@ -0,0 +1,29 @@
' Pandora FMS Agent Inventory Plugin for Microsoft Windows (All platfforms)
' (c) 2015 Borja Sanchez <fborja.sanchez@artica.es>
' This plugin extends agent inventory feature. Only enterprise version
' --------------------------------------------------------------------------
on error resume next
'WMI CD_ROM_drives_info
Wscript.StdOut.WriteLine "<inventory>"
Wscript.StdOut.WriteLine "<inventory_module>"
Wscript.StdOut.WriteLine "<name>CDROM</name>"
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
Wscript.StdOut.WriteLine "<datalist>"
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colCDROMDrives = objWMIService.ExecQuery("Select caption,description,drive,deviceid from win32_CDROMDrive")
For Each cdromd In colCDROMDrives
Wscript.StdOut.WriteLine "<data><![CDATA[" & cdromd.caption _
& ";" & cdromd.description _
& ";" & cdromd.drive _
& ";" & cdromd.deviceid _
& "]]></data>"
Next
Wscript.StdOut.WriteLine "</datalist>"
Wscript.StdOut.WriteLine "</inventory_module>"
Wscript.StdOut.WriteLine "</inventory>"

View File

@ -0,0 +1,21 @@
on error resume next
'WMI cpuinfo
Wscript.StdOut.WriteLine "<inventory>"
Wscript.StdOut.WriteLine "<inventory_module>"
Wscript.StdOut.WriteLine "<name>CPU</name>"
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
Wscript.StdOut.WriteLine "<datalist>"
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colCPUs = objWMIService.ExecQuery("Select name,maxclockspeed,caption from Win32_Processor")
For Each cpu In colCPUs
Wscript.StdOut.WriteLine "<data><![CDATA[" & cpu.name & ";" & cpu.maxclockspeed & " MHz;" & cpu.caption & "]]></data>"
Next
Wscript.StdOut.WriteLine "</datalist>"
Wscript.StdOut.WriteLine "</inventory_module>"
Wscript.StdOut.WriteLine "</inventory>"

View File

@ -0,0 +1,34 @@
' Pandora FMS Agent Inventory Plugin for Microsoft Windows (All platfforms)
' (c) 2015 Borja Sanchez <fborja.sanchez@artica.es>
' This plugin extends agent inventory feature. Only enterprise version
' --------------------------------------------------------------------------
on error resume next
'WMI disksinfo
Wscript.StdOut.WriteLine "<inventory>"
Wscript.StdOut.WriteLine "<inventory_module>"
Wscript.StdOut.WriteLine "<name>HD</name>"
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
Wscript.StdOut.WriteLine "<datalist>"
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colHDDs = objWMIService.ExecQuery("Select * from win32_diskdrive")
For Each disco In colHDDs
If ((not IsNull(disco.size)) AND (disco.size > 0)) then
Wscript.StdOut.Write "<data><![CDATA[" & disco.caption _
& ";" & Abs(Round((disco.size/(1024*1024*1024)),2)) & " GB"
If (not IsNull(disco.serialnumber)) then
Wscript.StdOut.Write ";" & disco.serialnumber
Else
Wscript.StdOut.Write ";" & disco.signature
End If
Wscript.StdOut.WriteLine "]]></data>"
End If
Next
Wscript.StdOut.WriteLine "</datalist>"
Wscript.StdOut.WriteLine "</inventory_module>"
Wscript.StdOut.WriteLine "</inventory>"

View File

@ -0,0 +1,42 @@
' Pandora FMS Agent Inventory Plugin for Microsoft Windows (All platfforms)
' (c) 2015 Borja Sanchez <fborja.sanchez@artica.es>
' This plugin extends agent inventory feature. Only enterprise version
' --------------------------------------------------------------------------
on error resume next
'WMI real interfaces info
' exlusions:
' VBox network interfaces
' VMWare network interfaces
'
'nic where "guid is not null and not PNPDeviceID like 'ROOT%'"
Wscript.StdOut.WriteLine "<inventory>"
Wscript.StdOut.WriteLine "<inventory_module>"
Wscript.StdOut.WriteLine "<name>NIC</name>"
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
Wscript.StdOut.WriteLine "<datalist>"
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colAdapters = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter " & _
"Where not PNPDeviceID like 'ROOT%%' " & _
"and not PNPDeviceID like 'SW%%' " & _
"and not ServiceName is null " & _
"and not ServiceName like 'vwifimp' ")
For Each iface In colAdapters
' return model MACAddress IPAddress
set ifaces_cfg = objWMIService.ExecQuery("Select ipaddress from Win32_NetworkAdapterConfiguration Where Caption='" & iface.caption & "'")
Wscript.StdOut.Write "<data><![CDATA[" & iface.ProductName & ";" & iface.MACAddress & ";"
for each iface_cfg in ifaces_cfg
if ( iface_cfg.IPAddress(0) <> "" ) then
Wscript.StdOut.Write trim(iface_cfg.IPAddress(0))
end if
next
wscript.stdOut.WriteLine "]]></data>"
Next
Wscript.StdOut.WriteLine "</datalist>"
Wscript.StdOut.WriteLine "</inventory_module>"
Wscript.StdOut.WriteLine "</inventory>"

View File

@ -0,0 +1,26 @@
' Pandora FMS Agent Inventory Plugin for Microsoft Windows (All platfforms)
' (c) 2015 Borja Sanchez <fborja.sanchez@artica.es>
' This plugin extends agent inventory feature. Only enterprise version
' --------------------------------------------------------------------------
on error resume next
'WMI mobo info
Wscript.StdOut.WriteLine "<inventory>"
Wscript.StdOut.WriteLine "<inventory_module>"
Wscript.StdOut.WriteLine "<name>Motherboard</name>"
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
Wscript.StdOut.WriteLine "<datalist>"
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
'Set colMobos = objWMIService.ExecQuery("Select name,product,manufacturer from Win32_baseboard")
Set colMobos2 = objWMIService.ExecQuery("Select manufacturer,model,OEMStringArray from Win32_computersystem")
For Each mobo In colMobos2
Wscript.StdOut.WriteLine "<data><![CDATA[" & mobo.manufacturer & ";" & mobo.model & ";" & mobo.OEMStringArray(0) & "]]></data>"
Next
Wscript.StdOut.WriteLine "</datalist>"
Wscript.StdOut.WriteLine "</inventory_module>"
Wscript.StdOut.WriteLine "</inventory>"

View File

@ -0,0 +1,29 @@
' Pandora FMS Agent Inventory Plugin for Microsoft Windows (All platfforms)
' (c) 2015 Borja Sanchez <fborja.sanchez@artica.es>
' This plugin extends agent inventory feature. Only enterprise version
' --------------------------------------------------------------------------
on error resume next
'WMI monitorsinfo
Wscript.StdOut.WriteLine "<inventory>"
Wscript.StdOut.WriteLine "<inventory_module>"
Wscript.StdOut.WriteLine "<name>Monitors</name>"
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
Wscript.StdOut.WriteLine "<datalist>"
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colDisplays = objWMIService.ExecQuery("Select caption,pnpdeviceid from win32_desktopmonitor")
For Each display In colDisplays
if (NOT isNull(display.pnpdeviceid)) then
Wscript.StdOut.WriteLine "<data><![CDATA[" & display.caption _
& ";" & display.pnpdeviceid _
& "]]></data>"
end if
Next
Wscript.StdOut.WriteLine "</datalist>"
Wscript.StdOut.WriteLine "</inventory_module>"
Wscript.StdOut.WriteLine "</inventory>"

View File

@ -0,0 +1,59 @@
' Pandora FMS Agent Inventory Plugin for Microsoft Windows (All platfforms)
' (c) 2015 Borja Sanchez <fborja.sanchez@artica.es>
' This plugin extends agent inventory feature. Only enterprise version
' --------------------------------------------------------------------------
On Error Resume Next
'WMI printers attached
Wscript.StdOut.WriteLine "<inventory>"
Wscript.StdOut.WriteLine "<inventory_module>"
Wscript.StdOut.WriteLine "<name>Printers</name>"
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
Wscript.StdOut.WriteLine "<datalist>"
function validPort(port)
if strComp(port,"SHRFAX:") = 0 then
validPort = false
elseif strComp(port,"nul:") = 0 then
validPort = false
elseif strComp(port,"PORTPROMPT:") = 0 then
validPort = false
elseif strComp(port,"XPSPort:") = 0 then
validPort = false
elseif strComp(port,"PDF:") = 0 then
validPort = false
else
validPort = true
end if
end function
Set oWMI = GetObject("winmgmts:\\" & "." & "\root\cimv2")
Set colPrinters = oWMI.ExecQuery("Select * from Win32_Printer",,48)
For Each objPrinter in colPrinters
if validPort (objPrinter.PortName) then
set tcp_port_exists = 0
WScript.stdOut.Write "<data><![CDATA[" & _
objPrinter.DeviceID & ";" & _
objPrinter.DriverName & ";"
If (objPrinter.Local) Then
Set colPorts = oWMI.ExecQuery("Select HostAddress from Win32_TCPIPPrinterPort where Name like '" & objPrinter.PortName & "'",,48)
For Each objPort in colPorts
tcp_port_exists = 1
Wscript.stdOut.Write objPort.HostAddress
Next
If (tcp_port_exists = 0) Then
Wscript.stdOut.Write objPrinter.PortName
End If
Else
Wscript.stdOut.Write objPrinter.ServerName
End If
wscript.stdOut.WriteLine "]]></data>"
end if
Next
Wscript.StdOut.WriteLine "</datalist>"
Wscript.StdOut.WriteLine "</inventory_module>"
Wscript.StdOut.WriteLine "</inventory>"

View File

@ -0,0 +1,24 @@
' windows_product_key.vbs
' Pandora FMS Agent Inventory Plugin for Microsoft Windows (All platfforms)
' (c) 2015 Sancho Lerena <slerena@artica.es>
' This plugin extends agent inventory feature. Only enterprise version
' ----------------------------------------------------------------
on error resume next
Wscript.StdOut.WriteLine "<inventory>"
Wscript.StdOut.WriteLine "<inventory_module>"
Wscript.StdOut.WriteLine "<name>product_ID</name>"
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
Wscript.StdOut.WriteLine "<datalist>"
Set oShell = WScript.CreateObject ("WScript.Shell")
Set objExec = oShell.Exec("cmd.exe /C wmic os get ""SerialNumber"" | find /v ""SerialNumber"" ")
Do
line = objExec.StdOut.ReadLine()
s = s & line
Loop While Not objExec.Stdout.atEndOfStream
Wscript.StdOut.WriteLine "<data><![CDATA[" & Replace(Replace(s, chr(013), ""), chr(010), "") & "]]></data>"
Wscript.StdOut.WriteLine "</datalist>"
Wscript.StdOut.WriteLine "</inventory_module>"
Wscript.StdOut.WriteLine "</inventory>"

View File

@ -0,0 +1,25 @@
' windows_product_key.vbs
' Pandora FMS Agent Inventory Plugin for Microsoft Windows (All platfforms)
' (c) 2015 Sancho Lerena <slerena@artica.es>
' This plugin extends agent inventory feature. Only enterprise version
' ----------------------------------------------------------------
on error resume next
Wscript.StdOut.WriteLine "<inventory>"
Wscript.StdOut.WriteLine "<inventory_module>"
Wscript.StdOut.WriteLine "<name>product_key</name>"
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
Wscript.StdOut.WriteLine "<datalist>"
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProducts = objWMIService.ExecQuery("Select OA3xOriginalProductKey from SoftwareLicensingService")
For Each product In colProducts
Wscript.StdOut.WriteLine "<data><![CDATA[" & product.OA3xOriginalProductKey & "]]></data>"
Next
Wscript.StdOut.WriteLine "</datalist>"
Wscript.StdOut.WriteLine "</inventory_module>"
Wscript.StdOut.WriteLine "</inventory>"

View File

@ -0,0 +1,28 @@
' Pandora FMS Agent Inventory Plugin for Microsoft Windows (All platfforms)
' (c) 2015 Borja Sanchez <fborja.sanchez@artica.es>
' This plugin extends agent inventory feature. Only enterprise version
' --------------------------------------------------------------------------
on error resume next
'WMI raminfo
Wscript.StdOut.WriteLine "<inventory>"
Wscript.StdOut.WriteLine "<inventory_module>"
Wscript.StdOut.WriteLine "<name>RAM</name>"
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
Wscript.StdOut.WriteLine "<datalist>"
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colRAMs = objWMIService.ExecQuery("Select deviceLocator,capacity,speed from Win32_PhysicalMemory")
For Each ram In colRAMs
Wscript.StdOut.WriteLine "<data><![CDATA[" & ram.deviceLocator _
& ";" & Abs(Round((ram.capacity/(1024*1024)),2)) & " MB" _
& ";" & ram.speed & " MHz"_
& "]]></data>"
Next
Wscript.StdOut.WriteLine "</datalist>"
Wscript.StdOut.WriteLine "</inventory_module>"
Wscript.StdOut.WriteLine "</inventory>"

View File

@ -1,72 +1,141 @@
' software_inventory.vbs
' Pandora FMS Agent Inventory Plugin for Microsoft Windows (All platfforms)
' (c) 2014 Sancho Lerena <slerena@artica.es>
' (c) 2015 Sancho Lerena <slerena@artica.es>
' (c) 2015 Borja Sanchez <fborja.sanchez@artica.es>
' This plugin extends agent inventory feature. Only enterprise version
' ----------------------------------------------------------------
' usage: cscript //B software_inventory.vbs
' --------------------------------------------------------------------------
on error resume next
Class ObjectList
Public List
Sub Class_Initialize()
Set List = CreateObject("Scripting.Dictionary")
End Sub
Sub Class_Terminate()
Set List = Nothing
End Sub
Function Append(Anything)
List.Add CStr(List.Count + 1), Anything
Set Append = Anything
End Function
Function Item(id)
If List.Exists(CStr(id)) Then
Set Item = List(CStr(id))
Else
Set Item = Nothing
End If
End Function
End Class
class AppClass
dim InstallDate,Caption,Version,Vendor
end class
' Print the XML structure
Wscript.StdOut.WriteLine "<inventory>"
Wscript.StdOut.WriteLine"<inventory_module>"
Wscript.StdOut.WriteLine "<name>software</name>"
Wscript.StdOut.WriteLine "<inventory_module>"
Wscript.StdOut.WriteLine "<name>Software</name>"
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
Wscript.StdOut.WriteLine "<datalist>"
'------ Checks if an item exists on the main collection
function isItemInArray(objeto,coleccion)
for each id in coleccion.List
if (strComp(objeto,coleccion.List(id).caption) = 0) then
isItemInArray=true
exit function
end if
next
isItemInArray=false
end function
'------ main collection definition
dim colObjSW : set colObjSW = new ObjectList
strComputer = "."
'------ Retrieve the WMI registers first
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colSoftware = objWMIService.ExecQuery ("SELECT installstate,caption,installdate,Version,vendor FROM Win32_Product")
'------ Check all
'-- first) add all unique WMI (unique) entries to main collector
'-- second) add all unique REGISTRY items to main collector
for each objSoftware in colSoftware
if ( objSoftware.installstate = 5 ) then
if ( isItemInArray(objSoftware.caption, colObjSW) = false ) then
' It doesn't exists, added.
With colObjSW.Append(New AppClass)
.caption = objSoftware.caption
.InstallDate = objSoftware.InstallDate
.version = objSoftware.version
.vendor = objSoftware.vendor
End with
' Add to XML the verified ones
Wscript.StdOut.WriteLine "<data><![CDATA[" _
& objSoftware.caption & ";" _
& objSoftware.version _
& "]]></data>"
end if
end if
next
' ------ Getting the REGISTRY
Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE
strComputer = "."
strKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
strEntry1a = "DisplayName"
strEntry1b = "QuietDisplayName"
strEntry2 = "InstallDate"
strEntry3 = "VersionMajor"
strEntry4 = "VersionMinor"
strEntry5 = "EstimatedSize"
strEntry3 = "DisplayVersion"
Set objReg = GetObject("winmgmts://" & strComputer & _
"/root/default:StdRegProv")
Set objReg = GetObject("winmgmts://" & strComputer & "/root/default:StdRegProv")
objReg.EnumKey HKLM, strKey, arrSubkeys
For Each strSubkey In arrSubkeys
appname = ""
appsize = ""
appversion = ""
appdate = ""
intRet1 = objReg.GetStringValue(HKLM, strKey & strSubkey, _
strEntry1a, strValue1)
intRet1 = objReg.GetStringValue(HKLM, strKey & strSubkey, strEntry1a, strValue1)
If intRet1 <> 0 Then
objReg.GetStringValue HKLM, strKey & strSubkey, _
strEntry1b, strValue1
objReg.GetStringValue HKLM, strKey & strSubkey, strEntry1b, strValue1
End If
If strValue1 <> "" Then
appname = strValue1
End If
objReg.GetStringValue HKLM, strKey & strSubkey, _
strEntry2, strValue2
objReg.GetStringValue HKLM, strKey & strSubkey, strEntry2, strValue2
If strValue2 <> "" Then
appdate = strValue2
End If
objReg.GetDWORDValue HKLM, strKey & strSubkey, _
strEntry3, intValue3
objReg.GetDWORDValue HKLM, strKey & strSubkey, _
strEntry4, intValue4
objReg.GetStringValue HKLM, strKey & strSubkey, strEntry3, intValue3
If intValue3 <> "" Then
appversion = intValue3 & "." & intValue4
appversion = intValue3
End If
objReg.GetDWORDValue HKLM, strKey & strSubkey, _
strEntry5, intValue5
If intValue5 <> "" Then
appsize = Round(intValue5/1024, 3) & " megabytes"
End If
If appname <> "" Then
Wscript.StdOut.WriteLine "<data>" & appname & ";" & appversion & ";" & appdate & ";" & appsize & "</data>"
' foreach registry item, check if exists in the main collector
' it it exists, it doesn't be added.
if ( isItemInArray(appname, colObjSW) = false ) then
' as item doesn't exist, we add it to main collector and to XML
With colObjSW.Append(New AppClass)
.caption = appname
.version = appversion
End with
Wscript.StdOut.WriteLine "<data><![CDATA[" & appname & ";" & appversion & "]]></data>"
end if
end if
Next
next
' Closing the XML structure
Wscript.StdOut.WriteLine "</datalist>"
Wscript.StdOut.WriteLine "</inventory_module>"
Wscript.StdOut.WriteLine "</inventory>"

View File

@ -0,0 +1,74 @@
' Pandora FMS Agent Inventory Plugin for Microsoft Windows (All platfforms)
' (c) 2015 Borja Sanchez <fborja.sanchez@artica.es>
' This plugin extends agent inventory feature. Only enterprise version
' --------------------------------------------------------------------------
on error resume next
' Lista todos los usuarios del equipo que han iniciado procesos
dim loggedUsers(),i
i=0
Sub insertIfNotExists(sDomain,sUser)
For Each lUser in loggedUsers
If StrComp(sDomain & "\" & sUser, lUser) = 0 Then
Exit Sub
End If
Next
redim preserve loggedUsers(i)
i=i+1
loggedUsers (i-1)=sDomain & "\" & sUser
End Sub
Function CheckRealUser(sHost, sUser, sDomain)
Dim oWMI,realUsers
Set oWmi = GetObject("winmgmts:{impersonationLevel=impersonate,(debug)}!\\" _
& sHost & "\root\cimv2")
Set realUsers = oWmi.ExecQuery("SELECT * FROM Win32_UserAccount WHERE Domain='" & sDomain & "' OR Name='" & sUser & "'")
If (realUsers.count=0) Then
CheckRealUser = False
Else
CheckRealUser = True
End If
End Function
Function ConsoleUser(sHost)
Dim oWMI, colProc, oProcess, strUser, strDomain
Set oWmi = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,(debug)}!\\" _
& sHost & "\root\cimv2")
Set colProc = oWmi.ExecQuery("Select sessionID from Win32_Process")
ConsoleUser = ""
For Each oProcess In colProc
lRet = oProcess.getOwner(strOwner, strDomain)
If (lRet = 0) AND (CheckRealUser(sHost,strOwner,strDomain)) Then
insertIfNotExists strDomain,strOwner
ConsoleUser = sUser
End If
Next
End Function
' MAIN
sUser = ConsoleUser(".") ' use "." for local computer
Wscript.StdOut.WriteLine "<inventory>"
Wscript.StdOut.WriteLine "<inventory_module>"
Wscript.StdOut.WriteLine "<name>Users</name>"
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
Wscript.StdOut.WriteLine "<datalist>"
For Each usuario in loggedUsers
Wscript.StdOut.WriteLine "<data><![CDATA[" & split(usuario,"\")(0) _
& ";" & split(usuario,"\")(1) _
& "]]></data>"
next
Wscript.StdOut.WriteLine "</datalist>"
Wscript.StdOut.WriteLine "</inventory_module>"
Wscript.StdOut.WriteLine "</inventory>"

View File

@ -0,0 +1,28 @@
' Pandora FMS Agent Inventory Plugin for Microsoft Windows (All platfforms)
' (c) 2015 Borja Sanchez <fborja.sanchez@artica.es>
' This plugin extends agent inventory feature. Only enterprise version
' --------------------------------------------------------------------------
on error resume next
'WMI video_card_info
Wscript.StdOut.WriteLine "<inventory>"
Wscript.StdOut.WriteLine "<inventory_module>"
Wscript.StdOut.WriteLine "<name>Video</name>"
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
Wscript.StdOut.WriteLine "<datalist>"
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colVideoCards = objWMIService.ExecQuery("Select caption,AdapterRAM,PNPDeviceID from win32_videocontroller")
For Each vcard In colVideoCards
Wscript.StdOut.WriteLine "<data><![CDATA[" & vcard.caption _
& ";" & Abs(Round(vcard.AdapterRAM/(1024*1024)),2) & " MB" _
& ";" & vcard.PNPDeviceID _
& "]]></data>"
Next
Wscript.StdOut.WriteLine "</datalist>"
Wscript.StdOut.WriteLine "</inventory_module>"
Wscript.StdOut.WriteLine "</inventory>"

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{150427}
{150428}
ViewReadme
{Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("6.0dev(Build 150427)")
#define PANDORA_VERSION ("6.0dev(Build 150428)")
string pandora_path;
string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(6.0dev(Build 150427))"
VALUE "ProductVersion", "(6.0dev(Build 150428))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 6.0dev-150427
Version: 6.0dev-150428
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="6.0dev-150427"
pandora_version="6.0dev-150428"
package_pear=0
package_pandora=1

View File

@ -22,7 +22,7 @@
/**
* Pandora build version and version
*/
$build_version = 'PC150427';
$build_version = 'PC150428';
$pandora_version = 'v6.0dev';
// Do not overwrite default timezone set if defined.

View File

@ -63,7 +63,7 @@
<div style='height: 10px'>
<?php
$version = '6.0dev';
$build = '150427';
$build = '150428';
$banner = "v$version Build $build";
error_reporting(0);

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 6.0dev
%define release 150427
%define release 150428
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 6.0dev
%define release 150427
%define release 150428
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2

View File

@ -38,7 +38,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
('graph_res','5'),
('step_compact','1'),
('db_scheme_version','6.0dev'),
('db_scheme_build','PD150427'),
('db_scheme_build','PD150428'),
('show_unknown','0'),
('show_lastalerts','1'),
('style','pandora'),

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 6.0dev-150427
Version: 6.0dev-150428
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="6.0dev-150427"
pandora_version="6.0dev-150428"
package_cpan=0
package_pandora=1

View File

@ -43,7 +43,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "6.0dev";
my $pandora_build = "150427";
my $pandora_build = "150428";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 6.0dev
%define release 150427
%define release 150428
Summary: Pandora FMS Server
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 6.0dev
%define release 150427
%define release 150428
Summary: Pandora FMS Server
Name: %{name}

View File

@ -33,7 +33,7 @@ use PandoraFMS::Tools;
use PandoraFMS::DB;
# version: define current version
my $version = "6.0dev PS150427";
my $version = "6.0dev PS150428";
# Pandora server configuration
my %conf;

View File

@ -35,7 +35,7 @@ use Encode::Locale;
Encode::Locale::decode_argv;
# version: define current version
my $version = "6.0dev PS150427";
my $version = "6.0dev PS150428";
# save program name for logging
my $progname = basename($0);