Merge branch 'develop' into feature/new_networkmap

Conflicts:
	pandora_console/include/constants.php
This commit is contained in:
mdtrooper 2016-03-09 11:15:17 +01:00
commit aefff3041f
119 changed files with 674395 additions and 658494 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 6.1dev-160210
Version: 6.1dev-160309
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.1dev-160210"
pandora_version="6.1dev-160309"
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.1dev';
use constant AGENT_BUILD => '160210';
use constant AGENT_BUILD => '160309';
# 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.1dev
%define release 160210
%define release 160309
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}
@ -18,8 +18,15 @@ Packager: Sancho Lerena <slerena@artica.es>
Prefix: /usr/share
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
BuildArch: noarch
PreReq: /bin/sed /bin/grep /usr/sbin/useradd
Requires: coreutils unzip perl
Requires(pre): shadow-utils
Requires(post): chkconfig /bin/ln
Requires(preun): chkconfig /bin/rm /usr/sbin/userdel
Requires: fileutils textutils unzip
Requires: util-linux procps grep
Requires: /sbin/ip /bin/awk
Requires: perl perl(Sys::Syslog)
# Required by plugins
#Requires: sh-utils sed passwd net-tools rpm
AutoReq: 0
Provides: %{name}-%{version}
@ -98,8 +105,6 @@ if [ ! -d /var/log/pandora ]; then
fi
/sbin/chkconfig --add pandora_agent_daemon
/sbin/chkconfig pandora_agent_daemon on
echo "You may need to install manually some additional required dependencies:"
echo "perl-Sys-Syslog"
%preun
@ -109,7 +114,7 @@ if [ "$1" = "1" ]; then
fi
/sbin/chkconfig --del pandora_agent_daemon
/etc/init.d/pandora_agent_daemon stop
/etc/init.d/pandora_agent_daemon stop >/dev/null 2>&1 || :
rm /etc/init.d/pandora_agent_daemon
/usr/sbin/userdel pandora
rm -Rf /etc/pandora/pandora_agent.conf

View File

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

View File

@ -66,7 +66,7 @@ pidof_pandora () {
fi
done
else
PANDORA_PID=`ps -Af | grep "$DAEMON $PANDORA_PATH" | grep -v grep | awk '{ print $2 }'`
PANDORA_PID=`ps -Afw | grep "$DAEMON $PANDORA_PATH" | grep -v grep | awk '{ print $2 }'`
fi
echo $PANDORA_PID

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="6.1dev"
PI_BUILD="160210"
PI_BUILD="160309"
OS_NAME=`uname -s`
FORCE=0
@ -471,7 +471,8 @@ install () {
then
[ -d $DESTDIR/etc/logrotate.d ] && mkdir -p $DESTDIR/etc/logrotate.d
echo "Creating logrotate.d entry for Pandora FMS log management"
cp pandora_agent_logrotate $DESTDIR/etc/logrotate.d/pandora_agent
sed -e "s|^/var/log/pandora/pandora_agent.log|$PANDORA_BASE_REAL$PANDORA_LOG_DIR/$PANDORA_LOG|" pandora_agent_logrotate \
> $DESTDIR/etc/logrotate.d/pandora_agent
else
echo "Please add a log rotation schedule manually to your log rotation daemon (if any)"
fi

View File

@ -1 +1,10 @@
/var/log/pandora/pandora_agent.log
/var/log/pandora/pandora_agent.log {
weekly
missingok
size 300000
rotate 3
maxage 90
compress
notifempty
copytruncate
}

View File

@ -2,24 +2,34 @@
' (c) 2015 Borja Sanchez <fborja.sanchez@artica.es>
' This plugin extends agent inventory feature. Only enterprise version
' --------------------------------------------------------------------------
on error resume next
'WMI architecture
Wscript.StdOut.WriteLine "<inventory>"
Wscript.StdOut.WriteLine "<inventory_module>"
Wscript.StdOut.WriteLine "<name>Architecture</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 cols = objWMIService.ExecQuery("Select osarchitecture from Win32_OperatingSystem")
For Each data In cols
Wscript.StdOut.WriteLine "<data><![CDATA[" & data.osarchitecture & "]]></data>"
Next
on error resume next
flag = cols.Count
If (err.number <> 0) Then
flag = true
Else
flag = false
End If
on error goto 0
Wscript.StdOut.WriteLine "</datalist>"
Wscript.StdOut.WriteLine "</inventory_module>"
Wscript.StdOut.WriteLine "</inventory>"
'Print only when there's results
If (NOT flag) Then
Wscript.StdOut.WriteLine "<inventory>"
Wscript.StdOut.WriteLine "<inventory_module>"
Wscript.StdOut.WriteLine "<name>Architecture</name>"
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
Wscript.StdOut.WriteLine "<datalist>"
For Each data In cols
Wscript.StdOut.WriteLine "<data><![CDATA[" & data.osarchitecture & "]]></data>"
Next
Wscript.StdOut.WriteLine "</datalist>"
Wscript.StdOut.WriteLine "</inventory_module>"
Wscript.StdOut.WriteLine "</inventory>"
End If

View File

@ -2,28 +2,39 @@
' (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
on error resume next
flag = colCDROMDrives.Count
If (err.number <> 0) Then
flag = true
Else
flag = false
End If
on error goto 0
Wscript.StdOut.WriteLine "</datalist>"
Wscript.StdOut.WriteLine "</inventory_module>"
Wscript.StdOut.WriteLine "</inventory>"
'Print only when there's results
If (NOT flag) Then
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>"
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>"
End If

View File

@ -2,24 +2,34 @@
' (c) 2015 Borja Sanchez <fborja.sanchez@artica.es>
' This plugin extends agent inventory feature. Only enterprise version
' --------------------------------------------------------------------------
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
on error resume next
flag = colCPUs.Count
If (err.number <> 0) Then
flag = true
Else
flag = false
End If
on error goto 0
Wscript.StdOut.WriteLine "</datalist>"
Wscript.StdOut.WriteLine "</inventory_module>"
Wscript.StdOut.WriteLine "</inventory>"
'Print only when there's results
If (NOT flag) Then
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>"
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>"
End If

View File

@ -2,33 +2,43 @@
' (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
on error resume next
flag = colHDDs.Count
If (err.number <> 0) Then
flag = true
Else
flag = false
End If
on error goto 0
'Print only when there's results
If (NOT flag) Then
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>"
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
Wscript.StdOut.WriteLine "]]></data>"
End If
Next
Wscript.StdOut.WriteLine "</datalist>"
Wscript.StdOut.WriteLine "</inventory_module>"
Wscript.StdOut.WriteLine "</inventory>"
Next
Wscript.StdOut.WriteLine "</datalist>"
Wscript.StdOut.WriteLine "</inventory_module>"
Wscript.StdOut.WriteLine "</inventory>"
End If

View File

@ -2,24 +2,34 @@
' (c) 2015 Borja Sanchez <fborja.sanchez@artica.es>
' This plugin extends agent inventory feature. Only enterprise version
' --------------------------------------------------------------------------
on error resume next
'WMI domain/workgroup info
Wscript.StdOut.WriteLine "<inventory>"
Wscript.StdOut.WriteLine "<inventory_module>"
Wscript.StdOut.WriteLine "<name>Domain</name>"
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
Wscript.StdOut.WriteLine "<datalist>"
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT Domain FROM Win32_ComputerSystem")
For Each objItem In colItems
WScript.StdOut.WriteLine "<data><![CDATA[" & objItem.Domain & "]]></data>"
Next
on error resume next
flag = colItems.Count
If (err.number <> 0) Then
flag = true
Else
flag = false
End If
on error goto 0
Wscript.StdOut.WriteLine "</datalist>"
Wscript.StdOut.WriteLine "</inventory_module>"
Wscript.StdOut.WriteLine "</inventory>"
'Print only when there's results
If (NOT flag) Then
Wscript.StdOut.WriteLine "<inventory>"
Wscript.StdOut.WriteLine "<inventory_module>"
Wscript.StdOut.WriteLine "<name>Domain</name>"
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
Wscript.StdOut.WriteLine "<datalist>"
For Each objItem In colItems
WScript.StdOut.WriteLine "<data><![CDATA[" & objItem.Domain & "]]></data>"
Next
Wscript.StdOut.WriteLine "</datalist>"
Wscript.StdOut.WriteLine "</inventory_module>"
Wscript.StdOut.WriteLine "</inventory>"
End If

View File

@ -2,7 +2,6 @@
' (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
@ -10,12 +9,6 @@ on error resume next
'
'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 " & _
@ -24,19 +17,37 @@ Set colAdapters = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter "
"and not ServiceName is null " & _
"and not ServiceName like 'vwifimp' ")
For Each iface In colAdapters
' return model MACAddress IPAddress
on error resume next
flag = colAdapters.Count
If (err.number <> 0) Then
flag = true
Else
flag = false
End If
on error goto 0
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
'Print only when there's results
If (NOT flag) Then
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>"
Wscript.StdOut.WriteLine "</datalist>"
Wscript.StdOut.WriteLine "</inventory_module>"
Wscript.StdOut.WriteLine "</inventory>"
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>"
End If

View File

@ -2,25 +2,35 @@
' (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
on error resume next
flag = colItems.Count
If (err.number <> 0) Then
flag = true
Else
flag = false
End If
on error goto 0
Wscript.StdOut.WriteLine "</datalist>"
Wscript.StdOut.WriteLine "</inventory_module>"
Wscript.StdOut.WriteLine "</inventory>"
'Print only when there's results
If (NOT flag) Then
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>"
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>"
End If

View File

@ -2,28 +2,38 @@
' (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
on error resume next
flag = colDisplays.Count
If (err.number <> 0) Then
flag = true
Else
flag = false
End If
on error goto 0
Wscript.StdOut.WriteLine "</datalist>"
Wscript.StdOut.WriteLine "</inventory_module>"
Wscript.StdOut.WriteLine "</inventory>"
'Print only when there's results
If (NOT flag) Then
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>"
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>"
End If

View File

@ -2,24 +2,34 @@
' (c) 2015 Borja Sanchez <fborja.sanchez@artica.es>
' This plugin extends agent inventory feature. Only enterprise version
' --------------------------------------------------------------------------
on error resume next
'WMI OS version
Wscript.StdOut.WriteLine "<inventory>"
Wscript.StdOut.WriteLine "<inventory_module>"
Wscript.StdOut.WriteLine "<name>OSVersion</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 cols = objWMIService.ExecQuery("SELECT version from win32_operatingsystem")
For Each data In cols
Wscript.StdOut.WriteLine "<data><![CDATA[" & data.version & "]]></data>"
Next
on error resume next
flag = cols.Count
If (err.number <> 0) Then
flag = true
Else
flag = false
End If
on error goto 0
Wscript.StdOut.WriteLine "</datalist>"
Wscript.StdOut.WriteLine "</inventory_module>"
Wscript.StdOut.WriteLine "</inventory>"
'Print only when there's results
If (NOT flag) Then
Wscript.StdOut.WriteLine "<inventory>"
Wscript.StdOut.WriteLine "<inventory_module>"
Wscript.StdOut.WriteLine "<name>OSVersion</name>"
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
Wscript.StdOut.WriteLine "<datalist>"
For Each data In cols
Wscript.StdOut.WriteLine "<data><![CDATA[" & data.version & "]]></data>"
Next
Wscript.StdOut.WriteLine "</datalist>"
Wscript.StdOut.WriteLine "</inventory_module>"
Wscript.StdOut.WriteLine "</inventory>"
End If

View File

@ -2,16 +2,8 @@
' (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
@ -31,29 +23,58 @@ 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
on error resume next
flag = colPrinters.Count
If (err.number <> 0) Then
flag = true
Else
flag = false
End If
on error goto 0
'Print only when there's results
If (NOT flag) Then
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>"
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)
on error resume next
flag = colPorts.Count
If (err.number <> 0) Then
flag = true
Else
flag = false
End If
on error goto 0
'Print only when there's results
If (NOT flag) Then
For Each objPort in colPorts
tcp_port_exists = 1
Wscript.stdOut.Write objPort.HostAddress
Next
End If
If (tcp_port_exists = 0) Then
Wscript.stdOut.Write objPrinter.PortName
End If
Else
Wscript.stdOut.Write objPrinter.ServerName
End If
Else
Wscript.stdOut.Write objPrinter.ServerName
End If
wscript.stdOut.WriteLine "]]></data>"
end if
Next
wscript.stdOut.WriteLine "]]></data>"
end if
Next
Wscript.StdOut.WriteLine "</datalist>"
Wscript.StdOut.WriteLine "</inventory_module>"
Wscript.StdOut.WriteLine "</inventory>"
Wscript.StdOut.WriteLine "</datalist>"
Wscript.StdOut.WriteLine "</inventory_module>"
Wscript.StdOut.WriteLine "</inventory>"
End If

View File

@ -3,21 +3,20 @@
' (c) 2015 Sancho Lerena <slerena@artica.es>
' This plugin extends agent inventory feature. Only enterprise version
' ----------------------------------------------------------------
on error resume next
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 "<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>"

View File

@ -4,22 +4,32 @@
' 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
on error resume next
flag = colProducts.Count
If (err.number <> 0) Then
flag = true
Else
flag = false
End If
on error goto 0
Wscript.StdOut.WriteLine "</datalist>"
Wscript.StdOut.WriteLine "</inventory_module>"
Wscript.StdOut.WriteLine "</inventory>"
'Print only when there's results
If (NOT flag) Then
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>"
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>"
End If

View File

@ -2,27 +2,37 @@
' (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
on error resume next
flag = colRAMs.Count
If (err.number <> 0) Then
flag = true
Else
flag = false
End If
on error goto 0
Wscript.StdOut.WriteLine "</datalist>"
Wscript.StdOut.WriteLine "</inventory_module>"
Wscript.StdOut.WriteLine "</inventory>"
'Print only when there's results
If (NOT flag) Then
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>"
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>"
End If

View File

@ -2,27 +2,39 @@
' (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 _
& ";" & Round(Abs(vcard.AdapterRAM/(1024*1024)),2) & " MB" _
& ";" & vcard.PNPDeviceID _
& "]]></data>"
Next
on error resume next
flag = colVideoCards.Count
If (err.number <> 0) Then
flag = true
Else
flag = false
End If
on error goto 0
Wscript.StdOut.WriteLine "</datalist>"
Wscript.StdOut.WriteLine "</inventory_module>"
Wscript.StdOut.WriteLine "</inventory>"
'Print only when there's results
If (NOT flag) Then
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>"
For Each vcard In colVideoCards
Wscript.StdOut.Write "<data><![CDATA[" & vcard.caption & ";"
on error resume next
Wscript.StdOut.Write Round(Abs(vcard.AdapterRAM/(1024*1024)),2) & " MB"
on error goto 0
Wscript.StdOut.Write ";" & vcard.PNPDeviceID
Wscript.StdOut.WriteLine "]]></data>"
Next
Wscript.StdOut.WriteLine "</datalist>"
Wscript.StdOut.WriteLine "</inventory_module>"
Wscript.StdOut.WriteLine "</inventory>"
End If

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{160210}
{160309}
ViewReadme
{Yes}

View File

@ -78,6 +78,8 @@ Pandora_Module::Pandora_Module (string name) {
this->warning_inverse = "";
this->quiet = "";
this->module_ff_interval = "";
this->module_alert_template = "";
this->module_crontab = "";
}
/**
@ -256,7 +258,7 @@ Pandora_Module::parseModuleKindFromString (string kind) {
} else if (kind == module_plugin_str) {
return MODULE_PLUGIN;
} else if (kind == module_ping_str) {
return MODULE_PING;
return MODULE_PING;
} else if (kind == module_snmpget_str) {
return MODULE_SNMPGET;
} else {
@ -725,6 +727,20 @@ Pandora_Module::getXml () {
module_xml += this->module_ff_interval;
module_xml += "</module_ff_interval>\n";
}
/* Module Alert template */
if (this->module_alert_template != "") {
module_xml += "\t<alert_template>";
module_xml += this->module_alert_template;
module_xml += "</alert_template>\n";
}
/* Module Crontab */
if (this->module_crontab != "") {
module_xml += "\t<crontab>";
module_xml += this->module_crontab;
module_xml += "</crontab>\n";
}
/* Write module data */
if (this->data_list && this->data_list->size () > 1) {
@ -1002,6 +1018,26 @@ Pandora_Module::setModuleFFInterval (string value) {
this->module_ff_interval = value;
}
/**
* Set the module Alert template for the module.
*
* @param value module Alert template value to set.
*/
void
Pandora_Module::setModuleAlertTemplate (string value) {
this->module_alert_template = value;
}
/**
* Set the module Crontab for the module.
*
* @param value module Crontab value to set.
*/
void
Pandora_Module::setModuleCrontab (string value) {
this->module_crontab = value;
}
/**
* Set the async flag to the module.
*
@ -1160,7 +1196,7 @@ Pandora_Module::addGenericCondition (string condition, list<Condition *> **condi
/* Numeric comparison */
if (sscanf (condition.c_str (), "%255s %lf %1023[^\n]s", operation, &(cond->value_1), command) == 3) {
cond->operation = operation;
cond->command = command;
cond->command = command;
cond->command = command;
cond->command = "cmd.exe /c \"" + cond->command + "\"";
(*condition_list)->push_back (cond);
@ -1178,7 +1214,7 @@ Pandora_Module::addGenericCondition (string condition, list<Condition *> **condi
(*condition_list)->push_back (cond);
/* Interval */
} else if (sscanf (condition.c_str (), "(%lf , %lf) %1023[^\n]s", &(cond->value_1), &(cond->value_2), command) == 3) {
cond->operation = "()";
cond->operation = "()";
cond->command = command;
cond->command = "cmd.exe /c \"" + cond->command + "\"";
(*condition_list)->push_back (cond);
@ -1187,7 +1223,7 @@ Pandora_Module::addGenericCondition (string condition, list<Condition *> **condi
delete (cond);
return;
}
return;
}
@ -1526,7 +1562,7 @@ Pandora_Module::evaluateIntensiveConditions () {
* @return 1 if the module should run, 0 if not.
*/
int
Pandora_Module::checkCron () {
Pandora_Module::checkCron (int module_interval, int agent_interval) {
int i, time_params[5];
time_t current_time, offset;
struct tm *time_struct;
@ -1568,13 +1604,28 @@ Pandora_Module::checkCron () {
continue;
}
// Check if next execution will overflow the cron (only minutes overflow)
// If overflow, execute the module
bool overflow_cron = false;
if (i == 0) {
int start_cron_seconds = cron->params[i][0]*60;
int current_exec_seconds = time_params[i]*60;
int next_exec_seconds = time_params[i]*60 + module_interval*agent_interval;
if (current_exec_seconds > start_cron_seconds && current_exec_seconds > next_exec_seconds) {
start_cron_seconds += 3600;
}
if ((current_exec_seconds <= start_cron_seconds) && (start_cron_seconds <= next_exec_seconds)) {
overflow_cron = true;
}
}
// Check interval
if (cron->params[i][0] <= cron->params[i][1]) {
if (time_params[i] < cron->params[i][0] || time_params[i] > cron->params[i][1]) {
if ((time_params[i] < cron->params[i][0] || time_params[i] > cron->params[i][1]) && !overflow_cron) {
return 0;
}
} else {
if (time_params[i] < cron->params[i][0] && time_params[i] > cron->params[i][1]) {
if ((time_params[i] < cron->params[i][0] && time_params[i] > cron->params[i][1]) && !overflow_cron) {
return 0;
}
}

View File

@ -177,7 +177,8 @@ namespace Pandora_Modules {
unsigned char intensive_match;
int intensive_interval;
string unit, custom_id, str_warning, str_critical;
string module_group, warning_inverse, critical_inverse, quiet, module_ff_interval;
string module_group, warning_inverse, critical_inverse, quiet;
string module_ff_interval, module_alert_template, module_crontab;
string critical_instructions, warning_instructions, unknown_instructions, tags;
protected:
@ -278,6 +279,8 @@ namespace Pandora_Modules {
void setWarningInverse (string value);
void setQuiet (string value);
void setModuleFFInterval (string value);
void setModuleAlertTemplate (string value);
void setModuleCrontab (string value);
void setAsync (bool async);
void setSave (string save);
@ -289,7 +292,7 @@ namespace Pandora_Modules {
void addIntensiveCondition (string intensivecondition);
int evaluatePreconditions ();
void evaluateConditions ();
int checkCron ();
int checkCron (int module_interval, int agent_interval);
void setCron (string cron_string);
void setCronInterval (int interval);
int evaluateCondition (string string_value, double double_value, Condition *condition);

View File

@ -119,6 +119,7 @@ using namespace Pandora_Strutils;
#define TOKEN_MODULE_FF_INTERVAL ("module_ff_interval ")
#define TOKEN_MACRO ("module_macro")
#define TOKEN_NATIVE_ENCODING ("module_native_encoding")
#define TOKEN_ALERT_TEMPLATE ("module_alert_template")
string
parseLine (string line, string token) {
@ -171,7 +172,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
string module_unit, module_group, module_custom_id, module_str_warning, module_str_critical;
string module_critical_instructions, module_warning_instructions, module_unknown_instructions, module_tags;
string module_critical_inverse, module_warning_inverse, module_quiet, module_ff_interval;
string module_native_encoding;
string module_native_encoding, module_alert_template;
string macro;
Pandora_Module *module;
bool numeric;
@ -250,6 +251,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
module_quiet = "";
module_ff_interval = "";
module_native_encoding = "";
module_alert_template = "";
macro = "";
stringtok (tokens, definition, "\n");
@ -500,6 +502,12 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
if (module_ff_interval == "") {
module_ff_interval = parseLine (line, TOKEN_MODULE_FF_INTERVAL);
}
if (module_alert_template == "") {
module_alert_template = parseLine (line, TOKEN_ALERT_TEMPLATE);
module_alert_template.erase (0,1);
}
if (macro == "") {
macro = parseLine (line, TOKEN_MACRO);
@ -1069,6 +1077,13 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
module_ff_interval.replace(pos_macro, macro_name.size(), macro_value);
}
}
if (module_alert_template != "") {
pos_macro = module_alert_template.find(macro_name);
if (pos_macro != string::npos){
module_alert_template.replace(pos_macro, macro_name.size(), macro_value);
}
}
}
}
}
@ -1405,5 +1420,13 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
module->setModuleFFInterval (module_ff_interval);
}
if (module_alert_template != "") {
module->setModuleAlertTemplate (module_alert_template);
}
if (module_crontab != "") {
module->setModuleCrontab (module_crontab);
}
return module;
}

View File

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

View File

@ -1808,7 +1808,7 @@ Pandora_Windows_Service::pandora_run_broker (string config) {
}
/* Check preconditions */
if (module->checkCron () == 0) {
if (module->checkCron (module->getInterval (), atoi (conf->getValue ("interval").c_str())) == 0) {
pandoraDebug ("Cron not matched for module %s", module->getName ().c_str ());
module->setNoOutput ();
this->modules->goNext ();
@ -1928,7 +1928,7 @@ Pandora_Windows_Service::pandora_run (int forced_run) {
}
/* Check preconditions */
if (module->checkCron () == 0) {
if (module->checkCron (module->getInterval (), atoi (conf->getValue ("interval").c_str())) == 0) {
pandoraDebug ("Cron not matched for module %s", module->getName ().c_str ());
module->setNoOutput ();
this->modules->goNext ();

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 6.1dev-160210
Version: 6.1dev-160309
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.1dev-160210"
pandora_version="6.1dev-160309"
package_pear=0
package_pandora=1

View File

@ -0,0 +1,5 @@
-- ---------------------------------------------------------------------
-- Table `talert_templates`
-- ---------------------------------------------------------------------
ALTER TABLE talert_templates ADD COLUMN `min_alerts_reset_counter` tinyint(1) DEFAULT 0;

View File

@ -0,0 +1,5 @@
-- ---------------------------------------------------------------------
-- Table `talert_templates`
-- ---------------------------------------------------------------------
ALTER TABLE talert_templates ADD COLUMN min_alerts_reset_counter NUMBER(5, 0) DEFAULT 0;

View File

@ -124,7 +124,12 @@ echo '<div id="login_in">';
'', 'class="login login_password" placeholder="'.__('Password').'"', false, true);
echo '</div>';
echo '<div class="login_button">';
html_print_submit_button(__("Login"), "login_button", false, 'class="sub next_login"');
if ($config['auth'] == 'saml') {
html_print_submit_button(__("Login with SAML"), "login_button_saml", false, 'class="sub login_boton"');
}
else {
html_print_submit_button(__("Login"), "login_button", false, 'class="sub next_login"');
}
echo '</div>';
break;
case 'logout':

View File

@ -720,13 +720,13 @@ $table->width = '100%';
$table->data[2][1] = '<b>'.__('Auth user').'</b>';
$table->data[2][2] = html_print_input_text ('snmp3_auth_user', $snmp3_auth_user, '', 15, 60, true);
$table->data[2][3] = '<b>'.__('Auth password').'</b>';
$table->data[2][4] = html_print_input_text ('snmp3_auth_pass', $snmp3_auth_pass, '', 15, 60, true);
$table->data[2][4] = html_print_input_password ('snmp3_auth_pass', $snmp3_auth_pass, '', 15, 60, true);
$table->data[2][4] .= html_print_input_hidden('active_snmp_v3', 0, true);
$table->data[5][0] = '<b>'.__('Privacy method').'</b>';
$table->data[5][1] = html_print_select(array('DES' => __('DES'), 'AES' => __('AES')), 'snmp3_privacy_method', $snmp3_privacy_method, '', '', '', true);
$table->data[5][2] = '<b>'.__('privacy pass').'</b>';
$table->data[5][3] = html_print_input_text ('snmp3_privacy_pass', $snmp3_privacy_pass, '', 15, 60, true);
$table->data[5][3] = html_print_input_password ('snmp3_privacy_pass', $snmp3_privacy_pass, '', 15, 60, true);
$table->data[6][0] = '<b>'.__('Auth method').'</b>';
$table->data[6][1] = html_print_select(array('MD5' => __('MD5'), 'SHA' => __('SHA')), 'snmp3_auth_method', $snmp3_auth_method, '', '', '', true);

View File

@ -360,13 +360,13 @@ $table->width = '100%';
$table->data[2][1] = '<b>'.__('Auth user').'</b>';
$table->data[2][2] = html_print_input_text ('snmp3_auth_user', $snmp3_auth_user, '', 15, 60, true);
$table->data[2][3] = '<b>'.__('Auth password').'</b>';
$table->data[2][4] = html_print_input_text ('snmp3_auth_pass', $snmp3_auth_pass, '', 15, 60, true);
$table->data[2][4] = html_print_input_password ('snmp3_auth_pass', $snmp3_auth_pass, '', 15, 60, true);
$table->data[2][4] .= html_print_input_hidden('active_snmp_v3', 0, true);
$table->data[5][0] = '<b>'.__('Privacy method').'</b>';
$table->data[5][1] = html_print_select(array('DES' => __('DES'), 'AES' => __('AES')), 'snmp3_privacy_method', $snmp3_privacy_method, '', '', '', true);
$table->data[5][2] = '<b>'.__('privacy pass').'</b>';
$table->data[5][3] = html_print_input_text ('snmp3_privacy_pass', $snmp3_privacy_pass, '', 15, 60, true);
$table->data[5][3] = html_print_input_password ('snmp3_privacy_pass', $snmp3_privacy_pass, '', 15, 60, true);
$table->data[6][0] = '<b>'.__('Auth method').'</b>';
$table->data[6][1] = html_print_select(array('MD5' => __('MD5'), 'SHA' => __('SHA')), 'snmp3_auth_method', $snmp3_auth_method, '', '', '', true);

View File

@ -18,7 +18,7 @@ global $config;
check_login();
if (! check_acl ($config['id_user'], 0, "AW")) {
if (! check_acl ($config['id_user'], 0, "AD")) {
db_pandora_audit("ACL Violation",
"Trying to access downtime scheduler");
require ("general/noaccess.php");
@ -82,16 +82,16 @@ $id_agent = (int) get_parameter ('id_agent');
$insert_downtime_agent = (int) get_parameter ('insert_downtime_agent');
$delete_downtime_agent = (int) get_parameter ('delete_downtime_agent');
// User groups with AW permission for ACL checks
$user_groups_aw = array_keys(users_get_groups($config['id_user'], 'AW'));
// User groups with AD permission for ACL checks
$user_groups_ad = array_keys(users_get_groups($config['id_user'], 'AD'));
// INSERT A NEW DOWNTIME_AGENT ASSOCIATION
if ($insert_downtime_agent === 1) {
// Check AW permission on downtime
// Check AD permission on downtime
$downtime_group = db_get_value('id_group', 'tplanned_downtime', 'id', $id_downtime);
if ($downtime_group === false || !in_array($downtime_group, $user_groups_aw)) {
if ($downtime_group === false || !in_array($downtime_group, $user_groups_ad)) {
db_pandora_audit("ACL Violation",
"Trying to access downtime scheduler");
require ("general/noaccess.php");
@ -111,10 +111,10 @@ if ($insert_downtime_agent === 1) {
else {
foreach ($agents as $agent_id) {
// Check AW permission on agent
// Check AD permission on agent
$agent_group = db_get_value('id_grupo', 'tagente', 'id_agente', $agent_id);
if ($agent_group === false || !in_array($agent_group, $user_groups_aw)) {
if ($agent_group === false || !in_array($agent_group, $user_groups_ad)) {
continue;
}
@ -155,20 +155,20 @@ if ($delete_downtime_agent === 1) {
$id_da = (int) get_parameter ('id_downtime_agent');
// Check AW permission on downtime
// Check AD permission on downtime
$downtime_group = db_get_value('id_group', 'tplanned_downtime', 'id', $id_downtime);
if ($downtime_group === false || !in_array($downtime_group, $user_groups_aw)) {
if ($downtime_group === false || !in_array($downtime_group, $user_groups_ad)) {
db_pandora_audit("ACL Violation",
"Trying to access downtime scheduler");
require ("general/noaccess.php");
return;
}
// Check AW permission on agent
// Check AD permission on agent
$agent_group = db_get_value('id_grupo', 'tagente', 'id_agente', $id_agent);
if ($agent_group === false || !in_array($agent_group, $user_groups_aw)) {
if ($agent_group === false || !in_array($agent_group, $user_groups_ad)) {
db_pandora_audit("ACL Violation",
"Trying to access downtime scheduler");
require ("general/noaccess.php");
@ -223,8 +223,8 @@ if ($create_downtime || $update_downtime) {
$sql = '';
if ($create_downtime) {
// Check AW permission on new downtime
if (!in_array($id_group, $user_groups_aw)) {
// Check AD permission on new downtime
if (!in_array($id_group, $user_groups_ad)) {
db_pandora_audit("ACL Violation",
"Trying to access downtime scheduler");
require ("general/noaccess.php");
@ -277,16 +277,16 @@ if ($create_downtime || $update_downtime) {
else if ($update_downtime) {
$old_downtime = db_get_row('tplanned_downtime', 'id', $id_downtime);
// Check AW permission on OLD downtime
if (empty($old_downtime) || !in_array($old_downtime['id_group'], $user_groups_aw)) {
// Check AD permission on OLD downtime
if (empty($old_downtime) || !in_array($old_downtime['id_group'], $user_groups_ad)) {
db_pandora_audit("ACL Violation",
"Trying to access downtime scheduler");
require ("general/noaccess.php");
return;
}
// Check AW permission on NEW downtime group
if (!in_array($id_group, $user_groups_aw)) {
// Check AD permission on NEW downtime group
if (!in_array($id_group, $user_groups_ad)) {
db_pandora_audit("ACL Violation",
"Trying to access downtime scheduler");
require ("general/noaccess.php");
@ -424,8 +424,8 @@ if ($id_downtime > 0) {
$result = db_get_row_sql ($sql);
// Permission check for the downtime with the AW user groups
if (empty($result) || !in_array($result['id_group'], $user_groups_aw) ){
// Permission check for the downtime with the AD user groups
if (empty($result) || !in_array($result['id_group'], $user_groups_ad) ){
db_pandora_audit("ACL Violation",
"Trying to access downtime scheduler");
require ("general/noaccess.php");
@ -472,7 +472,7 @@ $table->data = array ();
$table->data[0][0] = __('Name');
$table->data[0][1] = html_print_input_text ('name', $name, '', 25, 40, true, $disabled_in_execution);
$table->data[1][0] = __('Group');
$table->data[1][1] = html_print_select_groups(false, "AW", true, 'id_group', $id_group, '', '', 0, true, false, true, '', $disabled_in_execution);
$table->data[1][1] = html_print_select_groups(false, "AD", true, 'id_group', $id_group, '', '', 0, true, false, true, '', $disabled_in_execution);
$table->data[2][0] = __('Description');
$table->data[2][1] = html_print_textarea ('description', 3, 35, $description, '', true);
@ -632,8 +632,8 @@ if ($id_downtime > 0) {
$filter_group = (int) get_parameter("filter_group", 0);
// User AW groups to str for the filter
$id_groups_str = implode(",", $user_groups_aw);
// User AD groups to str for the filter
$id_groups_str = implode(",", $user_groups_ad);
if (empty($id_groups_str)) {
// Restrictive filter on error. This will filter all the downtimes
@ -671,7 +671,7 @@ if ($id_downtime > 0) {
echo "<form method=post action='index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor&id_downtime=$id_downtime'>";
html_print_select_groups(false, "AW", true, 'filter_group', $filter_group, '', '', '', false, false, true, '', false, 'width:180px');
html_print_select_groups(false, "AD", true, 'filter_group', $filter_group, '', '', '', false, false, true, '', false, 'width:180px');
echo "<br /><br />";
html_print_submit_button (__('Filter by group'), '', false, 'class="sub next"',false);

View File

@ -19,7 +19,7 @@ global $config;
check_login();
$read_permisson = check_acl ($config['id_user'], 0, "AR");
$write_permisson = check_acl ($config['id_user'], 0, "AW");
$write_permisson = check_acl ($config['id_user'], 0, "AD");
if (! $read_permisson) {
db_pandora_audit("ACL Violation",
@ -63,8 +63,8 @@ $stop_downtime = (bool) get_parameter ('stop_downtime');
if ($stop_downtime) {
$downtime = db_get_row('tplanned_downtime', 'id', $id_downtime);
// Check AW permission on the downtime
if (empty($downtime) || ! check_acl ($config['id_user'], $downtime['id_group'], "AW")) {
// Check AD permission on the downtime
if (empty($downtime) || ! check_acl ($config['id_user'], $downtime['id_group'], "AD")) {
db_pandora_audit("ACL Violation",
"Trying to access downtime scheduler");
require ("general/noaccess.php");
@ -86,8 +86,8 @@ $delete_downtime = (int) get_parameter ('delete_downtime');
if ($delete_downtime) {
$downtime = db_get_row('tplanned_downtime', 'id', $id_downtime);
// Check AW permission on the downtime
if (empty($downtime) || ! check_acl ($config['id_user'], $downtime['id_group'], "AW")) {
// Check AD permission on the downtime
if (empty($downtime) || ! check_acl ($config['id_user'], $downtime['id_group'], "AD")) {
db_pandora_audit("ACL Violation",
"Trying to access downtime scheduler");
require ("general/noaccess.php");
@ -375,9 +375,9 @@ else {
ui_pagination($downtimes_number, "index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list&$filter_params_str", $offset);
// User groups with AW permission
$groupsAW = users_get_groups($config['id_user'], 'AW');
$groupsAW = array_keys($groupsAW);
// User groups with AD permission
$groupsAD = users_get_groups($config['id_user'], 'AD');
$groupsAD = array_keys($groupsAD);
// View available downtimes present in database (if any of them)
$table = new StdClass();
@ -445,7 +445,7 @@ else {
}
// If user have writting permissions
if (in_array($downtime['id_group'], $groupsAW)) {
if (in_array($downtime['id_group'], $groupsAD)) {
// Stop button
if ($downtime['type_execution'] == 'once' && $downtime["executed"] == 1) {

View File

@ -255,6 +255,7 @@ function update_template ($step) {
$threshold = (int) get_parameter ('threshold');
$max_alerts = (int) get_parameter ('max_alerts');
$min_alerts = (int) get_parameter ('min_alerts');
$min_alerts_reset_counter = (int) get_parameter ('min_alerts_reset_counter');
$type = (string) get_parameter ('type');
$value = (string) html_entity_decode (get_parameter ('value'));
$max = (float) get_parameter ('max');
@ -279,6 +280,7 @@ function update_template ($step) {
'id_alert_action' => $default_action,
'max_alerts' => $max_alerts,
'min_alerts' => $min_alerts,
'min_alerts_reset_counter' => $min_alerts_reset_counter,
'type' => $type,
'value' => $value,
'max_value' => $max,
@ -360,6 +362,7 @@ for ($i = 1; $i <= 10; $i++) {
}
$priority = 1;
$min_alerts = 0;
$min_alerts_reset_counter = 0;
$max_alerts = 1;
$threshold = SECONDS_1DAY;
$recovery_notify = false;
@ -467,6 +470,7 @@ if ($id && ! $create_template) {
$special_day = (bool) $template['special_day'];
$max_alerts = $template['max_alerts'];
$min_alerts = $template['min_alerts'];
$min_alerts_reset_counter = $template['min_alerts_reset_counter'];
$threshold = $template['time_threshold'];
$fields = array();
for ($i = 1; $i <= 10; $i++) {
@ -549,11 +553,15 @@ if ($step == 2) {
$table->data[3][0] = __('Min. number of alerts');
$table->data[3][1] = html_print_input_text ('min_alerts',
$min_alerts, '', 5, 7, true);
$table->data[3][2] = __('Max. number of alerts');
$table->data[3][3] = html_print_input_text ('max_alerts',
$table->data[3][2] = __('Reset counter when alert is not continuously') . ui_print_help_tip(__('Enable this option if you want to reset the counter for minimum number of alerts when the alert state is not continuously even if it\'s in the time threshold.'), true);;
$table->data[3][3] = html_print_checkbox ('min_alerts_reset_counter', 1, $min_alerts_reset_counter, true);
$table->data[4][0] = __('Max. number of alerts');
$table->data[4][1] = html_print_input_text ('max_alerts',
$max_alerts, '', 5, 7, true);
$table->data[4][0] = __('Default action');
$table->data[5][0] = __('Default action');
$usr_groups = implode(',', array_keys(users_get_groups($config['id_user'], 'LM', true)));
switch ($config['dbtype']) {
case "mysql":
@ -573,23 +581,23 @@ if ($step == 2) {
ORDER BY dbms_lob.substr(name,4000,1)', $usr_groups);
break;
}
$table->data[4][1] = html_print_select_from_sql ($sql_query,
$table->data[5][1] = html_print_select_from_sql ($sql_query,
'default_action', $default_action, '', __('None'), 0,
true, false, false, false, false, false, 0) .
ui_print_help_tip (
__('In case you fill any Field 1, Field 2 or Field 3 above, those will replace the corresponding fields of this associated "Default action".'), true);
$table->data[5][0] = __('Condition type');
$table->data[5][1] = html_print_select (alerts_get_alert_templates_types (), 'type',
$table->data[6][0] = __('Condition type');
$table->data[6][1] = html_print_select (alerts_get_alert_templates_types (), 'type',
$type, '', __('Select'), 0, true, false, false);
$table->data[5][1] .= '<span id="matches_value" ' .
$table->data[6][1] .= '<span id="matches_value" ' .
($show_matches ? '' : 'style="display: none"').'>';
$table->data[5][1] .= '&nbsp;'.html_print_checkbox ('matches_value', 1, $matches, true);
$table->data[5][1] .= html_print_label(
$table->data[6][1] .= '&nbsp;'.html_print_checkbox ('matches_value', 1, $matches, true);
$table->data[6][1] .= html_print_label(
__('Trigger when matches the value'),
'checkbox-matches_value', true);
$table->data[5][1] .= '</span>';
$table->colspan[5][1] = 3;
$table->data[6][1] .= '</span>';
$table->colspan[6][1] = 3;
$table->data['value'][0] = __('Value');
$table->data['value'][1] = html_print_input_text ('value', $value, '',

View File

@ -58,7 +58,7 @@ if (is_ajax()) {
}
}
echo json_encode($plugin);
echo io_json_mb_encode($plugin);
return;
}
@ -97,7 +97,7 @@ if (is_ajax()) {
$agents[] = $current_element;
}
echo json_encode($agents);
echo io_json_mb_encode($agents);
return;
}
@ -125,7 +125,7 @@ if (is_ajax()) {
}, array());
echo json_encode($module_plugin_macros);
echo io_json_mb_encode($module_plugin_macros);
return;
}
@ -225,7 +225,7 @@ if ($update) {
$module_macros = json_encode($result_macros, JSON_FORCE_OBJECT);
$module_macros = io_json_mb_encode($result_macros, JSON_FORCE_OBJECT);
if (empty($module_macros)) {
$module_macros = $module_macros_str;
}

View File

@ -156,7 +156,7 @@ echo "</td>";
echo "</tr><tr>";
echo "<td colspan='3' align='right'></td>";
echo "</tr></table>";
echo "<div style='width:100%'><input style='float:right;' type=submit name='store' class='sub add' value='".__('Add')."'></div></form>";
echo "<div style='width:100%'><input style='float:right;' id='submit-add' type=submit name='store' class='sub add' value='".__('Add')."'></div></form>";
ui_require_jquery_file ('pandora.controls');
ui_require_jquery_file ('ajaxqueue');
@ -169,6 +169,19 @@ $(document).ready (function () {
$(document).data('text_for_module', $("#none_text").html());
$("#id_agents").change(agent_changed_by_multiple_agents);
$("#submit-add").click(function() {
$('#module').map(function(){
if ($(this).val() != "0" )
$(this).prop('selected', true);
});
if($('#module')[0].childElementCount == 1 && ($('#module')[0].value == "" || $('#module')[0].value == "0")) {
alert('<?php echo __('Please, select a module'); ?>');
return false;
}
});
});
function filterByGroup(idGroup) {

View File

@ -73,13 +73,16 @@ ui_print_page_header (__('Reporting')." &raquo; ".__('Custom graphs'), "images/c
// Delete module SQL code
if ($delete_graph) {
if (check_acl ($config['id_user'], 0, "RW")) {
$result = db_process_sql_delete("tgraph_source", array('id_graph' =>$id));
if ($result)
$result = ui_print_success_message(__('Successfully deleted'));
else
$result = ui_print_error_message(__('Not deleted. Error deleting data'));
$exist = db_get_value("id_graph", "tgraph_source", "id_graph", $id);
if ($exist) {
$result = db_process_sql_delete("tgraph_source", array('id_graph' =>$id));
if ($result)
$result = ui_print_success_message(__('Successfully deleted'));
else
$result = ui_print_error_message(__('Not deleted. Error deleting data'));
}
$result = db_process_sql_delete("tgraph", array('id_graph' =>$id));
if ($result) {
@ -150,7 +153,9 @@ if (!empty ($graphs)) {
$table->align[3] = 'left';
if (check_acl ($config['id_user'], 0, "RW")) {
$table->align[4] = 'left';
$table->head[4] = __('Op.');
$table->head[4] = __('Op.') .
html_print_checkbox('all_delete', 0, false, true, false,
'check_all_checkboxes();');
$table->size[4] = '90px';
}
$table->data = array ();
@ -174,36 +179,33 @@ if (!empty ($graphs)) {
$data[4] .= '<a href="index.php?sec=reporting&sec2=godmode/reporting/graphs&delete_graph=1&id='
.$graph['id_graph'].'" onClick="if (!confirm(\''.__('Are you sure?').'\'))
return false;">' . html_print_image("images/cross.png", true) . '</a>' .
html_print_checkbox_extended ('delete_multiple[]', $graph['id_graph'], false, false, '', 'class="check_delete"', true);
return false;">' . html_print_image("images/cross.png", true, array('alt' => __('Delete'), 'title' => __('Delete'))) . '</a>' .
html_print_checkbox_extended ('delete_multiple[]', $graph['id_graph'], false, false, '', 'class="check_delete" style="margin-left:2px;"', true);
}
array_push ($table->data, $data);
}
html_print_table ($table);
echo "<table width='100%'>";
echo "<tr>";
echo "<td>";
echo "<div style='float: right;'>";
if (!empty($graphs)){
if (check_acl ($config['id_user'], 0, "RW") && users_can_manage_group_all($graph['id_group'])) {
echo "<form method='post' style='float:right;' action='index.php?sec=reporting&sec2=godmode/reporting/graphs'>";
html_print_input_hidden('multiple_delete', 1);
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"');
echo "</form>";
}
}
if (check_acl ($config['id_user'], 0, "RW")) {
echo '<form method="post" style="float:right;" action="index.php?sec=reporting&sec2=godmode/reporting/graph_builder">';
html_print_submit_button (__('Create graph'), 'create', false, 'class="sub next" style="margin-right:5px;"');
echo "</form>";
}
echo "</div>";
echo "</td>";
echo "</tr>";
echo "</table>";
if (!empty($graphs)){
echo "<form method='post' style='' action='index.php?sec=reporting&sec2=godmode/reporting/graphs'>";
html_print_input_hidden('multiple_delete', 1);
html_print_table ($table);
echo "<div style='float: right;'>";
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"');
echo "</div>";
echo "</form>";
}
echo "<div style='float: right;'>";
if (check_acl ($config['id_user'], 0, "RW")) {
echo '<form method="post" style="float:right;" action="index.php?sec=reporting&sec2=godmode/reporting/graph_builder">';
html_print_submit_button (__('Create graph'), 'create', false, 'class="sub next" style="margin-right:5px;"');
echo "</form>";
}
echo "</div>";
}
else {
require_once ($config['homedir'] . "/general/firts_task/custom_graphs.php");
@ -213,13 +215,15 @@ else {
<script type="text/javascript">
function check_all_checkboxes() {
if ($("input[name=all_delete]").attr('checked')) {
$(".check_delete").attr('checked', true);
$("input[name=all_delete]").css("margin-left", "32px");
function check_all_checkboxes() {
if ($("input[name=all_delete]").prop("checked")) {
$(".check_delete").prop("checked", true);
}
else {
$(".check_delete").prop("checked", false);
}
}
else {
$(".check_delete").attr('checked', false);
}
}
</script>

View File

@ -69,7 +69,7 @@ $table->data['name'][1] = html_print_input_text('name', $reportName,
$table->data['group'][0] = __('Group');
$write_groups = users_get_groups_for_select(false, "RW",
users_can_manage_group_all(), true, false, 'id_grupo');
users_can_manage_group_all(0, "RW"), true, false, 'id_grupo');
// If the report group is not among the RW groups (special permission) we add it
if (!isset($write_groups[$idGroupReport]) && $idGroupReport) {

View File

@ -252,22 +252,26 @@ echo '</form>';
// Event callback for the auth select
function show_selected_rows (event) {
var auth_method = $(this).val();
if (auth_method !== 'mysql') {
$('tr.remote').show();
if (auth_method == 'saml') {
$('tr#table2-autocreate_remote_users').hide();
}
show_autocreate_options(null);
}
else {
$('tr.remote').hide();
}
}
// Hide all the auth methods (except mysql)
_.each(auth_methods, function(value, key) {
if (value !== 'mysql')
$('tr.' + value).hide();
});
// Show the selected auth method
$('tr.' + auth_method).show();
}
// Event callback for the autocreate remote users radio buttons

View File

@ -538,8 +538,7 @@ function update_user_password ($user, $password_new) {
$config['rpandora_dbname'], $config['rpandora_user'],
$config['rpandora_pass']);
$remote_pass_update = db_process_sql ($sql, 'affected_rows', $connection);
html_debug_print($remote_pass_update, true);
html_debug_print($sql, true);
if (!$remote_pass_update) {
$config["auth_error"] = __('Could not changes password on remote pandora');
return false;

View File

@ -350,8 +350,10 @@ class Tree {
// Get the agents of a group
case 'group':
if (empty($rootID) || $rootID == -1) {
if ($this->strictACL)
return false;
// Strict acl specifications
/*if ($this->strictACL)
return false;*/
$columns = 'tg.id_grupo AS id, tg.nombre AS name, tg.parent, tg.icon';
$order_fields = 'tg.nombre ASC, tg.id_grupo ASC';
@ -1130,6 +1132,14 @@ class Tree {
foreach ($items as $item) {
$groups[$item['id']] = $this->getProcessedItem($item);
}
// If user have not permissions in parent, set parent node to 0 (all)
$user_groups_with_privileges = users_get_groups($config['id_user']);
foreach ($groups as $id => $group) {
if (!in_array($groups[$id]['parent'], array_keys($user_groups_with_privileges))) {
$groups[$id]['parent'] = 0;
}
}
// Build the group hierarchy
foreach ($groups as $id => $group) {
if (isset($groups[$id]['parent']) && ($groups[$id]['parent'] != 0)) {
@ -2082,19 +2092,20 @@ class Tree {
$rootIDs = $this->rootID;
$items = array();
$j = 1;
$server = metaconsole_get_servers();
foreach ($rootIDs as $serverID => $rootID) {
$server = metaconsole_get_servers($serverID);
if (metaconsole_connect($server) != NOERR)
if (metaconsole_connect($server[$j]) != NOERR)
continue;
db_clean_cache();
$this->rootID = $rootID;
$newItems = $this->getItems();
$this->processAgents($newItems, $server);
$this->processAgents($newItems, $server[$j]);
$newItems = array_filter($newItems);
$items = array_merge($items, $newItems);
metaconsole_restore_db();
$j++;
}
$this->rootID = $rootIDs;

View File

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

View File

@ -461,6 +461,14 @@ define("OPTION_SINGLE_SELECT_TIME", 7);
define("OPTION_CUSTOM_INPUT", 8);
define("OPTION_AGENT_AUTOCOMPLETE", 9);
/* SAML attributes constants */
define("SAML_ROLE", "urn:mace:rediris.es:entitlement:monitoring:role");
define("SAML_TAG", "urn:mace:rediris.es:entitlement:monitoring:tag");
define("USER_DESC", "commonName");
define("ID_USER_IN_PANDORA", "eduPersonTargetedId");
define("GROUP_IN_PANDORA", "schacHomeOrganization");
define("MAIL_IN_PANDORA", "mail");
/* Other constants */
define("STATUS_OK", 0);
define("STATUS_ERROR", 1);

View File

@ -0,0 +1,508 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2012 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; version 2
// 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.
/**
* @package Include
* @subpackage Constants
*/
/* Enterprise hook constant */
define ('ENTERPRISE_NOT_HOOK', -1);
/**/
define('DATE_FORMAT', 'Y/m/d');
define('DATE_FORMAT_JS', 'yy/mm/dd');
define('TIME_FORMAT', 'H:i:s');
define('TIME_FORMAT_JS', 'HH:mm:ss');
/* Events state constants */
define ('EVENT_NEW', 0);
define ('EVENT_VALIDATE', 1);
define ('EVENT_PROCESS', 2);
/* Agents disabled status */
define ('AGENT_ENABLED', 0);
define ('AGENT_DISABLED', 1);
/* Error report codes */
define ('NOERR', 11111);
define ('ERR_GENERIC', -10000);
define ('ERR_EXIST', -20000);
define ('ERR_INCOMPLETE', -30000);
define ('ERR_DB', -40000);
define ('ERR_DB_HOST', -40001);
define ('ERR_DB_DB', -40002);
define ('ERR_FILE', -50000);
define ('ERR_NOCHANGES', -60000);
define ('ERR_NODATA', -70000);
define ('ERR_CONNECTION', -80000);
define ('ERR_DISABLED', -90000);
define ('ERR_WRONG', -100000);
define ('ERR_WRONG_NAME', -100001);
define ('ERR_WRONG_PARAMETERS', -100002);
define ('ERR_ACL', -110000);
define ('ERR_AUTH', -120000);
define ('ERR_COULDNT_RESOLVE_HOST', -130000);
/* Event status code */
define ('EVENT_STATUS_NEW', 0);
define ('EVENT_STATUS_INPROCESS', 2);
define ('EVENT_STATUS_VALIDATED', 1);
/* Seconds in a time unit constants */
define('SECONDS_1MINUTE', 60);
define('SECONDS_2MINUTES', 120);
define('SECONDS_5MINUTES', 300);
define('SECONDS_10MINUTES', 600);
define('SECONDS_15MINUTES', 900);
define('SECONDS_30MINUTES', 1800);
define('SECONDS_1HOUR', 3600);
define('SECONDS_2HOUR', 7200);
define('SECONDS_3HOUR', 10800);
define('SECONDS_5HOUR', 18000);
define('SECONDS_6HOURS', 21600);
define('SECONDS_12HOURS', 43200);
define('SECONDS_1DAY', 86400);
define('SECONDS_2DAY', 172800);
define('SECONDS_4DAY', 345600);
define('SECONDS_5DAY', 432000);
define('SECONDS_1WEEK', 604800);
define('SECONDS_10DAY', 864000);
define('SECONDS_2WEEK', 1209600);
define('SECONDS_15DAYS', 1296000);
define('SECONDS_1MONTH', 2592000);
define('SECONDS_2MONTHS', 5184000);
define('SECONDS_3MONTHS', 7776000);
define('SECONDS_6MONTHS', 15552000);
define('SECONDS_1YEAR', 31104000);
define('SECONDS_2YEARS', 62208000);
define('SECONDS_3YEARS', 93312000);
/* Separator constats */
define('SEPARATOR_COLUMN', ';');
define('SEPARATOR_ROW', chr(10)); //chr(10) = '\n'
define('SEPARATOR_COLUMN_CSV', "#");
define('SEPARATOR_ROW_CSV', "@\n");
/* Backup paths */
switch ($config["dbtype"]) {
case "mysql":
case "postgresql":
define ('BACKUP_DIR', 'attachment/backups');
define ('BACKUP_FULLPATH', $config['homedir'] . '/' . BACKUP_DIR);
break;
case "oracle":
define ('BACKUP_DIR', 'DATA_PUMP_DIR');
define ('BACKUP_FULLPATH', 'DATA_PUMP_DIR');
break;
}
/* Color constants */
define('COL_CRITICAL', '#FC4444');
define('COL_WARNING', '#FAD403');
define('COL_WARNING_DARK', '#FFB900');
define('COL_NORMAL', '#80BA27');
define('COL_NOTINIT', '#3BA0FF');
define('COL_UNKNOWN', '#B2B2B2');
define('COL_ALERTFIRED', '#FFA631');
define('COL_MINOR', '#F099A2');
define('COL_MAJOR', '#C97A4A');
define('COL_INFORMATIONAL', '#E4E4E4');
define('COL_MAINTENANCE', '#3BA0FF');
define('COL_GRAPH1', '#C397F2');
define('COL_GRAPH2', '#FFE66C');
define('COL_GRAPH3', '#92CCA3');
define('COL_GRAPH4', '#EA6D5B');
define('COL_GRAPH5', '#6BD8DD');
define('COL_GRAPH6', '#F49B31');
define('COL_GRAPH7', '#999999');
define('COL_GRAPH8', '#F2B8C1');
define('COL_GRAPH9', '#C4E8C1');
define('COL_GRAPH10', '#C1DBE5');
define('COL_GRAPH11', '#C9C1e0');
define('COL_GRAPH12', '#F45B95');
define('COL_GRAPH13', '#E83128');
/* The styles */
/* Size of text in characters for truncate */
define('GENERIC_SIZE_TEXT', 25);
/* Agent module status */
define('AGENT_MODULE_STATUS_ALL', -1);
define('AGENT_MODULE_STATUS_CRITICAL_BAD', 1);
define('AGENT_MODULE_STATUS_CRITICAL_ALERT', 100);
define('AGENT_MODULE_STATUS_NO_DATA', 4);
define('AGENT_MODULE_STATUS_NORMAL', 0);
define('AGENT_MODULE_STATUS_NORMAL_ALERT', 300);
define('AGENT_MODULE_STATUS_NOT_NORMAL', 6);
define('AGENT_MODULE_STATUS_WARNING', 2);
define('AGENT_MODULE_STATUS_WARNING_ALERT', 200);
define('AGENT_MODULE_STATUS_UNKNOWN', 3);
define('AGENT_MODULE_STATUS_NOT_INIT', 5);
/* Agent status */
define('AGENT_STATUS_ALL', -1);
define('AGENT_STATUS_CRITICAL', 1);
define('AGENT_STATUS_NORMAL', 0);
define('AGENT_STATUS_NOT_INIT', 5);
define('AGENT_STATUS_NOT_NORMAL', 6);
define('AGENT_STATUS_UNKNOWN', 3);
define('AGENT_STATUS_ALERT_FIRED', 4);
define('AGENT_STATUS_WARNING', 2);
/* Visual maps contants */
//The items kind
define('STATIC_GRAPH', 0);
define('PERCENTILE_BAR', 3);
define('MODULE_GRAPH', 1);
define('SIMPLE_VALUE', 2);
define('LABEL', 4);
define('ICON', 5);
define('SIMPLE_VALUE_MAX', 6);
define('SIMPLE_VALUE_MIN', 7);
define('SIMPLE_VALUE_AVG', 8);
define('PERCENTILE_BUBBLE', 9);
define('SERVICE', 10); //Enterprise Item.
define('GROUP_ITEM', 11);
define('BOX_ITEM', 12);
define('LINE_ITEM', 13);
//Some styles
define('MIN_WIDTH', 300);
define('MIN_HEIGHT', 120);
define('MIN_WIDTH_CAPTION', 420);
//The process for simple value
define('PROCESS_VALUE_NONE', 0);
define('PROCESS_VALUE_MIN', 1);
define('PROCESS_VALUE_MAX', 2);
define('PROCESS_VALUE_AVG', 3);
//Status
define('VISUAL_MAP_STATUS_CRITICAL_BAD', 1);
define('VISUAL_MAP_STATUS_CRITICAL_ALERT', 4);
define('VISUAL_MAP_STATUS_NORMAL', 0);
define('VISUAL_MAP_STATUS_WARNING', 2);
define('VISUAL_MAP_STATUS_UNKNOWN', 3);
define('VISUAL_MAP_STATUS_WARNING_ALERT', 10);
//Wizard
define('VISUAL_MAP_WIZARD_PARENTS_NONE', 0);
define('VISUAL_MAP_WIZARD_PARENTS_ITEM_MAP', 1);
define('VISUAL_MAP_WIZARD_PARENTS_AGENT_RELANTIONSHIP', 2);
/* Service constants */
//Status
define('SERVICE_STATUS_UNKNOWN', -1);
define('SERVICE_STATUS_NORMAL', 0);
define('SERVICE_STATUS_CRITICAL', 1);
define('SERVICE_STATUS_WARNING', 2);
define('SERVICE_STATUS_ALERT', 4);
//Default weights
define('SERVICE_WEIGHT_CRITICAL', 1);
define('SERVICE_WEIGHT_WARNING', 0.5);
define('SERVICE_ELEMENT_WEIGHT_CRITICAL', 1);
define('SERVICE_ELEMENT_WEIGHT_WARNING', 0.5);
define('SERVICE_ELEMENT_WEIGHT_OK', 0);
define('SERVICE_ELEMENT_WEIGHT_UNKNOWN', 0);
//Modes
define('SERVICE_MODE_MANUAL', 0);
define('SERVICE_MODE_AUTO', 1);
define('SERVICE_MODE_SIMPLE', 2);
/* Status images */
//For modules
define ('STATUS_MODULE_OK', 'module_ok.png');
define ('STATUS_MODULE_CRITICAL', 'module_critical.png');
define ('STATUS_MODULE_WARNING', 'module_warning.png');
define ('STATUS_MODULE_NO_DATA', 'module_no_data.png');
define ('STATUS_MODULE_UNKNOWN', 'module_unknown.png');
//For agents
define ('STATUS_AGENT_CRITICAL', 'agent_critical.png');
define ('STATUS_AGENT_WARNING', 'agent_warning.png');
define ('STATUS_AGENT_DOWN', 'agent_down.png');
define ('STATUS_AGENT_UNKNOWN', 'agent_unknown.png');
define ('STATUS_AGENT_OK', 'agent_ok.png');
define ('STATUS_AGENT_NO_DATA', 'agent_no_data.png');
define ('STATUS_AGENT_NO_MONITORS', 'agent_no_monitors.png');
define ('STATUS_AGENT_NOT_INIT', 'agent_notinit.png');
//For alerts
define ('STATUS_ALERT_FIRED', 'alert_fired.png');
define ('STATUS_ALERT_NOT_FIRED', 'alert_not_fired.png');
define ('STATUS_ALERT_DISABLED', 'alert_disabled.png');
//For servers
define ('STATUS_SERVER_OK', 'server_ok.png');
define ('STATUS_SERVER_DOWN', 'server_down.png');
/* Status images (ball) */
//For modules
define ('STATUS_MODULE_OK_BALL', 'module_ok_ball.png');
define ('STATUS_MODULE_CRITICAL_BALL', 'module_critical_ball.png');
define ('STATUS_MODULE_WARNING_BALL', 'module_warning_ball.png');
define ('STATUS_MODULE_NO_DATA_BALL', 'module_no_data_ball.png');
define ('STATUS_MODULE_UNKNOWN_BALL', 'module_unknown_ball.png');
//For agents
define ('STATUS_AGENT_CRITICAL_BALL', 'agent_critical_ball.png');
define ('STATUS_AGENT_WARNING_BALL', 'agent_warning_ball.png');
define ('STATUS_AGENT_DOWN_BALL', 'agent_down_ball.png');
define ('STATUS_AGENT_UNKNOWN_BALL', 'agent_unknown_ball.png');
define ('STATUS_AGENT_OK_BALL', 'agent_ok_ball.png');
define ('STATUS_AGENT_NO_DATA_BALL', 'agent_no_data_ball.png');
define ('STATUS_AGENT_NO_MONITORS_BALL', 'agent_no_monitors_ball.png');
define ('STATUS_AGENT_NOT_INIT_BALL', 'agent_notinit_ball.png');
//For alerts
define ('STATUS_ALERT_FIRED_BALL', 'alert_fired_ball.png');
define ('STATUS_ALERT_NOT_FIRED_BALL', 'alert_not_fired_ball.png');
define ('STATUS_ALERT_DISABLED_BALL', 'alert_disabled_ball.png');
//For servers
define ('STATUS_SERVER_OK_BALL', 'server_ok_ball.png');
define ('STATUS_SERVER_DOWN_BALL', 'server_down_ball.png');
/* Events criticity */
define ('EVENT_CRIT_MAINTENANCE', 0);
define ('EVENT_CRIT_INFORMATIONAL', 1);
define ('EVENT_CRIT_NORMAL', 2);
define ('EVENT_CRIT_MINOR', 5);
define ('EVENT_CRIT_WARNING', 3);
define ('EVENT_CRIT_MAJOR', 6);
define ('EVENT_CRIT_CRITICAL', 4);
define ('EVENT_CRIT_WARNING_OR_CRITICAL', 34);
define ('EVENT_CRIT_NOT_NORMAL', 20);
define ('EVENT_CRIT_OR_NORMAL', 21);
/* Id Module (more use in component)*/
define ('MODULE_DATA', 1);
define ('MODULE_NETWORK', 2);
define ('MODULE_SNMP', 2);
define ('MODULE_PLUGIN', 4);
define ('MODULE_PREDICTION', 5);
define ('MODULE_WMI', 6);
define ('MODULE_WEB', 7);
/* Type of Modules of Prediction */
define ('MODULE_PREDICTION_SERVICE', 2);
define ('MODULE_PREDICTION_SYNTHETIC', 3);
define ('MODULE_PREDICTION_NETFLOW', 4);
/* SNMP CONSTANTS */
define('SNMP_DIR_MIBS', "attachment/mibs");
define('SNMP_TRAP_TYPE_NONE', -1);
define('SNMP_TRAP_TYPE_COLD_START', 0);
define('SNMP_TRAP_TYPE_WARM_START', 1);
define('SNMP_TRAP_TYPE_LINK_DOWN', 2);
define('SNMP_TRAP_TYPE_LINK_UP', 3);
define('SNMP_TRAP_TYPE_AUTHENTICATION_FAILURE', 4);
define('SNMP_TRAP_TYPE_OTHER', 5);
/* PASSWORD POLICIES */
define('PASSSWORD_POLICIES_OK', 0);
define('PASSSWORD_POLICIES_FIRST_CHANGE', 1);
define('PASSSWORD_POLICIES_EXPIRED', 2);
/* SERVER TYPES */
define('SERVER_TYPE_DATA', 0);
define('SERVER_TYPE_NETWORK', 1);
define('SERVER_TYPE_SNMP', 2);
define('SERVER_TYPE_RECON', 3);
define('SERVER_TYPE_PLUGIN', 4);
define('SERVER_TYPE_PREDICTION', 5);
define('SERVER_TYPE_WMI', 6);
define('SERVER_TYPE_EXPORT', 7);
define('SERVER_TYPE_INVENTORY', 8);
define('SERVER_TYPE_WEB', 9);
define('SERVER_TYPE_EVENT', 10);
define('SERVER_TYPE_ENTERPRISE_ICMP', 11);
define('SERVER_TYPE_ENTERPRISE_SNMP', 12);
define('SERVER_TYPE_ENTERPRISE_SATELLITE', 13);
/* REPORTS */
define('REPORT_TOP_N_MAX', 1);
define('REPORT_TOP_N_MIN', 2);
define('REPORT_TOP_N_AVG', 0);
define('REPORT_TOP_N_ONLY_GRAPHS', 2);
define('REPORT_TOP_N_SHOW_TABLE_GRAPS', 1);
define('REPORT_TOP_N_ONLY_TABLE', 0);
define('REPORT_EXCEPTION_CONDITION_EVERYTHING', 0);
define('REPORT_EXCEPTION_CONDITION_GE', 1);
define('REPORT_EXCEPTION_CONDITION_LE', 5);
define('REPORT_EXCEPTION_CONDITION_L', 2);
define('REPORT_EXCEPTION_CONDITION_G', 6);
define('REPORT_EXCEPTION_CONDITION_E', 7);
define('REPORT_EXCEPTION_CONDITION_NE', 8);
define('REPORT_EXCEPTION_CONDITION_OK', 3);
define('REPORT_EXCEPTION_CONDITION_NOT_OK', 4);
define('REPORT_ITEM_ORDER_BY_AGENT_NAME', 3);
define('REPORT_ITEM_ORDER_BY_ASCENDING', 2);
define('REPORT_ITEM_ORDER_BY_DESCENDING', 1);
define('REPORT_ITEM_ORDER_BY_UNSORT', 0);
define('REPORT_OLD_TYPE_SIMPLE_GRAPH', 1);
define('REPORT_OLD_TYPE_CUSTOM_GRAPH', 2);
define('REPORT_OLD_TYPE_SLA', 3);
define('REPORT_OLD_TYPE_MONITOR_REPORT', 6);
define('REPORT_OLD_TYPE_AVG_VALUE', 7);
define('REPORT_OLD_TYPE_MAX_VALUE', 8);
define('REPORT_OLD_TYPE_MIN_VALUE', 9);
define('REPORT_OLD_TYPE_SUMATORY', 10);
define('REPORT_GENERAL_NOT_GROUP_BY_AGENT', 0);
define('REPORT_GENERAL_GROUP_BY_AGENT', 1);
define('REPORTING_CUSTOM_GRAPH_LEGEND_EACH_MODULE_VERTICAL_SIZE', 15);
/* POLICIES */
define("POLICY_UPDATED", 0);
define("POLICY_PENDING_DATABASE", 1);
define("POLICY_PENDING_ALL", 2);
define("STATUS_IN_QUEUE_OUT", 0);
define("STATUS_IN_QUEUE_IN", 1);
define("STATUS_IN_QUEUE_APPLYING", 2);
define("MODULE_UNLINKED", 0);
define("MODULE_LINKED", 1);
define("MODULE_PENDING_UNLINK", 10);
define("MODULE_PENDING_LINK", 11);
/* EVENTS */
define("EVENTS_GOING_UNKNOWN" , 'going_unknown');
define("EVENTS_UNKNOWN", 'unknown');
define("EVENTS_ALERT_FIRED", 'alert_fired');
define("EVENTS_ALERT_RECOVERED", 'alert_recovered');
define("EVENTS_ALERT_CEASED", 'alert_ceased');
define("EVENTS_ALERT_MANUAL_VALIDATION", 'alert_manual_validation');
define("EVENTS_RECON_HOST_DETECTED", 'recon_host_detected');
define("EVENTS_SYSTEM", 'system');
define("EVENTS_ERROR", 'error');
define("EVENTS_NEW_AGENT", 'new_agent');
define("EVENTS_GOING_UP_WARNING", 'going_up_warning');
define("EVENTS_GOING_UP_CRITICAL", 'going_up_critical');
define("EVENTS_GOING_DOWN_WARNING", 'going_down_warning');
define("EVENTS_GOING_DOWN_NORMAL", 'going_down_normal');
define("EVENTS_GOING_DOWN_CRITICAL", 'going_down_critical');
define("EVENTS_GOING_UP_NORMAL", 'going_up_normal');
define("EVENTS_CONFIGURATION_CHANGE", 'configuration_change');
/* CUSTOM GRAPHS */
define("CUSTOM_GRAPH_AREA", 0);
define("CUSTOM_GRAPH_STACKED_AREA", 1);
define("CUSTOM_GRAPH_LINE", 2);
define("CUSTOM_GRAPH_STACKED_LINE", 3);
define("CUSTOM_GRAPH_BULLET_CHART", 4);
define("CUSTOM_GRAPH_GAUGE", 5);
define("CUSTOM_GRAPH_HBARS", 6);
define("CUSTOM_GRAPH_VBARS", 7);
define("CUSTOM_GRAPH_PIE", 8);
/* COLLECTIONS */
define("COLLECTION_PENDING_APPLY", 0);
define("COLLECTION_CORRECT", 1);
define("COLLECTION_ERROR_LOST_DIRECTORY", 2);
define("COLLECTION_UNSAVED", 3);
/* PAGINATION */
define("PAGINATION_BLOCKS_LIMIT", 15);
/* CHARTS */
define("CHART_DEFAULT_WIDTH", 150);
define("CHART_DEFAULT_HEIGHT", 110);
define("CHART_DEFAULT_ALPHA", 50);
/* Statwin */
define("STATWIN_DEFAULT_CHART_WIDTH", 555);
define("STATWIN_DEFAULT_CHART_HEIGHT", 245);
/* Dashboard */
define("DASHBOARD_DEFAULT_COUNT_CELLS", 9);
define("OPTION_TEXT", 1);
define("OPTION_SINGLE_SELECT", 2);
define("OPTION_MULTIPLE_SELECT", 3);
define("OPTION_BOOLEAN", 4);
define("OPTION_TEXTAREA", 5);
define("OPTION_TREE_GROUP_SELECT", 6);
define("OPTION_SINGLE_SELECT_TIME", 7);
define("OPTION_CUSTOM_INPUT", 8);
define("OPTION_AGENT_AUTOCOMPLETE", 9);
<<<<<<< HEAD
/* Other constants */
define("STATUS_OK", 0);
define("STATUS_ERROR", 1);
/* Maps (new networkmaps and new visualmaps) */
define("MAP_TYPE_NETWORKMAP", 0);
define("MAP_TYPE_VISUALMAP", 1);
define("MAP_SUBTYPE_TOPOLOGY", 0);
define("MAP_SUBTYPE_POLICIES", 1);
define("MAP_SUBTYPE_GROUPS", 2);
define("MAP_SUBTYPE_RADIAL_DYNAMIC", 3);
define("MAP_GENERATION_CIRCULAR", 0);
define("MAP_GENERATION_PLANO", 1);
define("MAP_GENERATION_RADIAL", 2);
define("MAP_GENERATION_SPRING1", 3);
define("MAP_GENERATION_SPRING2", 4);
define("MAP_SOURCE_GROUP", 0);
define("MAP_SOURCE_IP_MASK", 1);
/* Background options */
define("CENTER", 0);
define("MOSAIC", 1);
define("STRECH", 2);
define("FIT_WIDTH", 3);
define("FIT_HEIGH", 4);
/* Items of maps */
define("ITEM_TYPE_AGENT_NETWORKMAP", 0);
define("ITEM_TYPE_MODULE_NETWORKMAP", 1);
define("ITEM_TYPE_EDGE_NETWORKMAP", 2);
=======
/* SAML attributes constants */
define("SAML_ROLE", "urn:mace:rediris.es:entitlement:monitoring:role");
define("SAML_TAG", "urn:mace:rediris.es:entitlement:monitoring:tag");
define("USER_DESC", "commonName");
define("ID_USER_IN_PANDORA", "eduPersonTargetedId");
define("GROUP_IN_PANDORA", "schacHomeOrganization");
define("MAIL_IN_PANDORA", "mail");
>>>>>>> develop
?>

View File

@ -3672,8 +3672,14 @@ function api_get_plugins($thrash1, $thrash2, $other, $thrash3) {
$separator = $other['data'][0];
$filter = false;
$field_list = array( 'id', 'name', 'description',
'max_timeout', 'max_retries',
'execute', 'net_dst_opt',
'net_port_opt', 'user_opt',
'pass_opt', 'plugin_type',
'macros', 'parameters');
$plugins = @db_get_all_rows_filter ('tplugin', $filter);
$plugins = @db_get_all_rows_filter ('tplugin', $filter, $field_list);
if ($plugins !== false) {
$data['type'] = 'array';

View File

@ -1182,7 +1182,10 @@ function graphic_combined_module ($module_list, $weight_list, $period,
}
if (!empty($name_list) && $names_number == $module_number && isset($name_list[$i])) {
$module_name_list[$i] = $name_list[$i];
if ($labels[$agent_module_id] != '')
$module_name_list[$i] = $labels[$agent_module_id];
else
$module_name_list[$i] = $agent_name ." / ". $module_name;
}
else {
//Get and process agent name
@ -1195,10 +1198,13 @@ function graphic_combined_module ($module_list, $weight_list, $period,
//Get and process module name
$module_name = io_safe_output(
modules_get_agentmodule_name ($agent_module_id));
$module_name = sprintf(__("projection for %s"), $module_name);
$module_name = sprintf(__("%s"), $module_name);
$module_name = ui_print_truncate_text($module_name, 'module_small', false, true, false, '...', false);
$module_name_list[$i] = $agent_name ." / ". $module_name;
if ($labels[$agent_module_id] != '')
$module_name_list[$i] = $labels[$agent_module_id];
else
$module_name_list[$i] = $agent_name ." / ". $module_name;
}
// Data iterator

View File

@ -47,7 +47,7 @@ function groupview_get_all_data ($id_user = false, $user_strict = false, $acltag
}
if (!empty($user_groups_ids)) {
if (is_metaconsole()) {
if (is_metaconsole() && (!$user_strict)) {
switch ($config["dbtype"]) {
case "mysql":
$list_groups = db_get_all_rows_sql("
@ -104,7 +104,7 @@ function groupview_get_all_data ($id_user = false, $user_strict = false, $acltag
}
}
}
foreach ($list_groups as $group) {
$list[$group['id_grupo']]['_name_'] = $group['nombre'];
$list[$group['id_grupo']]['_id_'] = $group['id_grupo'];
@ -248,6 +248,81 @@ function groupview_get_all_data ($id_user = false, $user_strict = false, $acltag
$list["_server_sanity_"] = format_numeric (100 - $list["_module_sanity_"], 1);
}
else {
foreach ($list_groups as $group) {
$agent_not_init = agents_get_agents(array (
'disabled' => 0,
'id_grupo' => $group['id_grupo'],
'status' => AGENT_STATUS_NOT_INIT),
array ('COUNT(*) as total'), 'AR', false);
$list[$group['id_grupo']]['_agents_not_init_'] = isset ($agent_not_init[0]['total']) ? $agent_not_init[0]['total'] : 0;
$agent_unknown = agents_get_agents(array (
'disabled' => 0,
'id_grupo' => $group['id_grupo'],
'status' => AGENT_STATUS_UNKNOWN),
array ('COUNT(*) as total'), 'AR', false);
$list[$group['id_grupo']]['_agents_unknown_'] = isset ($agent_unknown[0]['total']) ? $agent_unknown[0]['total'] : 0;
$agent_total = agents_get_agents(array (
'disabled' => 0,
'id_grupo' => $group['id_grupo']),
array ('COUNT(*) as total'), 'AR', false);
$list[$group['id_grupo']]['_total_agents_'] = isset ($agent_total[0]['total']) ? $agent_total[0]['total'] : 0;
$list[$group['id_grupo']]["_monitor_not_normal_"] = $list[$group['id_grupo']]["_monitor_checks_"] - $list[$group['id_grupo']]["_monitors_ok_"];
$list[$group['id_grupo']]['_monitors_alerts_fired_'] = groupview_monitor_fired_alerts ($group['id_grupo'], $user_strict,array($group['id_grupo']));
$result_list = db_get_all_rows_sql("SELECT COUNT(*) as contado, estado
FROM tagente_estado tae INNER JOIN tagente ta
ON tae.id_agente = ta.id_agente
AND ta.disabled = 0
AND ta.id_grupo = " . $group['id_grupo'] . "
INNER JOIN tagente_modulo tam
ON tae.id_agente_modulo = tam.id_agente_modulo
AND tam.disabled = 0
WHERE tae.utimestamp > 0
GROUP BY estado");
if ($result_list) {
foreach ($result_list as $result) {
switch ($result['estado']) {
case AGENT_MODULE_STATUS_CRITICAL_BAD:
$list[$group['id_grupo']]['_monitors_critical_'] = (int)$result['contado'];
break;
case AGENT_MODULE_STATUS_WARNING_ALERT:
break;
case AGENT_MODULE_STATUS_WARNING:
$list[$group['id_grupo']]['_monitors_warning_'] = (int)$result['contado'];
break;
case AGENT_MODULE_STATUS_UNKNOWN:
$list[$group['id_grupo']]['_monitors_unknown_'] = (int)$result['contado'];
break;
}
}
}
$result_normal = db_get_row_sql("SELECT COUNT(*) as contado
FROM tagente_estado tae INNER JOIN tagente ta
ON tae.id_agente = ta.id_agente
AND ta.disabled = 0
AND ta.id_grupo = " . $group['id_grupo'] . "
INNER JOIN tagente_modulo tam
ON tae.id_agente_modulo = tam.id_agente_modulo
AND tam.disabled = 0
WHERE tae.estado = 0
AND (tae.utimestamp > 0 OR tam.id_tipo_modulo IN(21,22,23,100))
GROUP BY estado");
$list[$group['id_grupo']]['_monitors_ok_'] = isset ($result_normal['contado']) ? $result_normal['contado'] : 0;
$result_not_init = db_get_row_sql("SELECT COUNT(*) as contado
FROM tagente_estado tae INNER JOIN tagente ta
ON tae.id_agente = ta.id_agente
AND ta.disabled = 0
AND ta.id_grupo = " . $group['id_grupo'] . "
INNER JOIN tagente_modulo tam
ON tae.id_agente_modulo = tam.id_agente_modulo
AND tam.disabled = 0
WHERE tae.utimestamp = 0
AND tae.estado IN (".AGENT_MODULE_STATUS_NO_DATA.",".AGENT_MODULE_STATUS_NOT_INIT." )
AND tam.id_tipo_modulo NOT IN (21,22,23,100)
GROUP BY estado");
$list[$group['id_grupo']]['_monitors_not_init_'] = isset ($result_not_init['contado']) ? $result_not_init['contado'] : 0;
}
if ($user_strict) {
$i = 1;
foreach ($user_tags as $group_id => $tag_name) {
@ -281,88 +356,11 @@ function groupview_get_all_data ($id_user = false, $user_strict = false, $acltag
$i++;
}
}
else {
foreach ($list_groups as $group) {
$agent_not_init = agents_get_agents(array (
'disabled' => 0,
'id_grupo' => $group['id_grupo'],
'status' => AGENT_STATUS_NOT_INIT),
array ('COUNT(*) as total'), 'AR', false);
$list[$group['id_grupo']]['_agents_not_init_'] = isset ($agent_not_init[0]['total']) ? $agent_not_init[0]['total'] : 0;
$agent_unknown = agents_get_agents(array (
'disabled' => 0,
'id_grupo' => $group['id_grupo'],
'status' => AGENT_STATUS_UNKNOWN),
array ('COUNT(*) as total'), 'AR', false);
$list[$group['id_grupo']]['_agents_unknown_'] = isset ($agent_unknown[0]['total']) ? $agent_unknown[0]['total'] : 0;
$agent_total = agents_get_agents(array (
'disabled' => 0,
'id_grupo' => $group['id_grupo']),
array ('COUNT(*) as total'), 'AR', false);
$list[$group['id_grupo']]['_total_agents_'] = isset ($agent_total[0]['total']) ? $agent_total[0]['total'] : 0;
$list[$group['id_grupo']]["_monitor_not_normal_"] = $list[$group['id_grupo']]["_monitor_checks_"] - $list[$group['id_grupo']]["_monitors_ok_"];
$list[$group['id_grupo']]['_monitors_alerts_fired_'] = groupview_monitor_fired_alerts ($group['id_grupo'], $user_strict,array($group['id_grupo']));
$result_list = db_get_all_rows_sql("SELECT COUNT(*) as contado, estado
FROM tagente_estado tae INNER JOIN tagente ta
ON tae.id_agente = ta.id_agente
AND ta.disabled = 0
AND ta.id_grupo = " . $group['id_grupo'] . "
INNER JOIN tagente_modulo tam
ON tae.id_agente_modulo = tam.id_agente_modulo
AND tam.disabled = 0
WHERE tae.utimestamp > 0
GROUP BY estado");
if ($result_list) {
foreach ($result_list as $result) {
switch ($result['estado']) {
case AGENT_MODULE_STATUS_CRITICAL_BAD:
$list[$group['id_grupo']]['_monitors_critical_'] = (int)$result['contado'];
break;
case AGENT_MODULE_STATUS_WARNING_ALERT:
break;
case AGENT_MODULE_STATUS_WARNING:
$list[$group['id_grupo']]['_monitors_warning_'] = (int)$result['contado'];
break;
case AGENT_MODULE_STATUS_UNKNOWN:
$list[$group['id_grupo']]['_monitors_unknown_'] = (int)$result['contado'];
break;
}
}
}
$result_normal = db_get_row_sql("SELECT COUNT(*) as contado
FROM tagente_estado tae INNER JOIN tagente ta
ON tae.id_agente = ta.id_agente
AND ta.disabled = 0
AND ta.id_grupo = " . $group['id_grupo'] . "
INNER JOIN tagente_modulo tam
ON tae.id_agente_modulo = tam.id_agente_modulo
AND tam.disabled = 0
WHERE tae.estado = 0
AND (tae.utimestamp > 0 OR tam.id_tipo_modulo IN(21,22,23,100))
GROUP BY estado");
$list[$group['id_grupo']]['_monitors_ok_'] = isset ($result_normal['contado']) ? $result_normal['contado'] : 0;
$result_not_init = db_get_row_sql("SELECT COUNT(*) as contado
FROM tagente_estado tae INNER JOIN tagente ta
ON tae.id_agente = ta.id_agente
AND ta.disabled = 0
AND ta.id_grupo = " . $group['id_grupo'] . "
INNER JOIN tagente_modulo tam
ON tae.id_agente_modulo = tam.id_agente_modulo
AND tam.disabled = 0
WHERE tae.utimestamp = 0
AND tae.estado IN (".AGENT_MODULE_STATUS_NO_DATA.",".AGENT_MODULE_STATUS_NOT_INIT." )
AND tam.id_tipo_modulo NOT IN (21,22,23,100)
GROUP BY estado");
$list[$group['id_grupo']]['_monitors_not_init_'] = isset ($result_not_init['contado']) ? $result_not_init['contado'] : 0;
}
}
}
return $list;
}
function groupview_status_modules_agents($id_user = false, $user_strict = false, $access = 'AR', $force_group_and_tag = true) {
function groupview_status_modules_agents($id_user = false, $user_strict = false, $access = 'AR', $force_group_and_tag = true, $returnAllGroup = false) {
global $config;
if ($id_user == false) {
@ -378,8 +376,12 @@ function groupview_status_modules_agents($id_user = false, $user_strict = false,
$result_list = array ();
foreach ($servers as $server) {
if (metaconsole_connect($server) != NOERR) {
continue;
}
$server_list = groupview_get_all_data($id_user, $user_strict,
$acltags);
$acltags, $returnAllGroup);
foreach ($server_list as $server_item) {
if (! isset ($result_list[$server_item['_name_']])) {
@ -411,8 +413,9 @@ function groupview_status_modules_agents($id_user = false, $user_strict = false,
$result_list[$server_item['_name_']]["_monitor_alerts_fire_count_"] += $server_item["_monitor_alerts_fire_count_"];
$result_list[$server_item['_name_']]["_total_checks_"] += $server_item["_total_checks_"];
$result_list[$server_item['_name_']]["_total_alerts_"] += $server_item["_total_alerts_"];
}
}
}
metaconsole_restore_db();
}
return $result_list;
@ -443,11 +446,13 @@ function groupview_monitor_alerts ($group_array, $strict_user = false, $id_group
if ($strict_user) {
$group_clause_strict = implode (",", $id_group_strict);
$group_clause_strict = "(" . $group_clause_strict . ")";
$sql = "SELECT COUNT(talert_template_modules.id)
FROM talert_template_modules, tagente_modulo, tagente_estado, tagente
WHERE tagente.id_grupo IN $group_clause_strict AND tagente_modulo.id_agente = tagente.id_agente
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
AND talert_template_modules.id_agent_module = tagente_modulo.id_agente_modulo";
if ($group_clause_strict !== '()') {
$sql = "SELECT COUNT(talert_template_modules.id)
FROM talert_template_modules, tagente_modulo, tagente_estado, tagente
WHERE tagente.id_grupo IN $group_clause_strict AND tagente_modulo.id_agente = tagente.id_agente
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
AND talert_template_modules.id_agent_module = tagente_modulo.id_agente_modulo";
}
$count = db_get_sql ($sql);
return $count;
} else {
@ -479,13 +484,14 @@ function groupview_monitor_fired_alerts ($group_array, $strict_user = false, $id
if ($strict_user) {
$group_clause_strict = implode (",", $id_group_strict);
$group_clause_strict = "(" . $group_clause_strict . ")";
$sql = "SELECT COUNT(talert_template_modules.id)
FROM talert_template_modules, tagente_modulo, tagente_estado, tagente
WHERE tagente.id_grupo IN $group_clause_strict AND tagente_modulo.id_agente = tagente.id_agente
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
AND talert_template_modules.id_agent_module = tagente_modulo.id_agente_modulo
AND times_fired > 0 ";
if ($group_clause_strict !== '()'){
$sql = "SELECT COUNT(talert_template_modules.id)
FROM talert_template_modules, tagente_modulo, tagente_estado, tagente
WHERE tagente.id_grupo IN $group_clause_strict AND tagente_modulo.id_agente = tagente.id_agente
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
AND talert_template_modules.id_agent_module = tagente_modulo.id_agente_modulo
AND times_fired > 0 ";
}
$count = db_get_sql ($sql);
return $count;
} else {
@ -556,6 +562,8 @@ function groupview_get_data ($id_user = false, $user_strict = false, $acltags, $
if ($id_user == false) {
$id_user = $config['id_user'];
}
$groups_with_privileges = users_get_groups($id_user);
$groups_with_privileges = implode('","', $groups_with_privileges);
$user_groups = array();
$user_tags = array();
@ -573,7 +581,7 @@ function groupview_get_data ($id_user = false, $user_strict = false, $acltags, $
}
}
}
if (!$user_strict)
$acltags[0] = 0;
@ -585,7 +593,7 @@ function groupview_get_data ($id_user = false, $user_strict = false, $acltags, $
}
if (!empty($user_groups_ids)) {
if (is_metaconsole()) {
if (is_metaconsole() && (!$user_strict)) {
switch ($config["dbtype"]) {
case "mysql":
$list_groups = db_get_all_rows_sql("
@ -643,11 +651,12 @@ function groupview_get_data ($id_user = false, $user_strict = false, $acltags, $
}
}
//Add the group "All" at first
$group_all = array('id_grupo'=>0, 'nombre'=>'All', 'icon'=>'', 'parent'=>'', 'propagate'=>0, 'disabled'=>0,
'custom_id'=>'', 'id_skin'=>0, 'description'=>'', 'contact'=>'', 'other'=>'', 'password'=>'');
array_unshift($list_groups, $group_all);
if (!$user_strict) {
//Add the group "All" at first
$group_all = array('id_grupo'=>0, 'nombre'=>'All', 'icon'=>'', 'parent'=>'', 'propagate'=>0, 'disabled'=>0,
'custom_id'=>'', 'id_skin'=>0, 'description'=>'', 'contact'=>'', 'other'=>'', 'password'=>'');
array_unshift($list_groups, $group_all);
//Takes the parents even without agents, first ids
$fathers_id = '';
$list_father_groups = array();
@ -669,12 +678,16 @@ function groupview_get_data ($id_user = false, $user_strict = false, $acltags, $
}
//Eliminate the first comma
$fathers_id = substr($fathers_id, 1);
while ($fathers_id{0} == ',') {
$fathers_id = substr($fathers_id, 1);
}
//Takes the parents even without agents, complete groups
if ($fathers_id) {
$list_father_groups = db_get_all_rows_sql("
SELECT *
FROM tgrupo
WHERE id_grupo IN (" . $fathers_id . ")
AND nombre IN (\"". $groups_with_privileges ."\")
ORDER BY nombre COLLATE utf8_general_ci ASC");
if (!empty($list_father_groups)) {
//Merges the arrays and eliminates the duplicates groups
@ -702,7 +715,7 @@ function groupview_get_data ($id_user = false, $user_strict = false, $acltags, $
$list_groups = $final_list;
}
$list = array();
foreach ($list_groups as $group) {
$list[$group['id_grupo']]['_name_'] = $group['nombre'];
@ -848,30 +861,56 @@ function groupview_get_data ($id_user = false, $user_strict = false, $acltags, $
$list["_server_sanity_"] = format_numeric (100 - $list["_module_sanity_"], 1);
}
else {
if (!$user_strict) {
foreach ($list_groups as $group) {
foreach ($list_groups as $group) {
$agent_not_init = agents_get_agents(array (
'disabled' => 0,
'id_grupo' => $group['id_grupo'],
'status' => AGENT_STATUS_NOT_INIT),
array ('COUNT(*) as total'), 'AR', false);
$list[$group['id_grupo']]['_agents_not_init_'] = isset ($agent_not_init[0]['total']) ? $agent_not_init[0]['total'] : 0;
$agent_unknown = agents_get_agents(array (
'disabled' => 0,
'id_grupo' => $group['id_grupo'],
'status' => AGENT_STATUS_UNKNOWN),
array ('COUNT(*) as total'), 'AR', false);
$list[$group['id_grupo']]['_agents_unknown_'] = isset ($agent_unknown[0]['total']) ? $agent_unknown[0]['total'] : 0;
$agent_total = agents_get_agents(array (
'disabled' => 0,
'id_grupo' => $group['id_grupo']),
array ('COUNT(*) as total'), 'AR', false);
$list[$group['id_grupo']]['_total_agents_'] = isset ($agent_total[0]['total']) ? $agent_total[0]['total'] : 0;
$list[$group['id_grupo']]["_monitor_not_normal_"] = $list[$group['id_grupo']]["_monitor_checks_"] - $list[$group['id_grupo']]["_monitors_ok_"];
$list[$group['id_grupo']]["_monitor_not_normal_"] = $list[$group['id_grupo']]["_monitor_checks_"] - $list[$group['id_grupo']]["_monitors_ok_"];
$list[$group['id_grupo']]['_monitors_alerts_fired_'] = groupview_monitor_fired_alerts ($group['id_grupo'], $user_strict,$group['id_grupo']);
$result_list = db_get_all_rows_sql("SELECT COUNT(*) as contado, estado
FROM tagente_estado tae INNER JOIN tagente ta
ON tae.id_agente = ta.id_agente
AND ta.disabled = 0
AND ta.id_grupo = " . $group['id_grupo'] . "
INNER JOIN tagente_modulo tam
ON tae.id_agente_modulo = tam.id_agente_modulo
AND tam.disabled = 0
WHERE tae.utimestamp > 0
GROUP BY estado");
if ($result_list) {
foreach ($result_list as $result) {
switch ($result['estado']) {
case AGENT_MODULE_STATUS_CRITICAL_BAD:
$list[$group['id_grupo']]['_monitors_critical_'] = (int)$result['contado'];
break;
case AGENT_MODULE_STATUS_WARNING_ALERT:
break;
case AGENT_MODULE_STATUS_WARNING:
$list[$group['id_grupo']]['_monitors_warning_'] = (int)$result['contado'];
break;
case AGENT_MODULE_STATUS_UNKNOWN:
$list[$group['id_grupo']]['_monitors_unknown_'] = (int)$result['contado'];
break;
}
}
}
$agent_not_init = agents_get_agents(array (
'disabled' => 0,
'id_grupo' => $group['id_grupo'],
'status' => AGENT_STATUS_NOT_INIT),
array ('COUNT(*) as total'), 'AR', false);
$list[$group['id_grupo']]['_agents_not_init_'] = isset ($agent_not_init[0]['total']) ? $agent_not_init[0]['total'] : 0;
$agent_unknown = agents_get_agents(array (
'disabled' => 0,
'id_grupo' => $group['id_grupo'],
'status' => AGENT_STATUS_UNKNOWN),
array ('COUNT(*) as total'), 'AR', false);
$list[$group['id_grupo']]['_agents_unknown_'] = isset ($agent_unknown[0]['total']) ? $agent_unknown[0]['total'] : 0;
$agent_total = agents_get_agents(array (
'disabled' => 0,
'id_grupo' => $group['id_grupo']),
array ('COUNT(*) as total'), 'AR', false);
$list[$group['id_grupo']]['_total_agents_'] = isset ($agent_total[0]['total']) ? $agent_total[0]['total'] : 0;
$list[$group['id_grupo']]["_monitor_not_normal_"] = $list[$group['id_grupo']]["_monitor_checks_"] - $list[$group['id_grupo']]["_monitors_ok_"];
$list[$group['id_grupo']]["_monitor_not_normal_"] = $list[$group['id_grupo']]["_monitor_checks_"] - $list[$group['id_grupo']]["_monitors_ok_"];
$list[$group['id_grupo']]['_monitors_alerts_fired_'] = groupview_monitor_fired_alerts ($group['id_grupo'], $user_strict,$group['id_grupo']);
$result_list = db_get_all_rows_sql("SELECT COUNT(*) as contado, estado
$result_normal = db_get_row_sql("SELECT COUNT(*) as contado
FROM tagente_estado tae INNER JOIN tagente ta
ON tae.id_agente = ta.id_agente
AND ta.disabled = 0
@ -879,86 +918,58 @@ function groupview_get_data ($id_user = false, $user_strict = false, $acltags, $
INNER JOIN tagente_modulo tam
ON tae.id_agente_modulo = tam.id_agente_modulo
AND tam.disabled = 0
WHERE tae.utimestamp > 0
WHERE tae.estado = 0
AND (tae.utimestamp > 0 OR tam.id_tipo_modulo IN(21,22,23,100))
GROUP BY estado");
if ($result_list) {
foreach ($result_list as $result) {
switch ($result['estado']) {
case AGENT_MODULE_STATUS_CRITICAL_BAD:
$list[$group['id_grupo']]['_monitors_critical_'] = (int)$result['contado'];
break;
case AGENT_MODULE_STATUS_WARNING_ALERT:
break;
case AGENT_MODULE_STATUS_WARNING:
$list[$group['id_grupo']]['_monitors_warning_'] = (int)$result['contado'];
break;
case AGENT_MODULE_STATUS_UNKNOWN:
$list[$group['id_grupo']]['_monitors_unknown_'] = (int)$result['contado'];
break;
}
}
}
$result_normal = db_get_row_sql("SELECT COUNT(*) as contado
FROM tagente_estado tae INNER JOIN tagente ta
ON tae.id_agente = ta.id_agente
AND ta.disabled = 0
AND ta.id_grupo = " . $group['id_grupo'] . "
INNER JOIN tagente_modulo tam
ON tae.id_agente_modulo = tam.id_agente_modulo
AND tam.disabled = 0
WHERE tae.estado = 0
AND (tae.utimestamp > 0 OR tam.id_tipo_modulo IN(21,22,23,100))
GROUP BY estado");
$list[$group['id_grupo']]['_monitors_ok_'] = isset ($result_normal['contado']) ? $result_normal['contado'] : 0;
$result_not_init = db_get_row_sql("SELECT COUNT(*) as contado
FROM tagente_estado tae INNER JOIN tagente ta
ON tae.id_agente = ta.id_agente
AND ta.disabled = 0
AND ta.id_grupo = " . $group['id_grupo'] . "
INNER JOIN tagente_modulo tam
ON tae.id_agente_modulo = tam.id_agente_modulo
AND tam.disabled = 0
WHERE tae.utimestamp = 0 AND
tae.estado IN (".AGENT_MODULE_STATUS_NO_DATA.",".AGENT_MODULE_STATUS_NOT_INIT." )
AND tam.id_tipo_modulo NOT IN (21,22,23,100)
GROUP BY estado");
$list[$group['id_grupo']]['_monitors_not_init_'] = isset ($result_not_init['contado']) ? $result_not_init['contado'] : 0;
}
$list[$group['id_grupo']]['_monitors_ok_'] = isset ($result_normal['contado']) ? $result_normal['contado'] : 0;
$result_not_init = db_get_row_sql("SELECT COUNT(*) as contado
FROM tagente_estado tae INNER JOIN tagente ta
ON tae.id_agente = ta.id_agente
AND ta.disabled = 0
AND ta.id_grupo = " . $group['id_grupo'] . "
INNER JOIN tagente_modulo tam
ON tae.id_agente_modulo = tam.id_agente_modulo
AND tam.disabled = 0
WHERE tae.utimestamp = 0 AND
tae.estado IN (".AGENT_MODULE_STATUS_NO_DATA.",".AGENT_MODULE_STATUS_NOT_INIT." )
AND tam.id_tipo_modulo NOT IN (21,22,23,100)
GROUP BY estado");
$list[$group['id_grupo']]['_monitors_not_init_'] = isset ($result_not_init['contado']) ? $result_not_init['contado'] : 0;
}
else {
$i = 1;
foreach ($user_tags as $group_id => $tag_name) {
$id = db_get_value('id_tag', 'ttag', 'name', $tag_name);
}
$list[$i]['_id_'] = $id;
$list[$i]['_name_'] = $tag_name;
$list[$i]['_iconImg_'] = html_print_image ("images/tag_red.png", true, array ("style" => 'vertical-align: middle;'));
$list[$i]['_is_tag_'] = 1;
if ($user_strict) {
$i = 1;
foreach ($user_tags as $group_id => $tag_name) {
$id = db_get_value('id_tag', 'ttag', 'name', $tag_name);
$list[$i]['_total_agents_'] = (int) tags_get_total_agents ($id, $acltags, $agent_filter, $module_filter, $config["realtimestats"]);
$list[$i]['_agents_unknown_'] = (int) tags_get_unknown_agents ($id, $acltags, $agent_filter, $module_filter, $config["realtimestats"]);
$list[$i]['_agents_not_init_'] = (int) tags_get_not_init_agents ($id, $acltags, $agent_filter, $module_filter, $config["realtimestats"]);
$list[$i]['_monitors_ok_'] = (int) tags_get_normal_monitors ($id, $acltags, $agent_filter, $module_filter);
$list[$i]['_monitors_critical_'] = (int) tags_get_critical_monitors ($id, $acltags, $agent_filter, $module_filter);
$list[$i]['_monitors_warning_'] = (int) tags_get_warning_monitors ($id, $acltags, $agent_filter, $module_filter);
$list[$i]['_monitors_not_init_'] = (int) tags_get_not_init_monitors ($id, $acltags, $agent_filter, $module_filter);
$list[$i]['_monitors_unknown_'] = (int) tags_get_unknown_monitors ($id, $acltags, $agent_filter, $module_filter);
$list[$i]['_monitors_alerts_fired_'] = tags_monitors_fired_alerts($id, $acltags);
$list[$i]['_id_'] = $id;
$list[$i]['_name_'] = $tag_name;
$list[$i]['_iconImg_'] = html_print_image ("images/tag_red.png", true, array ("style" => 'vertical-align: middle;'));
$list[$i]['_is_tag_'] = 1;
if (! defined ('METACONSOLE')) {
if (($list[$i]['_agents_unknown_'] == 0) && ($list[$i]['_monitors_alerts_fired_'] == 0) && ($list[$i]['_total_agents_'] == 0) && ($list[$i]['_monitors_ok_'] == 0) && ($list[$i]['_monitors_critical_'] == 0) && ($list[$i]['_monitors_warning_'] == 0) && ($list[$i]['_monitors_unknown_'] == 0) && ($list[$i]['_monitors_not_init_'] == 0) && ($list[$i]['_agents_not_init_'] == 0)) {
unset($list[$i]);
}
$list[$i]['_total_agents_'] = (int) tags_get_total_agents ($id, $acltags, $agent_filter, $module_filter, $config["realtimestats"]);
$list[$i]['_agents_unknown_'] = (int) tags_get_unknown_agents ($id, $acltags, $agent_filter, $module_filter, $config["realtimestats"]);
$list[$i]['_agents_not_init_'] = (int) tags_get_not_init_agents ($id, $acltags, $agent_filter, $module_filter, $config["realtimestats"]);
$list[$i]['_monitors_ok_'] = (int) tags_get_normal_monitors ($id, $acltags, $agent_filter, $module_filter);
$list[$i]['_monitors_critical_'] = (int) tags_get_critical_monitors ($id, $acltags, $agent_filter, $module_filter);
$list[$i]['_monitors_warning_'] = (int) tags_get_warning_monitors ($id, $acltags, $agent_filter, $module_filter);
$list[$i]['_monitors_not_init_'] = (int) tags_get_not_init_monitors ($id, $acltags, $agent_filter, $module_filter);
$list[$i]['_monitors_unknown_'] = (int) tags_get_unknown_monitors ($id, $acltags, $agent_filter, $module_filter);
$list[$i]['_monitors_alerts_fired_'] = tags_monitors_fired_alerts($id, $acltags);
if (! defined ('METACONSOLE')) {
if (($list[$i]['_agents_unknown_'] == 0) && ($list[$i]['_monitors_alerts_fired_'] == 0) && ($list[$i]['_total_agents_'] == 0) && ($list[$i]['_monitors_ok_'] == 0) && ($list[$i]['_monitors_critical_'] == 0) && ($list[$i]['_monitors_warning_'] == 0) && ($list[$i]['_monitors_unknown_'] == 0) && ($list[$i]['_monitors_not_init_'] == 0) && ($list[$i]['_agents_not_init_'] == 0)) {
unset($list[$i]);
}
else {
if (($list[$i]['_agents_unknown_'] == 0) && ($list[$i]['_monitors_alerts_fired_'] == 0) && ($list[$i]['_total_agents_'] == 0) && ($list[$i]['_monitors_ok_'] == 0) && ($list[$i]['_monitors_critical_'] == 0) && ($list[$i]['_monitors_warning_'] == 0)) {
unset($list[$i]);
}
}
$i++;
}
else {
if (($list[$i]['_agents_unknown_'] == 0) && ($list[$i]['_monitors_alerts_fired_'] == 0) && ($list[$i]['_total_agents_'] == 0) && ($list[$i]['_monitors_ok_'] == 0) && ($list[$i]['_monitors_critical_'] == 0) && ($list[$i]['_monitors_warning_'] == 0)) {
unset($list[$i]);
}
}
$i++;
}
}

View File

@ -431,8 +431,8 @@ function __ ($string /*, variable arguments */) {
*
* @param string Text string to be encoded.
*/
function io_json_mb_encode($string) {
$v = json_encode($string);
function io_json_mb_encode($string, $encode_options = 0){
$v = json_encode($string, $encode_options);
$v = preg_replace_callback("/\\\\u([0-9a-zA-Z]{4})/",
create_function('$matches', 'return mb_convert_encoding(pack("H*", $matches[1]), "UTF-8", "UTF-16");'
), $v);

View File

@ -28,9 +28,15 @@ function tactical_get_data ($id_user = false, $user_strict = false, $acltags, $r
if ($user_strict) { //Remove groups with tags
$groups_without_tags[$group] = $group;
}
if ($tags != '') {
$tags_group = explode(',', $tags);
foreach ($tags_group as $tag) {
$user_tags[$tag] = tags_get_name($tag);
}
}
}
if ($user_strict) {
$user_groups_ids = implode(',', array_keys($groups_without_tags));
}
@ -366,7 +372,45 @@ function tactical_get_data ($id_user = false, $user_strict = false, $acltags, $r
// Calculate not_normal monitors
$list["_monitor_not_normal_"] = $list["_monitor_checks_"] - $list["_monitors_ok_"];
}
if ($user_strict) {
$i = 1;
$list = array();
foreach ($user_tags as $group_id => $tag_name) {
$id = db_get_value('id_tag', 'ttag', 'name', $tag_name);
$list[$i]['_id_'] = $id;
$list[$i]['_name_'] = $tag_name;
$list[$i]['_iconImg_'] = html_print_image ("images/tag_red.png", true, array ("style" => 'vertical-align: middle;'));
$list[$i]['_is_tag_'] = 1;
$list[$i]['_total_agents_'] = (int) tags_get_total_agents ($id, $acltags, $agent_filter, $module_filter, $config["realtimestats"]);
$list[$i]['_agents_ok_'] = (int) tags_get_normal_agents ($id, $acltags, $agent_filter, $module_filter, $config["realtimestats"]);
$list[$i]['_agents_warning_'] = (int) tags_get_warning_agents ($id, $acltags, $agent_filter, $module_filter, $config["realtimestats"]);
$list[$i]['_agents_critical_'] = (int) tags_get_critical_agents ($id, $acltags, $agent_filter, $module_filter, $config["realtimestats"]);
$list[$i]['_agents_unknown_'] = (int) tags_get_unknown_agents ($id, $acltags, $agent_filter, $module_filter, $config["realtimestats"]);
$list[$i]['_agents_not_init_'] = (int) tags_get_not_init_agents ($id, $acltags, $agent_filter, $module_filter, $config["realtimestats"]);
$list[$i]['_monitors_ok_'] = (int) tags_get_normal_monitors ($id, $acltags, $agent_filter, $module_filter);
$list[$i]['_monitors_critical_'] = (int) tags_get_critical_monitors ($id, $acltags, $agent_filter, $module_filter);
$list[$i]['_monitors_warning_'] = (int) tags_get_warning_monitors ($id, $acltags, $agent_filter, $module_filter);
$list[$i]['_monitors_not_init_'] = (int) tags_get_not_init_monitors ($id, $acltags, $agent_filter, $module_filter);
$list[$i]['_monitors_unknown_'] = (int) tags_get_unknown_monitors ($id, $acltags, $agent_filter, $module_filter);
$list[$i]['_monitors_alerts_fired_'] = tags_monitors_fired_alerts($id, $acltags);
if (! defined ('METACONSOLE')) {
if (($list[$i]['_agents_unknown_'] == 0) && ($list[$i]['_monitors_alerts_fired_'] == 0) && ($list[$i]['_total_agents_'] == 0) && ($list[$i]['_monitors_ok_'] == 0) && ($list[$i]['_monitors_critical_'] == 0) && ($list[$i]['_monitors_warning_'] == 0) && ($list[$i]['_monitors_unknown_'] == 0) && ($list[$i]['_monitors_not_init_'] == 0) && ($list[$i]['_agents_not_init_'] == 0)) {
unset($list[$i]);
}
}
else {
if (($list[$i]['_agents_unknown_'] == 0) && ($list[$i]['_monitors_alerts_fired_'] == 0) && ($list[$i]['_total_agents_'] == 0) && ($list[$i]['_monitors_ok_'] == 0) && ($list[$i]['_monitors_critical_'] == 0) && ($list[$i]['_monitors_warning_'] == 0)) {
unset($list[$i]);
}
}
$i++;
}
}
return $list;
}
@ -385,44 +429,44 @@ function tactical_status_modules_agents($id_user = false, $user_strict = false,
$result_list = array ();
foreach ($servers as $server) {
$server_list = tactical_get_data ($id_user, $user_strict,
if (metaconsole_connect($server) != NOERR) {
continue;
}
$result_list = tactical_get_data ($id_user, $user_strict,
$acltags);
if (!isset ($result_list[$server_item['_name_']])) {
$result_list[$server_item['_name_']] = $server_item;
}
else {
$result_list[$server_item['_name_']]['_monitors_ok_'] += $server_item['_monitors_ok_'];
$result_list[$server_item['_name_']]['_monitors_critical_'] += $server_item['_monitors_critical_'];
$result_list[$server_item['_name_']]['_monitors_warning_'] += $server_item['_monitors_warning_'];
$result_list[$server_item['_name_']]['_agents_unknown_'] += $server_item['_agents_unknown_'];
$result_list[$server_item['_name_']]['_total_agents_'] += $server_item['_total_agents_'];
$result_list[$server_item['_name_']]['_monitors_alerts_fired_'] += $server_item['_monitors_alerts_fired_'];
$result_list[$server_item['_name_']]['_agents_ok_'] += $server_item['_agents_ok_'];
$result_list[$server_item['_name_']]['_agents_critical_'] += $server_item['_agents_critical_'];
$result_list[$server_item['_name_']]['_agents_warning_'] += $server_item['_agents_warning_'];
$result_list[$server_item['_name_']]['_monitors_alerts_'] += $server_item['_monitors_alerts_'];
$result_list[$server_item['_name_']]["_monitor_checks_"] += $server_item["_monitor_checks_"];
$result_list[$server_item['_name_']]["_monitor_not_normal_"] += $server_item["_monitor_not_normal_"];
$result_list[$server_item['_name_']]["_monitor_health_"] += $server_item["_monitor_health_"];
$result_list[$server_item['_name_']]["_module_sanity_"] += $server_item["_module_sanity_"];
$result_list[$server_item['_name_']]["_alerts_"] += $server_item["_alerts_"];
$result_list[$server_item['_name_']]["_alert_level_"] += $server_item["_alert_level_"];
$result_list[$server_item['_name_']]["_monitor_bad_"] += $server_item["_monitor_bad_"];
$result_list[$server_item['_name_']]["_global_health_"] += $server_item["_global_health_"];
$result_list[$server_item['_name_']]["_server_sanity_"] += $server_item["_server_sanity_"];
$result_list[$server_item['_name_']]["_monitor_alerts_fire_count_"] += $server_item["_monitor_alerts_fire_count_"];
$result_list[$server_item['_name_']]["_total_checks_"] += $server_item["_total_checks_"];
$result_list[$server_item['_name_']]["_total_alerts_"] += $server_item["_total_alerts_"];
}
foreach ($server_list as $server_item) {
if (! isset ($result_list[$server_item['_name_']])) {
$result_list[$server_item['_name_']] = $server_item;
}
else {
$result_list[$server_item['_name_']]['_monitors_ok_'] += $server_item['_monitors_ok_'];
$result_list[$server_item['_name_']]['_monitors_critical_'] += $server_item['_monitors_critical_'];
$result_list[$server_item['_name_']]['_monitors_warning_'] += $server_item['_monitors_warning_'];
$result_list[$server_item['_name_']]['_agents_unknown_'] += $server_item['_agents_unknown_'];
$result_list[$server_item['_name_']]['_total_agents_'] += $server_item['_total_agents_'];
$result_list[$server_item['_name_']]['_monitors_alerts_fired_'] += $server_item['_monitors_alerts_fired_'];
$result_list[$server_item['_name_']]['_agents_ok_'] += $server_item['_agents_ok_'];
$result_list[$server_item['_name_']]['_agents_critical_'] += $server_item['_agents_critical_'];
$result_list[$server_item['_name_']]['_agents_warning_'] += $server_item['_agents_warning_'];
$result_list[$server_item['_name_']]['_monitors_alerts_'] += $server_item['_monitors_alerts_'];
$result_list[$server_item['_name_']]["_monitor_checks_"] += $server_item["_monitor_checks_"];
$result_list[$server_item['_name_']]["_monitor_not_normal_"] += $server_item["_monitor_not_normal_"];
$result_list[$server_item['_name_']]["_monitor_health_"] += $server_item["_monitor_health_"];
$result_list[$server_item['_name_']]["_module_sanity_"] += $server_item["_module_sanity_"];
$result_list[$server_item['_name_']]["_alerts_"] += $server_item["_alerts_"];
$result_list[$server_item['_name_']]["_alert_level_"] += $server_item["_alert_level_"];
$result_list[$server_item['_name_']]["_monitor_bad_"] += $server_item["_monitor_bad_"];
$result_list[$server_item['_name_']]["_global_health_"] += $server_item["_global_health_"];
$result_list[$server_item['_name_']]["_server_sanity_"] += $server_item["_server_sanity_"];
$result_list[$server_item['_name_']]["_monitor_alerts_fire_count_"] += $server_item["_monitor_alerts_fire_count_"];
$result_list[$server_item['_name_']]["_total_checks_"] += $server_item["_total_checks_"];
$result_list[$server_item['_name_']]["_total_alerts_"] += $server_item["_total_alerts_"];
}
}
}
metaconsole_restore_db();
return $result_list;
}
else {
@ -508,4 +552,4 @@ function tactical_monitor_fired_alerts ($group_array, $strict_user = false, $id_
}
}
?>
?>

View File

@ -1943,14 +1943,14 @@ function visual_map_print_visual_map ($id_layout, $show_links = true,
?>
<script language="javascript" type="text/javascript">
/* <![CDATA[ */
var id_layout = <?php echo $id_layout; ?>;
var lines = Array();
var user_lines = Array();
//Fixed to wait the load of images.
$(window).load(function() {
draw_lines(lines, 'background');
draw_lines(lines, 'background_'+id_layout);
draw_user_lines_read();
center_labels();
}
@ -2006,7 +2006,7 @@ function visual_map_print_visual_map ($id_layout, $show_links = true,
echo "<div style='width: 920px; overflow:auto; margin: 0 auto;'>";
}
echo '<div id="background"
echo '<div id="background_'.$id_layout.'"
style="margin:0px auto;
text-align:center;
z-index: 0;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More