Fixed problems with plugins

This commit is contained in:
m-lopez-f 2015-04-24 12:22:53 +02:00
parent 51cd55da10
commit 01a2383a3b
12 changed files with 77 additions and 28 deletions

View File

@ -1,9 +1,13 @@
' 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>CDROMs</name>"
Wscript.StdOut.WriteLine "<name>CDROM</name>"
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
Wscript.StdOut.WriteLine "<datalist>"

View File

@ -12,7 +12,7 @@ Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\
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 & ";" & cpu.caption & "]]></data>"
Wscript.StdOut.WriteLine "<data><![CDATA[" & cpu.name & ";" & cpu.maxclockspeed & " MHz;" & cpu.caption & "]]></data>"
Next
Wscript.StdOut.WriteLine "</datalist>"

View File

@ -1,21 +1,31 @@
' 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>Disks</name>"
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 caption,size,serialnumber from win32_diskdrive")
Set colHDDs = objWMIService.ExecQuery("Select * from win32_diskdrive")
For Each disco In colHDDs
Wscript.StdOut.WriteLine "<data><![CDATA[" & disco.caption _
& ";" & (disco.size/(1024*1024)) _
& ";" & disco.serialnumber _
& "]]></data>"
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>"

View File

@ -1,3 +1,7 @@
' 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:
@ -14,7 +18,11 @@ 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%%'")
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

View File

@ -1,3 +1,7 @@
' 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

View File

@ -1,3 +1,7 @@
' 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

View File

@ -1,3 +1,7 @@
' 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
@ -33,13 +37,17 @@ For Each objPrinter in colPrinters
WScript.stdOut.Write "<data><![CDATA[" & _
objPrinter.DeviceID & ";" & _
objPrinter.DriverName & ";"
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
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

View File

@ -3,7 +3,7 @@
' (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>"

View File

@ -1,3 +1,7 @@
' 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
@ -13,8 +17,8 @@ Set colRAMs = objWMIService.ExecQuery("Select deviceLocator,capacity,speed from
For Each ram In colRAMs
Wscript.StdOut.WriteLine "<data><![CDATA[" & ram.deviceLocator _
& ";" & (ram.capacity/(1024*1024)) _
& ";" & ram.speed _
& ";" & Abs(Round((ram.capacity/(1024*1024)),2)) & " MB" _
& ";" & ram.speed & " MHz"_
& "]]></data>"
Next

View File

@ -1,10 +1,8 @@
'
' Windows information retriever: Software Installed
'
' WMI/REGISTRY based
' Pandora FMS Agent Inventory Plugin for Microsoft Windows (All platfforms)
' (c) 2015 Sancho Lerena <slerena@artica.es>
' (c) 2015 Borja Sanchez <fborja.sanchez@artica.es>
'--------------------------------------------------------
' This plugin extends agent inventory feature. Only enterprise version
' --------------------------------------------------------------------------
on error resume next
Class ObjectList

View File

@ -1,3 +1,7 @@
' 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
@ -57,8 +61,9 @@ Wscript.StdOut.WriteLine "<datalist>"
For Each usuario in loggedUsers
Wscript.StdOut.WriteLine "<data><![CDATA[" & usuario _
& "]]></data>"
Wscript.StdOut.WriteLine "<data><![CDATA[" & split(usuario,"\")(0) _
& ";" & split(usuario,"\")(1) _
& "]]></data>"
next

View File

@ -1,9 +1,13 @@
' 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>VideoCards</name>"
Wscript.StdOut.WriteLine "<name>Video</name>"
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
Wscript.StdOut.WriteLine "<datalist>"
@ -13,7 +17,7 @@ Set colVideoCards = objWMIService.ExecQuery("Select caption,AdapterRAM,PNPDevice
For Each vcard In colVideoCards
Wscript.StdOut.WriteLine "<data><![CDATA[" & vcard.caption _
& ";" & (vcard.AdapterRAM/(1024*1024)) _
& ";" & Abs(Round(vcard.AdapterRAM/(1024*1024)),2) & " MB" _
& ";" & vcard.PNPDeviceID _
& "]]></data>"
Next