mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-04-08 18:55:09 +02:00
Merge branch 'pandora_5.1' of https://github.com/pandorafms/pandorafms into pandora_5.1
This commit is contained in:
commit
9c9ccdb4cd
@ -1,5 +1,5 @@
|
||||
package: pandorafms-agent-unix
|
||||
Version: 5.1SP2-150329
|
||||
Version: 5.1SP2-150514
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="5.1SP2-150329"
|
||||
pandora_version="5.1SP2-150514"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
@ -41,7 +41,7 @@ my $Sem = undef;
|
||||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '5.1SP2';
|
||||
use constant AGENT_BUILD => '150329';
|
||||
use constant AGENT_BUILD => '150514';
|
||||
|
||||
# Commands to retrieve total memory information in kB
|
||||
use constant TOTALMEMORY_CMDS => {
|
||||
@ -752,8 +752,31 @@ sub read_config (;$) {
|
||||
$RemoteConfFile = "$AgentMD5.conf";
|
||||
$RemoteMD5File = "$AgentMD5.md5";
|
||||
|
||||
# Set the maximun number of threads
|
||||
$ThreadSem = Thread::Semaphore->new ($Conf{'agent_threads'}) if defined ($Sem);
|
||||
# Load thread support if agent_threads is greater than 1.
|
||||
if ($Conf{'agent_threads'} > 1) {
|
||||
eval {
|
||||
local $SIG{__DIE__};
|
||||
require threads;
|
||||
require threads::shared;
|
||||
require Thread::Semaphore;
|
||||
};
|
||||
if (!$@) {
|
||||
$Sem = Thread::Semaphore->new;
|
||||
$ThreadSem = Thread::Semaphore->new ($Conf{'agent_threads'});
|
||||
threads::shared::share (\$Xml);
|
||||
threads::shared::share (\$Sem);
|
||||
log_message ('log', 'Using thread library.');
|
||||
} else {
|
||||
log_message ('log', 'Thread library is not available. agent_threads is set to 1 (disabled).');
|
||||
$Conf{'agent_threads'} = 1;
|
||||
$Sem = undef;
|
||||
$ThreadSem = undef;
|
||||
}
|
||||
} else {
|
||||
$Sem = undef;
|
||||
$ThreadSem = undef;
|
||||
log_message ('log', 'Thread is disabled.');
|
||||
}
|
||||
|
||||
# Set tentacle client options
|
||||
if ($Conf{'transfer_mode'} eq 'tentacle') {
|
||||
@ -2059,27 +2082,6 @@ error ("Temporal directory '" . $Conf{'temporal'} . "' does not exist.") unless
|
||||
$Conf{'server_path'} = fix_directory ($Conf{'server_path'});
|
||||
$Conf{'secondary_server_path'} = fix_directory ($Conf{'secondary_server_path'});
|
||||
|
||||
# Load thread support if agent_threads is greater than 1.
|
||||
if ($Conf{'agent_threads'} > 1) {
|
||||
eval {
|
||||
local $SIG{__DIE__};
|
||||
require threads;
|
||||
require threads::shared;
|
||||
require Thread::Semaphore;
|
||||
};
|
||||
if (!$@) {
|
||||
$Sem = Thread::Semaphore->new;
|
||||
threads::shared::share (\$Xml);
|
||||
threads::shared::share (\$Sem);
|
||||
log_message ('log', 'Using thread library.');
|
||||
} else {
|
||||
log_message ('log', 'Thread library is not available. agent_threads is set to 1 (disabled).');
|
||||
$Conf{'agent_threads'} = 1;
|
||||
}
|
||||
} else {
|
||||
log_message ('log', 'Thread is disabled.');
|
||||
}
|
||||
|
||||
# Startup delay
|
||||
log_message ('log', 'Sleeping for ' . $Conf{'delayed_startup'} . ' seconds.') if ($Conf{'delayed_startup'} > 0);
|
||||
sleep ($Conf{'delayed_startup'});
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 5.1SP2
|
||||
%define release 150329
|
||||
%define release 150514
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 5.1SP2
|
||||
%define release 150329
|
||||
%define release 150514
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
@ -47,9 +47,9 @@ pidof_pandora () {
|
||||
fi
|
||||
if [ "$ZONE" = "global" ]
|
||||
then
|
||||
PANDORA_PID=`ps -f -z global | grep "$TRUNCATED_DAEMON" | grep -v grep | head -1 | awk '{ print $2 }'`
|
||||
PANDORA_PID=`ps -f -z global | grep "$TRUNCATED_DAEMON" | grep -v grep | awk '{ print $2 }'`
|
||||
else
|
||||
PANDORA_PID=`ps -Af | grep "$TRUNCATED_DAEMON" | grep -v grep | head -1 | awk '{ print $2 }'`
|
||||
PANDORA_PID=`ps -Af | grep "$TRUNCATED_DAEMON" | grep -v grep | awk '{ print $2 }'`
|
||||
fi
|
||||
elif [ "$OS_NAME" = "Linux" ] && [ -x /usr/sbin/vzpid ]
|
||||
then
|
||||
@ -66,7 +66,7 @@ pidof_pandora () {
|
||||
fi
|
||||
done
|
||||
else
|
||||
PANDORA_PID=`ps -Af | grep "$DAEMON $PANDORA_PATH" | grep -v grep | head -1 | awk '{ print $2 }'`
|
||||
PANDORA_PID=`ps -Af | grep "$DAEMON $PANDORA_PATH" | grep -v grep | awk '{ print $2 }'`
|
||||
fi
|
||||
|
||||
echo $PANDORA_PID
|
||||
@ -90,7 +90,14 @@ case "$1" in
|
||||
su $PANDORA_USER -c "PATH=$PATH nohup $DAEMON $PANDORA_PATH >/dev/null 2>$LOGFILE &"
|
||||
sleep 2
|
||||
PANDORA_PID=`pidof_pandora`
|
||||
echo "Pandora FMS Agent is now running with PID $PANDORA_PID"
|
||||
if [ "$PANDORA_PID" = "" ]
|
||||
then
|
||||
|
||||
echo "Pandora FMS Agent could not be started. Please check the file $LOGFILE."
|
||||
exit 1
|
||||
else
|
||||
echo "Pandora FMS Agent is now running with PID $PANDORA_PID"
|
||||
fi
|
||||
;;
|
||||
|
||||
stop)
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
server_ip $ServerIP$
|
||||
server_path /var/spool/pandora/data_in
|
||||
temporal "$AgentTemp$"
|
||||
temporal "C:\%ProgramFiles%\pandora_agent\temp"
|
||||
|
||||
#include "C:\Archivos de programa\pandora_agent\pandora_agent_alt.conf"
|
||||
#broker_agent name_agent
|
||||
@ -47,7 +47,7 @@ address auto
|
||||
#address 192.168.36.73
|
||||
|
||||
# Group assigned for this agent (descriptive, p.e: Servers)
|
||||
group "$AgentGroup$"
|
||||
group Servers
|
||||
|
||||
# This limits operation if temporal dir has not enough free disk.
|
||||
#temporal_min_size 1024
|
||||
@ -191,13 +191,85 @@ module_exec dir "%ProgramFiles%\Avira\AntiVir Desktop\aevdf.dat" | grep aevdf.da
|
||||
module_description Last update for Antivirus Signature file
|
||||
module_end
|
||||
|
||||
# Windows inventory module (This information will be displayed only in enterprise version)
|
||||
# Windows inventory module (This information will be displayed only in enterprise version)^M
|
||||
module_begin
|
||||
module_name Inventory
|
||||
module_interval 7
|
||||
module_type generic_data_string
|
||||
module_inventory CPU RAM CDROM Video HD Patches Services NIC
|
||||
module_description Inventory
|
||||
module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\cpuinfo.vbs"
|
||||
module_crontab * 12-15 * * 1
|
||||
module_end
|
||||
|
||||
module_begin
|
||||
module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\moboinfo.vbs"
|
||||
module_crontab * 12-15 * * 1
|
||||
module_end
|
||||
|
||||
module_begin
|
||||
module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\diskdrives.vbs"
|
||||
module_crontab * 12-15 * * 1
|
||||
module_end
|
||||
|
||||
module_begin
|
||||
module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\cdromdrives.vbs"
|
||||
module_crontab * 12-15 * * 1
|
||||
module_end
|
||||
|
||||
module_begin
|
||||
module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\videocardinfo.vbs"
|
||||
module_crontab * 12-15 * * 1
|
||||
module_end
|
||||
|
||||
module_begin
|
||||
module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\ifaces.vbs"
|
||||
module_crontab * 12-15 * * 1
|
||||
module_end
|
||||
|
||||
module_begin
|
||||
module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\monitors.vbs"
|
||||
module_crontab * 12-15 * * 1
|
||||
module_end
|
||||
|
||||
module_begin
|
||||
module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\printers.vbs"
|
||||
module_crontab * 12-15 * * 1
|
||||
module_end
|
||||
|
||||
module_begin
|
||||
module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\raminfo.vbs"
|
||||
module_crontab * 12-15 * * 1
|
||||
module_end
|
||||
|
||||
module_begin
|
||||
module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\software_installed.vbs"
|
||||
module_crontab * 12-15 * * 1
|
||||
module_end
|
||||
|
||||
module_begin
|
||||
module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\userslogged.vbs"
|
||||
module_crontab * 12-15 * * 1
|
||||
module_end
|
||||
|
||||
module_begin
|
||||
module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\productkey.vbs"
|
||||
module_crontab * 12-15 * * 1
|
||||
module_end
|
||||
|
||||
module_begin
|
||||
module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\productID.vbs"
|
||||
module_crontab * 12-15 * * 1
|
||||
module_end
|
||||
|
||||
module_begin
|
||||
module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\architecture.vbs"
|
||||
module_crontab * 12-15 * * 1
|
||||
module_end
|
||||
|
||||
module_begin
|
||||
module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\domain.vbs"
|
||||
module_crontab * 12-15 * * 1
|
||||
module_end
|
||||
|
||||
module_begin
|
||||
module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\osversion.vbs"
|
||||
module_crontab * 12-15 * * 1
|
||||
module_end
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------
|
||||
|
25
pandora_agents/win32/bin/util/architecture.vbs
Normal file
25
pandora_agents/win32/bin/util/architecture.vbs
Normal file
@ -0,0 +1,25 @@
|
||||
' Pandora FMS Agent Inventory Plugin for Microsoft Windows (All platfforms)
|
||||
' (c) 2015 Borja Sanchez <fborja.sanchez@artica.es>
|
||||
' This plugin extends agent inventory feature. Only enterprise version
|
||||
' --------------------------------------------------------------------------
|
||||
on error resume next
|
||||
'WMI 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
|
||||
|
||||
Wscript.StdOut.WriteLine "</datalist>"
|
||||
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||
Wscript.StdOut.WriteLine "</inventory>"
|
29
pandora_agents/win32/bin/util/cdromdrives.vbs
Normal file
29
pandora_agents/win32/bin/util/cdromdrives.vbs
Normal file
@ -0,0 +1,29 @@
|
||||
' Pandora FMS Agent Inventory Plugin for Microsoft Windows (All platfforms)
|
||||
' (c) 2015 Borja Sanchez <fborja.sanchez@artica.es>
|
||||
' This plugin extends agent inventory feature. Only enterprise version
|
||||
' --------------------------------------------------------------------------
|
||||
on error resume next
|
||||
'WMI CD_ROM_drives_info
|
||||
|
||||
Wscript.StdOut.WriteLine "<inventory>"
|
||||
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||
Wscript.StdOut.WriteLine "<name>CDROM</name>"
|
||||
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||
Wscript.StdOut.WriteLine "<datalist>"
|
||||
|
||||
strComputer = "."
|
||||
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
|
||||
Set colCDROMDrives = objWMIService.ExecQuery("Select caption,description,drive,deviceid from win32_CDROMDrive")
|
||||
|
||||
For Each cdromd In colCDROMDrives
|
||||
Wscript.StdOut.WriteLine "<data><![CDATA[" & cdromd.caption _
|
||||
& ";" & cdromd.description _
|
||||
& ";" & cdromd.drive _
|
||||
& ";" & cdromd.deviceid _
|
||||
& "]]></data>"
|
||||
Next
|
||||
|
||||
Wscript.StdOut.WriteLine "</datalist>"
|
||||
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||
Wscript.StdOut.WriteLine "</inventory>"
|
||||
|
25
pandora_agents/win32/bin/util/cpuinfo.vbs
Normal file
25
pandora_agents/win32/bin/util/cpuinfo.vbs
Normal file
@ -0,0 +1,25 @@
|
||||
' Pandora FMS Agent Inventory Plugin for Microsoft Windows (All platfforms)
|
||||
' (c) 2015 Borja Sanchez <fborja.sanchez@artica.es>
|
||||
' This plugin extends agent inventory feature. Only enterprise version
|
||||
' --------------------------------------------------------------------------
|
||||
on error resume next
|
||||
'WMI cpuinfo
|
||||
|
||||
Wscript.StdOut.WriteLine "<inventory>"
|
||||
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||
Wscript.StdOut.WriteLine "<name>CPU</name>"
|
||||
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||
Wscript.StdOut.WriteLine "<datalist>"
|
||||
|
||||
strComputer = "."
|
||||
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
|
||||
Set colCPUs = objWMIService.ExecQuery("Select name,maxclockspeed,caption from Win32_Processor")
|
||||
|
||||
For Each cpu In colCPUs
|
||||
Wscript.StdOut.WriteLine "<data><![CDATA[" & cpu.name & ";" & cpu.maxclockspeed & " MHz;" & cpu.caption & "]]></data>"
|
||||
Next
|
||||
|
||||
Wscript.StdOut.WriteLine "</datalist>"
|
||||
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||
Wscript.StdOut.WriteLine "</inventory>"
|
||||
|
34
pandora_agents/win32/bin/util/diskdrives.vbs
Normal file
34
pandora_agents/win32/bin/util/diskdrives.vbs
Normal file
@ -0,0 +1,34 @@
|
||||
' Pandora FMS Agent Inventory Plugin for Microsoft Windows (All platfforms)
|
||||
' (c) 2015 Borja Sanchez <fborja.sanchez@artica.es>
|
||||
' This plugin extends agent inventory feature. Only enterprise version
|
||||
' --------------------------------------------------------------------------
|
||||
on error resume next
|
||||
'WMI disksinfo
|
||||
|
||||
Wscript.StdOut.WriteLine "<inventory>"
|
||||
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||
Wscript.StdOut.WriteLine "<name>HD</name>"
|
||||
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||
Wscript.StdOut.WriteLine "<datalist>"
|
||||
|
||||
strComputer = "."
|
||||
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
|
||||
Set colHDDs = objWMIService.ExecQuery("Select * from win32_diskdrive")
|
||||
|
||||
For Each disco In colHDDs
|
||||
If ((not IsNull(disco.size)) AND (disco.size > 0)) then
|
||||
Wscript.StdOut.Write "<data><![CDATA[" & disco.caption _
|
||||
& ";" & Abs(Round((disco.size/(1024*1024*1024)),2)) & " GB"
|
||||
If (not IsNull(disco.serialnumber)) then
|
||||
Wscript.StdOut.Write ";" & disco.serialnumber
|
||||
Else
|
||||
Wscript.StdOut.Write ";" & disco.signature
|
||||
End If
|
||||
Wscript.StdOut.WriteLine "]]></data>"
|
||||
End If
|
||||
Next
|
||||
|
||||
Wscript.StdOut.WriteLine "</datalist>"
|
||||
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||
Wscript.StdOut.WriteLine "</inventory>"
|
||||
|
25
pandora_agents/win32/bin/util/domain.vbs
Normal file
25
pandora_agents/win32/bin/util/domain.vbs
Normal file
@ -0,0 +1,25 @@
|
||||
' Pandora FMS Agent Inventory Plugin for Microsoft Windows (All platfforms)
|
||||
' (c) 2015 Borja Sanchez <fborja.sanchez@artica.es>
|
||||
' This plugin extends agent inventory feature. Only enterprise version
|
||||
' --------------------------------------------------------------------------
|
||||
on error resume next
|
||||
'WMI 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
|
||||
|
||||
|
||||
Wscript.StdOut.WriteLine "</datalist>"
|
||||
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||
Wscript.StdOut.WriteLine "</inventory>"
|
42
pandora_agents/win32/bin/util/ifaces.vbs
Normal file
42
pandora_agents/win32/bin/util/ifaces.vbs
Normal file
@ -0,0 +1,42 @@
|
||||
' Pandora FMS Agent Inventory Plugin for Microsoft Windows (All platfforms)
|
||||
' (c) 2015 Borja Sanchez <fborja.sanchez@artica.es>
|
||||
' This plugin extends agent inventory feature. Only enterprise version
|
||||
' --------------------------------------------------------------------------
|
||||
on error resume next
|
||||
'WMI real interfaces info
|
||||
' exlusions:
|
||||
' VBox network interfaces
|
||||
' VMWare network interfaces
|
||||
'
|
||||
'nic where "guid is not null and not PNPDeviceID like 'ROOT%'"
|
||||
|
||||
Wscript.StdOut.WriteLine "<inventory>"
|
||||
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||
Wscript.StdOut.WriteLine "<name>NIC</name>"
|
||||
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||
Wscript.StdOut.WriteLine "<datalist>"
|
||||
|
||||
strComputer = "."
|
||||
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
|
||||
Set colAdapters = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter " & _
|
||||
"Where not PNPDeviceID like 'ROOT%%' " & _
|
||||
"and not PNPDeviceID like 'SW%%' " & _
|
||||
"and not ServiceName is null " & _
|
||||
"and not ServiceName like 'vwifimp' ")
|
||||
|
||||
For Each iface In colAdapters
|
||||
' return model MACAddress IPAddress
|
||||
|
||||
set ifaces_cfg = objWMIService.ExecQuery("Select ipaddress from Win32_NetworkAdapterConfiguration Where Caption='" & iface.caption & "'")
|
||||
Wscript.StdOut.Write "<data><![CDATA[" & iface.ProductName & ";" & iface.MACAddress & ";"
|
||||
for each iface_cfg in ifaces_cfg
|
||||
if ( iface_cfg.IPAddress(0) <> "" ) then
|
||||
Wscript.StdOut.Write trim(iface_cfg.IPAddress(0))
|
||||
end if
|
||||
next
|
||||
wscript.stdOut.WriteLine "]]></data>"
|
||||
Next
|
||||
|
||||
Wscript.StdOut.WriteLine "</datalist>"
|
||||
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||
Wscript.StdOut.WriteLine "</inventory>"
|
26
pandora_agents/win32/bin/util/moboinfo.vbs
Normal file
26
pandora_agents/win32/bin/util/moboinfo.vbs
Normal file
@ -0,0 +1,26 @@
|
||||
' Pandora FMS Agent Inventory Plugin for Microsoft Windows (All platfforms)
|
||||
' (c) 2015 Borja Sanchez <fborja.sanchez@artica.es>
|
||||
' This plugin extends agent inventory feature. Only enterprise version
|
||||
' --------------------------------------------------------------------------
|
||||
on error resume next
|
||||
'WMI mobo info
|
||||
|
||||
Wscript.StdOut.WriteLine "<inventory>"
|
||||
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||
Wscript.StdOut.WriteLine "<name>Motherboard</name>"
|
||||
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||
Wscript.StdOut.WriteLine "<datalist>"
|
||||
|
||||
strComputer = "."
|
||||
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
|
||||
'Set colMobos = objWMIService.ExecQuery("Select name,product,manufacturer from Win32_baseboard")
|
||||
Set colMobos2 = objWMIService.ExecQuery("Select manufacturer,model,OEMStringArray from Win32_computersystem")
|
||||
|
||||
For Each mobo In colMobos2
|
||||
Wscript.StdOut.WriteLine "<data><![CDATA[" & mobo.manufacturer & ";" & mobo.model & ";" & mobo.OEMStringArray(0) & "]]></data>"
|
||||
Next
|
||||
|
||||
Wscript.StdOut.WriteLine "</datalist>"
|
||||
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||
Wscript.StdOut.WriteLine "</inventory>"
|
||||
|
29
pandora_agents/win32/bin/util/monitors.vbs
Normal file
29
pandora_agents/win32/bin/util/monitors.vbs
Normal file
@ -0,0 +1,29 @@
|
||||
' Pandora FMS Agent Inventory Plugin for Microsoft Windows (All platfforms)
|
||||
' (c) 2015 Borja Sanchez <fborja.sanchez@artica.es>
|
||||
' This plugin extends agent inventory feature. Only enterprise version
|
||||
' --------------------------------------------------------------------------
|
||||
on error resume next
|
||||
'WMI monitorsinfo
|
||||
|
||||
Wscript.StdOut.WriteLine "<inventory>"
|
||||
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||
Wscript.StdOut.WriteLine "<name>Monitors</name>"
|
||||
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||
Wscript.StdOut.WriteLine "<datalist>"
|
||||
|
||||
strComputer = "."
|
||||
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
|
||||
Set colDisplays = objWMIService.ExecQuery("Select caption,pnpdeviceid from win32_desktopmonitor")
|
||||
|
||||
For Each display In colDisplays
|
||||
if (NOT isNull(display.pnpdeviceid)) then
|
||||
Wscript.StdOut.WriteLine "<data><![CDATA[" & display.caption _
|
||||
& ";" & display.pnpdeviceid _
|
||||
& "]]></data>"
|
||||
end if
|
||||
Next
|
||||
|
||||
Wscript.StdOut.WriteLine "</datalist>"
|
||||
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||
Wscript.StdOut.WriteLine "</inventory>"
|
||||
|
25
pandora_agents/win32/bin/util/osversion.vbs
Normal file
25
pandora_agents/win32/bin/util/osversion.vbs
Normal file
@ -0,0 +1,25 @@
|
||||
' Pandora FMS Agent Inventory Plugin for Microsoft Windows (All platfforms)
|
||||
' (c) 2015 Borja Sanchez <fborja.sanchez@artica.es>
|
||||
' This plugin extends agent inventory feature. Only enterprise version
|
||||
' --------------------------------------------------------------------------
|
||||
on error resume next
|
||||
'WMI 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
|
||||
|
||||
Wscript.StdOut.WriteLine "</datalist>"
|
||||
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||
Wscript.StdOut.WriteLine "</inventory>"
|
59
pandora_agents/win32/bin/util/printers.vbs
Normal file
59
pandora_agents/win32/bin/util/printers.vbs
Normal file
@ -0,0 +1,59 @@
|
||||
' Pandora FMS Agent Inventory Plugin for Microsoft Windows (All platfforms)
|
||||
' (c) 2015 Borja Sanchez <fborja.sanchez@artica.es>
|
||||
' This plugin extends agent inventory feature. Only enterprise version
|
||||
' --------------------------------------------------------------------------
|
||||
On Error Resume Next
|
||||
|
||||
'WMI printers attached
|
||||
|
||||
Wscript.StdOut.WriteLine "<inventory>"
|
||||
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||
Wscript.StdOut.WriteLine "<name>Printers</name>"
|
||||
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||
Wscript.StdOut.WriteLine "<datalist>"
|
||||
|
||||
function validPort(port)
|
||||
if strComp(port,"SHRFAX:") = 0 then
|
||||
validPort = false
|
||||
elseif strComp(port,"nul:") = 0 then
|
||||
validPort = false
|
||||
elseif strComp(port,"PORTPROMPT:") = 0 then
|
||||
validPort = false
|
||||
elseif strComp(port,"XPSPort:") = 0 then
|
||||
validPort = false
|
||||
elseif strComp(port,"PDF:") = 0 then
|
||||
validPort = false
|
||||
else
|
||||
validPort = true
|
||||
end if
|
||||
end function
|
||||
|
||||
Set oWMI = GetObject("winmgmts:\\" & "." & "\root\cimv2")
|
||||
Set colPrinters = oWMI.ExecQuery("Select * from Win32_Printer",,48)
|
||||
|
||||
For Each objPrinter in colPrinters
|
||||
if validPort (objPrinter.PortName) then
|
||||
set tcp_port_exists = 0
|
||||
WScript.stdOut.Write "<data><![CDATA[" & _
|
||||
objPrinter.DeviceID & ";" & _
|
||||
objPrinter.DriverName & ";"
|
||||
If (objPrinter.Local) Then
|
||||
Set colPorts = oWMI.ExecQuery("Select HostAddress from Win32_TCPIPPrinterPort where Name like '" & objPrinter.PortName & "'",,48)
|
||||
For Each objPort in colPorts
|
||||
tcp_port_exists = 1
|
||||
Wscript.stdOut.Write objPort.HostAddress
|
||||
Next
|
||||
If (tcp_port_exists = 0) Then
|
||||
Wscript.stdOut.Write objPrinter.PortName
|
||||
End If
|
||||
Else
|
||||
Wscript.stdOut.Write objPrinter.ServerName
|
||||
End If
|
||||
wscript.stdOut.WriteLine "]]></data>"
|
||||
end if
|
||||
Next
|
||||
|
||||
|
||||
Wscript.StdOut.WriteLine "</datalist>"
|
||||
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||
Wscript.StdOut.WriteLine "</inventory>"
|
24
pandora_agents/win32/bin/util/productID.vbs
Normal file
24
pandora_agents/win32/bin/util/productID.vbs
Normal file
@ -0,0 +1,24 @@
|
||||
' windows_product_key.vbs
|
||||
' Pandora FMS Agent Inventory Plugin for Microsoft Windows (All platfforms)
|
||||
' (c) 2015 Sancho Lerena <slerena@artica.es>
|
||||
' This plugin extends agent inventory feature. Only enterprise version
|
||||
' ----------------------------------------------------------------
|
||||
on error resume next
|
||||
|
||||
Wscript.StdOut.WriteLine "<inventory>"
|
||||
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||
Wscript.StdOut.WriteLine "<name>product_ID</name>"
|
||||
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||
Wscript.StdOut.WriteLine "<datalist>"
|
||||
|
||||
Set oShell = WScript.CreateObject ("WScript.Shell")
|
||||
Set objExec = oShell.Exec("cmd.exe /C wmic os get ""SerialNumber"" | find /v ""SerialNumber"" ")
|
||||
Do
|
||||
line = objExec.StdOut.ReadLine()
|
||||
s = s & line
|
||||
Loop While Not objExec.Stdout.atEndOfStream
|
||||
|
||||
Wscript.StdOut.WriteLine "<data><![CDATA[" & Replace(Replace(s, chr(013), ""), chr(010), "") & "]]></data>"
|
||||
Wscript.StdOut.WriteLine "</datalist>"
|
||||
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||
Wscript.StdOut.WriteLine "</inventory>"
|
25
pandora_agents/win32/bin/util/productkey.vbs
Normal file
25
pandora_agents/win32/bin/util/productkey.vbs
Normal file
@ -0,0 +1,25 @@
|
||||
' windows_product_key.vbs
|
||||
' Pandora FMS Agent Inventory Plugin for Microsoft Windows (All platfforms)
|
||||
' (c) 2015 Sancho Lerena <slerena@artica.es>
|
||||
' This plugin extends agent inventory feature. Only enterprise version
|
||||
' ----------------------------------------------------------------
|
||||
|
||||
on error resume next
|
||||
|
||||
Wscript.StdOut.WriteLine "<inventory>"
|
||||
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||
Wscript.StdOut.WriteLine "<name>product_key</name>"
|
||||
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||
Wscript.StdOut.WriteLine "<datalist>"
|
||||
|
||||
strComputer = "."
|
||||
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
|
||||
Set colProducts = objWMIService.ExecQuery("Select OA3xOriginalProductKey from SoftwareLicensingService")
|
||||
|
||||
For Each product In colProducts
|
||||
Wscript.StdOut.WriteLine "<data><![CDATA[" & product.OA3xOriginalProductKey & "]]></data>"
|
||||
Next
|
||||
|
||||
Wscript.StdOut.WriteLine "</datalist>"
|
||||
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||
Wscript.StdOut.WriteLine "</inventory>"
|
28
pandora_agents/win32/bin/util/raminfo.vbs
Normal file
28
pandora_agents/win32/bin/util/raminfo.vbs
Normal file
@ -0,0 +1,28 @@
|
||||
' Pandora FMS Agent Inventory Plugin for Microsoft Windows (All platfforms)
|
||||
' (c) 2015 Borja Sanchez <fborja.sanchez@artica.es>
|
||||
' This plugin extends agent inventory feature. Only enterprise version
|
||||
' --------------------------------------------------------------------------
|
||||
on error resume next
|
||||
'WMI raminfo
|
||||
|
||||
Wscript.StdOut.WriteLine "<inventory>"
|
||||
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||
Wscript.StdOut.WriteLine "<name>RAM</name>"
|
||||
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||
Wscript.StdOut.WriteLine "<datalist>"
|
||||
|
||||
strComputer = "."
|
||||
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
|
||||
Set colRAMs = objWMIService.ExecQuery("Select deviceLocator,capacity,speed from Win32_PhysicalMemory")
|
||||
|
||||
For Each ram In colRAMs
|
||||
Wscript.StdOut.WriteLine "<data><![CDATA[" & ram.deviceLocator _
|
||||
& ";" & Abs(Round((ram.capacity/(1024*1024)),2)) & " MB" _
|
||||
& ";" & ram.speed & " MHz"_
|
||||
& "]]></data>"
|
||||
Next
|
||||
|
||||
Wscript.StdOut.WriteLine "</datalist>"
|
||||
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||
Wscript.StdOut.WriteLine "</inventory>"
|
||||
|
@ -1,72 +1,141 @@
|
||||
' software_inventory.vbs
|
||||
' Pandora FMS Agent Inventory Plugin for Microsoft Windows (All platfforms)
|
||||
' (c) 2014 Sancho Lerena <slerena@artica.es>
|
||||
' (c) 2015 Sancho Lerena <slerena@artica.es>
|
||||
' (c) 2015 Borja Sanchez <fborja.sanchez@artica.es>
|
||||
' This plugin extends agent inventory feature. Only enterprise version
|
||||
' ----------------------------------------------------------------
|
||||
' usage: cscript //B software_inventory.vbs
|
||||
' --------------------------------------------------------------------------
|
||||
on error resume next
|
||||
|
||||
Class ObjectList
|
||||
Public List
|
||||
|
||||
Sub Class_Initialize()
|
||||
Set List = CreateObject("Scripting.Dictionary")
|
||||
End Sub
|
||||
|
||||
Sub Class_Terminate()
|
||||
Set List = Nothing
|
||||
End Sub
|
||||
|
||||
Function Append(Anything)
|
||||
List.Add CStr(List.Count + 1), Anything
|
||||
Set Append = Anything
|
||||
End Function
|
||||
|
||||
Function Item(id)
|
||||
If List.Exists(CStr(id)) Then
|
||||
Set Item = List(CStr(id))
|
||||
Else
|
||||
Set Item = Nothing
|
||||
End If
|
||||
End Function
|
||||
End Class
|
||||
|
||||
class AppClass
|
||||
dim InstallDate,Caption,Version,Vendor
|
||||
end class
|
||||
|
||||
' Print the XML structure
|
||||
Wscript.StdOut.WriteLine "<inventory>"
|
||||
Wscript.StdOut.WriteLine"<inventory_module>"
|
||||
Wscript.StdOut.WriteLine "<name>software</name>"
|
||||
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||
Wscript.StdOut.WriteLine "<name>Software</name>"
|
||||
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||
Wscript.StdOut.WriteLine "<datalist>"
|
||||
|
||||
'------ Checks if an item exists on the main collection
|
||||
function isItemInArray(objeto,coleccion)
|
||||
for each id in coleccion.List
|
||||
if (strComp(objeto,coleccion.List(id).caption) = 0) then
|
||||
isItemInArray=true
|
||||
exit function
|
||||
end if
|
||||
next
|
||||
isItemInArray=false
|
||||
end function
|
||||
|
||||
'------ main collection definition
|
||||
dim colObjSW : set colObjSW = new ObjectList
|
||||
strComputer = "."
|
||||
|
||||
'------ Retrieve the WMI registers first
|
||||
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
|
||||
Set colSoftware = objWMIService.ExecQuery ("SELECT installstate,caption,installdate,Version,vendor FROM Win32_Product")
|
||||
|
||||
|
||||
'------ Check all
|
||||
'-- first) add all unique WMI (unique) entries to main collector
|
||||
'-- second) add all unique REGISTRY items to main collector
|
||||
|
||||
for each objSoftware in colSoftware
|
||||
if ( objSoftware.installstate = 5 ) then
|
||||
if ( isItemInArray(objSoftware.caption, colObjSW) = false ) then
|
||||
' It doesn't exists, added.
|
||||
With colObjSW.Append(New AppClass)
|
||||
.caption = objSoftware.caption
|
||||
.InstallDate = objSoftware.InstallDate
|
||||
.version = objSoftware.version
|
||||
.vendor = objSoftware.vendor
|
||||
End with
|
||||
' Add to XML the verified ones
|
||||
Wscript.StdOut.WriteLine "<data><![CDATA[" _
|
||||
& objSoftware.caption & ";" _
|
||||
& objSoftware.version _
|
||||
& "]]></data>"
|
||||
end if
|
||||
end if
|
||||
next
|
||||
|
||||
' ------ Getting the REGISTRY
|
||||
Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE
|
||||
strComputer = "."
|
||||
|
||||
strKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
|
||||
strEntry1a = "DisplayName"
|
||||
strEntry1b = "QuietDisplayName"
|
||||
strEntry2 = "InstallDate"
|
||||
strEntry3 = "VersionMajor"
|
||||
strEntry4 = "VersionMinor"
|
||||
strEntry5 = "EstimatedSize"
|
||||
strEntry3 = "DisplayVersion"
|
||||
|
||||
Set objReg = GetObject("winmgmts://" & strComputer & _
|
||||
"/root/default:StdRegProv")
|
||||
Set objReg = GetObject("winmgmts://" & strComputer & "/root/default:StdRegProv")
|
||||
objReg.EnumKey HKLM, strKey, arrSubkeys
|
||||
|
||||
For Each strSubkey In arrSubkeys
|
||||
|
||||
appname = ""
|
||||
appsize = ""
|
||||
appversion = ""
|
||||
appdate = ""
|
||||
|
||||
intRet1 = objReg.GetStringValue(HKLM, strKey & strSubkey, _
|
||||
strEntry1a, strValue1)
|
||||
intRet1 = objReg.GetStringValue(HKLM, strKey & strSubkey, strEntry1a, strValue1)
|
||||
If intRet1 <> 0 Then
|
||||
objReg.GetStringValue HKLM, strKey & strSubkey, _
|
||||
strEntry1b, strValue1
|
||||
objReg.GetStringValue HKLM, strKey & strSubkey, strEntry1b, strValue1
|
||||
End If
|
||||
If strValue1 <> "" Then
|
||||
appname = strValue1
|
||||
End If
|
||||
objReg.GetStringValue HKLM, strKey & strSubkey, _
|
||||
strEntry2, strValue2
|
||||
objReg.GetStringValue HKLM, strKey & strSubkey, strEntry2, strValue2
|
||||
If strValue2 <> "" Then
|
||||
appdate = strValue2
|
||||
End If
|
||||
objReg.GetDWORDValue HKLM, strKey & strSubkey, _
|
||||
strEntry3, intValue3
|
||||
objReg.GetDWORDValue HKLM, strKey & strSubkey, _
|
||||
strEntry4, intValue4
|
||||
|
||||
objReg.GetStringValue HKLM, strKey & strSubkey, strEntry3, intValue3
|
||||
If intValue3 <> "" Then
|
||||
appversion = intValue3 & "." & intValue4
|
||||
appversion = intValue3
|
||||
End If
|
||||
objReg.GetDWORDValue HKLM, strKey & strSubkey, _
|
||||
strEntry5, intValue5
|
||||
If intValue5 <> "" Then
|
||||
appsize = Round(intValue5/1024, 3) & " megabytes"
|
||||
End If
|
||||
|
||||
If appname <> "" Then
|
||||
Wscript.StdOut.WriteLine "<data>" & appname & ";" & appversion & ";" & appdate & ";" & appsize & "</data>"
|
||||
' foreach registry item, check if exists in the main collector
|
||||
' it it exists, it doesn't be added.
|
||||
if ( isItemInArray(appname, colObjSW) = false ) then
|
||||
' as item doesn't exist, we add it to main collector and to XML
|
||||
With colObjSW.Append(New AppClass)
|
||||
.caption = appname
|
||||
.version = appversion
|
||||
End with
|
||||
Wscript.StdOut.WriteLine "<data><![CDATA[" & appname & ";" & appversion & "]]></data>"
|
||||
end if
|
||||
end if
|
||||
|
||||
Next
|
||||
next
|
||||
|
||||
' Closing the XML structure
|
||||
Wscript.StdOut.WriteLine "</datalist>"
|
||||
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||
Wscript.StdOut.WriteLine "</inventory>"
|
||||
|
||||
|
||||
|
74
pandora_agents/win32/bin/util/userslogged.vbs
Normal file
74
pandora_agents/win32/bin/util/userslogged.vbs
Normal file
@ -0,0 +1,74 @@
|
||||
' Pandora FMS Agent Inventory Plugin for Microsoft Windows (All platfforms)
|
||||
' (c) 2015 Borja Sanchez <fborja.sanchez@artica.es>
|
||||
' This plugin extends agent inventory feature. Only enterprise version
|
||||
' --------------------------------------------------------------------------
|
||||
on error resume next
|
||||
' Lista todos los usuarios del equipo que han iniciado procesos
|
||||
|
||||
dim loggedUsers(),i
|
||||
i=0
|
||||
Sub insertIfNotExists(sDomain,sUser)
|
||||
For Each lUser in loggedUsers
|
||||
If StrComp(sDomain & "\" & sUser, lUser) = 0 Then
|
||||
Exit Sub
|
||||
End If
|
||||
Next
|
||||
redim preserve loggedUsers(i)
|
||||
i=i+1
|
||||
loggedUsers (i-1)=sDomain & "\" & sUser
|
||||
End Sub
|
||||
|
||||
Function CheckRealUser(sHost, sUser, sDomain)
|
||||
Dim oWMI,realUsers
|
||||
Set oWmi = GetObject("winmgmts:{impersonationLevel=impersonate,(debug)}!\\" _
|
||||
& sHost & "\root\cimv2")
|
||||
Set realUsers = oWmi.ExecQuery("SELECT * FROM Win32_UserAccount WHERE Domain='" & sDomain & "' OR Name='" & sUser & "'")
|
||||
If (realUsers.count=0) Then
|
||||
CheckRealUser = False
|
||||
Else
|
||||
CheckRealUser = True
|
||||
End If
|
||||
|
||||
End Function
|
||||
|
||||
Function ConsoleUser(sHost)
|
||||
Dim oWMI, colProc, oProcess, strUser, strDomain
|
||||
Set oWmi = GetObject("winmgmts:" _
|
||||
& "{impersonationLevel=impersonate,(debug)}!\\" _
|
||||
& sHost & "\root\cimv2")
|
||||
|
||||
Set colProc = oWmi.ExecQuery("Select sessionID from Win32_Process")
|
||||
|
||||
ConsoleUser = ""
|
||||
For Each oProcess In colProc
|
||||
lRet = oProcess.getOwner(strOwner, strDomain)
|
||||
If (lRet = 0) AND (CheckRealUser(sHost,strOwner,strDomain)) Then
|
||||
insertIfNotExists strDomain,strOwner
|
||||
ConsoleUser = sUser
|
||||
End If
|
||||
Next
|
||||
End Function
|
||||
|
||||
' MAIN
|
||||
|
||||
sUser = ConsoleUser(".") ' use "." for local computer
|
||||
|
||||
Wscript.StdOut.WriteLine "<inventory>"
|
||||
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||
Wscript.StdOut.WriteLine "<name>Users</name>"
|
||||
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||
Wscript.StdOut.WriteLine "<datalist>"
|
||||
|
||||
|
||||
For Each usuario in loggedUsers
|
||||
Wscript.StdOut.WriteLine "<data><![CDATA[" & split(usuario,"\")(0) _
|
||||
& ";" & split(usuario,"\")(1) _
|
||||
& "]]></data>"
|
||||
next
|
||||
|
||||
|
||||
Wscript.StdOut.WriteLine "</datalist>"
|
||||
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||
Wscript.StdOut.WriteLine "</inventory>"
|
||||
|
||||
|
28
pandora_agents/win32/bin/util/videocardinfo.vbs
Normal file
28
pandora_agents/win32/bin/util/videocardinfo.vbs
Normal file
@ -0,0 +1,28 @@
|
||||
' Pandora FMS Agent Inventory Plugin for Microsoft Windows (All platfforms)
|
||||
' (c) 2015 Borja Sanchez <fborja.sanchez@artica.es>
|
||||
' This plugin extends agent inventory feature. Only enterprise version
|
||||
' --------------------------------------------------------------------------
|
||||
on error resume next
|
||||
'WMI video_card_info
|
||||
|
||||
Wscript.StdOut.WriteLine "<inventory>"
|
||||
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||
Wscript.StdOut.WriteLine "<name>Video</name>"
|
||||
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||
Wscript.StdOut.WriteLine "<datalist>"
|
||||
|
||||
strComputer = "."
|
||||
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
|
||||
Set colVideoCards = objWMIService.ExecQuery("Select caption,AdapterRAM,PNPDeviceID from win32_videocontroller")
|
||||
|
||||
For Each vcard In colVideoCards
|
||||
Wscript.StdOut.WriteLine "<data><![CDATA[" & vcard.caption _
|
||||
& ";" & Round(Abs(vcard.AdapterRAM/(1024*1024)),2) & " MB" _
|
||||
& ";" & vcard.PNPDeviceID _
|
||||
& "]]></data>"
|
||||
Next
|
||||
|
||||
Wscript.StdOut.WriteLine "</datalist>"
|
||||
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||
Wscript.StdOut.WriteLine "</inventory>"
|
||||
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
||||
{}
|
||||
|
||||
Version
|
||||
{150329}
|
||||
{150514}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
@ -257,7 +257,7 @@ Pandora_Module_Logevent::getLogEvents (list<string> &event_list, unsigned char d
|
||||
TCHAR lp_referenced_domain_name[_MAX_PATH + 1];
|
||||
DWORD cch_referenced_domain_name = _MAX_PATH + 1;
|
||||
SID_NAME_USE pe_use;
|
||||
string description;
|
||||
string description, output;
|
||||
|
||||
if (this->log_event == NULL) {
|
||||
return -1;
|
||||
@ -392,9 +392,19 @@ Pandora_Module_Logevent::getLogEvents (list<string> &event_list, unsigned char d
|
||||
event << "]";
|
||||
}
|
||||
|
||||
|
||||
// Remove carriage returns and new lines in between the description.
|
||||
output = "";
|
||||
for (size_t i = 0; i < description.size(); i++) {
|
||||
if (description[i] != '\n' && description[i] != '\r') {
|
||||
output += description[i];
|
||||
}
|
||||
}
|
||||
output += '\n';
|
||||
|
||||
// Print the event description
|
||||
event << " ";
|
||||
event << description;
|
||||
event << output;
|
||||
|
||||
// Add the event to the list
|
||||
event_list.push_back (event.str());
|
||||
@ -498,7 +508,7 @@ Pandora_Module_Logevent::getEventDescription (PEVENTLOGRECORD pevlr, char *messa
|
||||
exe_file_path_end = ((char *) exe_file_path) + _MAX_PATH * sizeof (TCHAR);
|
||||
|
||||
while (1) {
|
||||
// Load the DLL
|
||||
// Load the DLL
|
||||
module = LoadLibraryEx (dll_start, 0, flags);
|
||||
if(module == NULL) {
|
||||
pandoraDebug("LoadLibraryEx error %d. Exe file path %s.", GetLastError(), exe_file_path);
|
||||
@ -562,7 +572,7 @@ Pandora_Module_Logevent::getEventDescriptionXPATH (PEVENTLOGRECORD pevlr) {
|
||||
}
|
||||
|
||||
// Build the XPATH query
|
||||
query = "Event/System[EventID=" + inttostr(pevlr->EventID & EVENT_ID_MASK) + "]";
|
||||
query = "Event/System[EventRecordID=" + inttostr(pevlr->RecordNumber) + "]";
|
||||
pwsQuery = strAnsiToUnicode (query.c_str());
|
||||
pwsPath = strAnsiToUnicode (this->source.c_str());
|
||||
|
||||
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
||||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("5.1SP2(Build 150329)")
|
||||
#define PANDORA_VERSION ("5.1SP2(Build 150514)")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
@ -11,7 +11,7 @@ BEGIN
|
||||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(5.1SP2(Build 150329))"
|
||||
VALUE "ProductVersion", "(5.1SP2(Build 150514))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-console
|
||||
Version: 5.1SP2-150329
|
||||
Version: 5.1SP2-150514
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="5.1SP2-150329"
|
||||
pandora_version="5.1SP2-150514"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
@ -138,7 +138,7 @@ function mainAgentsModules() {
|
||||
}
|
||||
$count++;
|
||||
}
|
||||
|
||||
$total_pagination = count($agents);
|
||||
$all_modules = agents_get_modules($agents, false, $filter_module_group, true, false);
|
||||
|
||||
$modules_by_name = array();
|
||||
@ -242,13 +242,12 @@ function mainAgentsModules() {
|
||||
|
||||
echo "</tr>";
|
||||
|
||||
$filter_agents = array('offset' => (int) $offset,
|
||||
'limit' => (int) $config['block_size'], 'disabled' => 0);
|
||||
$filter_agents = array('offset' => (int) $offset, 'disabled' => 0);
|
||||
if ($group_id > 0) {
|
||||
$filter_agents['id_grupo'] = $group_id;
|
||||
}
|
||||
// Prepare pagination
|
||||
ui_pagination ((int)count(agents_get_agents ($filter_agents)));
|
||||
ui_pagination ($total_pagination);
|
||||
|
||||
foreach ($agents as $agent) {
|
||||
// Get stats for this group
|
||||
@ -298,20 +297,28 @@ function mainAgentsModules() {
|
||||
echo "<td style='text-align: center;'>";
|
||||
$win_handle = dechex(crc32($module_id.$module["name"]));
|
||||
$graph_type = return_graphtype (modules_get_agentmodule_type($module_id));
|
||||
$link ="winopeng('operation/agentes/stat_win.php?type=$graph_type&period=86400&id=".$module_id."&label=".rawurlencode(urlencode(base64_encode($module["name"])))."&refresh=600','day_".$win_handle."')";
|
||||
$link ="winopeng('" .
|
||||
"operation/agentes/stat_win.php?" .
|
||||
"type=$graph_type&" .
|
||||
"period=" . SECONDS_1DAY . "&" .
|
||||
"id=" . $module_id . "&" .
|
||||
"label=" . rawurlencode(
|
||||
urlencode(
|
||||
base64_encode($module["name"]))) . "&" .
|
||||
"refresh=" . SECONDS_10MINUTES . "', 'day_".$win_handle."')";
|
||||
|
||||
echo '<a href="javascript:'.$link.'">';
|
||||
switch ($status) {
|
||||
case 0:
|
||||
case AGENT_MODULE_STATUS_NORMAL:
|
||||
ui_print_status_image ('module_ok.png', modules_get_last_value($module_id), false, array('width' => '20px', 'height' => '20px'));
|
||||
break;
|
||||
case 1:
|
||||
case AGENT_MODULE_STATUS_CRITICAL_BAD:
|
||||
ui_print_status_image ('module_critical.png', modules_get_last_value($module_id), false, array('width' => '20px', 'height' => '20px'));
|
||||
break;
|
||||
case 2:
|
||||
case AGENT_MODULE_STATUS_WARNING:
|
||||
ui_print_status_image ('module_warning.png', modules_get_last_value($module_id), false, array('width' => '20px', 'height' => '20px'));
|
||||
break;
|
||||
case 3:
|
||||
case AGENT_MODULE_STATUS_UNKNOWN:
|
||||
ui_print_status_image ('module_unknown.png', modules_get_last_value($module_id), false, array('width' => '20px', 'height' => '20px'));
|
||||
break;
|
||||
case 4:
|
||||
|
@ -247,23 +247,23 @@ function mainModuleGroups() {
|
||||
else {
|
||||
|
||||
if ($fired) {
|
||||
$color = '#ffa300'; //Orange when the cell for this model group and agent has at least one alert fired.
|
||||
$color = '#FFA631'; //Orange when the cell for this model group and agent has at least one alert fired.
|
||||
}
|
||||
else if (array_key_exists(1, $states)) {
|
||||
$color = '#cc0000'; //Red when the cell for this model group and agent has at least one module in critical state and the rest in any state.
|
||||
$color = '#FC4444'; //Red when the cell for this model group and agent has at least one module in critical state and the rest in any state.
|
||||
$font_color = '#ffffff';
|
||||
}
|
||||
elseif (array_key_exists(2, $states)) {
|
||||
$color = '#fce94f'; //Yellow when the cell for this model group and agent has at least one in warning state and the rest in green state.
|
||||
$color = '#FAD403'; //Yellow when the cell for this model group and agent has at least one in warning state and the rest in green state.
|
||||
}
|
||||
elseif (array_key_exists(3, $states)) {
|
||||
$color = '#babdb6'; //Grey when the cell for this model group and agent has at least one module in unknown state and the rest in any state.
|
||||
$color = '#B2B2B2'; //Grey when the cell for this model group and agent has at least one module in unknown state and the rest in any state.
|
||||
}
|
||||
elseif (array_key_exists(0, $states)) {
|
||||
$color = '#8ae234'; //Green when the cell for this model group and agent has OK state all modules.
|
||||
$color = '#80BA27'; //Green when the cell for this model group and agent has OK state all modules.
|
||||
}
|
||||
elseif (array_key_exists(5, $states)) {
|
||||
$color = '#729fcf'; // Blue when the cell for this module group and all modules have not init value.
|
||||
$color = '#5BB6E5'; // Blue when the cell for this module group and all modules have not init value.
|
||||
}
|
||||
|
||||
|
||||
|
@ -20,24 +20,43 @@ $graph = $_POST['graph'];
|
||||
$graph_title = $_POST['graph_title'];
|
||||
$refresh = $_POST['refresh'];
|
||||
|
||||
$os = strtolower(PHP_OS);
|
||||
if (substr($os, 0, 3) === 'win') {
|
||||
$os = 'windows';
|
||||
}
|
||||
switch($graph) {
|
||||
case 'cpu_load':
|
||||
$data = exec("top -bn 2 -d 0.01 | grep '^Cpu' | tail -n 1 | awk '{ print $2+$4+$6 }'");
|
||||
if ( $os == 'windows')
|
||||
$data = exec('wmic cpu get loadpercentage|find /I /V "Loadpercentage" | findstr /r "[0-9]" ');
|
||||
else
|
||||
$data = exec("top -bn 2 -d 0.01 | grep '^Cpu' | tail -n 1 | awk '{ print $2+$4+$6 }'");
|
||||
break;
|
||||
case 'pending_packets':
|
||||
$data = exec("ls /var/spool/pandora/data_in/*.data | wc -l");
|
||||
break;
|
||||
case 'disk_io_wait':
|
||||
$data = exec("vmstat 1 3 | tail -1 | awk '{ print $16 }'");
|
||||
if ( $os == 'windows')
|
||||
$data = exec("vmstat 1 3 | tail -1 | awk '{ print $16 }'");
|
||||
else
|
||||
$data = exec("vmstat 1 3 | tail -1 | awk '{ print $16 }'");
|
||||
break;
|
||||
case 'mysql_load':
|
||||
$data = exec("ps aux | grep mysqld | grep -v safe | grep -v grep | awk '{ print $3 }'");
|
||||
if ( $os == 'windows')
|
||||
$data = exec('(FOR /F "skip=2 tokens=2 delims=\," %P IN (\'typeperf "\\Process(mysqld)\\% processor time" -sc 1\') DO @echo %P)|find /V /I "..."');
|
||||
else
|
||||
$data = exec("ps aux | grep mysqld | grep -v safe | grep -v grep | awk '{ print $3 }'");
|
||||
break;
|
||||
case 'apache_load':
|
||||
$data = exec("ps aux | grep apache2 | grep -v safe | grep -v grep | awk '{ sum+=$3 } END { print sum }'");
|
||||
if ( $os == 'windows')
|
||||
$data = exec('(FOR /F "skip=2 tokens=2 delims=\," %P IN (\'typeperf "\\Process(httpd)\\% processor time" -sc 1\') DO @echo %P)|find /V /I "..."');
|
||||
else
|
||||
$data = exec("ps aux | grep apache2 | grep -v safe | grep -v grep | awk '{ sum+=$3 } END { print sum }'");
|
||||
break;
|
||||
case 'server_load':
|
||||
$data = exec("ps aux | grep pandora_server | grep -v grep | awk '{ print $3 }'");
|
||||
if ( $os == 'windows')
|
||||
$data = exec('(FOR /F "skip=2 tokens=2 delims=\," %P IN (\'typeperf "\\Process(pandora_server)\\% processor time" -sc 1\') DO @echo %P)|find /V /I "..."');
|
||||
else
|
||||
$data = exec("ps aux | grep pandora_server | grep -v grep | awk '{ print $3 }'");
|
||||
break;
|
||||
case 'snmp_interface':
|
||||
$snmp_address = $_POST['snmp_address'];
|
||||
|
@ -176,7 +176,6 @@ function clearGraph() {
|
||||
if (data.length == 0) {
|
||||
return;
|
||||
}
|
||||
console.log(data);
|
||||
|
||||
for(i = 0; i < data[0].data.length; i ++) {
|
||||
data[0].data[i][1] = 0;
|
||||
|
@ -550,11 +550,7 @@ function mainSystemInfo() {
|
||||
function generate_info () {
|
||||
$("#submit-generate").hide();
|
||||
$("#spinner_img").show();
|
||||
|
||||
console.log($("#checkbox-pandora_diag").prop('checked'));
|
||||
console.log($("#checkbox-system_info").prop('checked'));
|
||||
console.log($("#checkbox-log_info").prop('checked'));
|
||||
|
||||
|
||||
$.ajax({
|
||||
url: 'ajax.php',
|
||||
type: 'POST',
|
||||
|
@ -45,8 +45,9 @@ config_check();
|
||||
}
|
||||
$logo_title = 'Pandora FMS Enterprise';
|
||||
}
|
||||
|
||||
echo html_print_image($custom_logo, true, array("alt" => $logo_title, "border" => '0'));
|
||||
|
||||
echo html_print_image($custom_logo, true,
|
||||
array("alt" => $logo_title, "border" => '0'));
|
||||
?>
|
||||
</a>
|
||||
</td>
|
||||
|
@ -268,7 +268,8 @@ $table->data[6][1] = html_print_select (servers_get_names (),
|
||||
|
||||
// Description
|
||||
$table->data[7][0] = __('Description');
|
||||
$table->data[7][1] = html_print_input_text ('comentarios', $comentarios, '', 45, 255, true);
|
||||
$table->data[7][1] = html_print_input_text ('comentarios', $comentarios,
|
||||
'', 45, 255, true);
|
||||
|
||||
html_print_table ($table);
|
||||
unset($table);
|
||||
@ -376,10 +377,12 @@ if ($config['activate_gis']) {
|
||||
}
|
||||
|
||||
$table->data[6][0] = __('Url address');
|
||||
$table->data[6][1] = html_print_input_text ('url_description', $url_description, '', 45, 255, true);
|
||||
$table->data[6][1] = html_print_input_text ('url_description',
|
||||
$url_description, '', 45, 255, true);
|
||||
|
||||
$table->data[7][0] = __('Quiet');
|
||||
$table->data[7][0] .= ui_print_help_tip(__('The agent still runs but the alerts and events will be stop'), true);
|
||||
$table->data[7][0] .= ui_print_help_tip(
|
||||
__('The agent still runs but the alerts and events will be stop'), true);
|
||||
$table->data[7][1] = html_print_checkbox('quiet', 1, $quiet, true);
|
||||
|
||||
ui_toggle(html_print_table ($table, true), __('Advanced options'));
|
||||
@ -401,13 +404,16 @@ foreach ($fields as $field) {
|
||||
|
||||
$data[0] = '<b>'.$field['name'].'</b>';
|
||||
|
||||
$custom_value = db_get_value_filter('description', 'tagent_custom_data', array('id_field' => $field['id_field'], 'id_agent' => $id_agente));
|
||||
$custom_value = db_get_value_filter('description',
|
||||
'tagent_custom_data',
|
||||
array('id_field' => $field['id_field'], 'id_agent' => $id_agente));
|
||||
|
||||
if ($custom_value === false) {
|
||||
$custom_value = '';
|
||||
}
|
||||
|
||||
$data[1] = html_print_textarea ('customvalue_'.$field['id_field'], 2, 65, $custom_value, 'style="min-height: 30px;"', true);
|
||||
$data[1] = html_print_textarea ('customvalue_'.$field['id_field'],
|
||||
2, 65, $custom_value, 'style="min-height: 30px;"', true);
|
||||
|
||||
array_push ($table->data, $data);
|
||||
}
|
||||
@ -433,12 +439,14 @@ echo "</span>";
|
||||
|
||||
if ($id_agente) {
|
||||
|
||||
html_print_submit_button (__('Update'), 'updbutton', false, 'class="sub upd"');
|
||||
html_print_submit_button (__('Update'), 'updbutton', false,
|
||||
'class="sub upd"');
|
||||
html_print_input_hidden ('update_agent', 1);
|
||||
html_print_input_hidden ('id_agente', $id_agente);
|
||||
}
|
||||
else {
|
||||
html_print_submit_button (__('Create'), 'crtbutton', false, 'class="sub wand"');
|
||||
html_print_submit_button (__('Create'), 'crtbutton', false,
|
||||
'class="sub wand"');
|
||||
html_print_input_hidden ('create_agent', 1);
|
||||
}
|
||||
echo '</div></form>';
|
||||
@ -448,54 +456,64 @@ ui_require_jquery_file ('ajaxqueue');
|
||||
ui_require_jquery_file ('bgiframe');
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
|
||||
//Use this function for change 3 icons when change the selectbox
|
||||
function changeIcons() {
|
||||
icon = $("#icon_path :selected").val();
|
||||
/* <![CDATA[ */
|
||||
|
||||
$("#icon_without_status").attr("src", "images/spinner.png");
|
||||
$("#icon_default").attr("src", "images/spinner.png");
|
||||
$("#icon_ok").attr("src", "images/spinner.png");
|
||||
$("#icon_bad").attr("src", "images/spinner.png");
|
||||
$("#icon_warning").attr("src", "images/spinner.png");
|
||||
|
||||
if (icon.length == 0) {
|
||||
$("#icon_without_status").attr("style", "display:none;");
|
||||
$("#icon_default").attr("style", "display:none;");
|
||||
$("#icon_ok").attr("style", "display:none;");
|
||||
$("#icon_bad").attr("style", "display:none;");
|
||||
$("#icon_warning").attr("style", "display:none;");
|
||||
}
|
||||
else {
|
||||
$("#icon_without_status").attr("src", "<?php echo $path; ?>" + icon + ".default.png");
|
||||
$("#icon_default").attr("src", "<?php echo $path; ?>" + icon + ".default.png");
|
||||
$("#icon_ok").attr("src", "<?php echo $path; ?>" + icon + ".ok.png");
|
||||
$("#icon_bad").attr("src", "<?php echo $path; ?>" + icon + ".bad.png");
|
||||
$("#icon_warning").attr("src", "<?php echo $path; ?>" + icon + ".warning.png");
|
||||
$("#icon_without_status").attr("style", "");
|
||||
$("#icon_default").attr("style", "");
|
||||
$("#icon_ok").attr("style", "");
|
||||
$("#icon_bad").attr("style", "");
|
||||
$("#icon_warning").attr("style", "");
|
||||
//Use this function for change 3 icons when change the selectbox
|
||||
function changeIcons() {
|
||||
icon = $("#icon_path :selected").val();
|
||||
|
||||
$("#icon_without_status").attr("src", "images/spinner.png");
|
||||
$("#icon_default").attr("src", "images/spinner.png");
|
||||
$("#icon_ok").attr("src", "images/spinner.png");
|
||||
$("#icon_bad").attr("src", "images/spinner.png");
|
||||
$("#icon_warning").attr("src", "images/spinner.png");
|
||||
|
||||
if (icon.length == 0) {
|
||||
$("#icon_without_status").attr("style", "display:none;");
|
||||
$("#icon_default").attr("style", "display:none;");
|
||||
$("#icon_ok").attr("style", "display:none;");
|
||||
$("#icon_bad").attr("style", "display:none;");
|
||||
$("#icon_warning").attr("style", "display:none;");
|
||||
}
|
||||
else {
|
||||
$("#icon_without_status").attr("src",
|
||||
"<?php echo $path; ?>" + icon + ".default.png");
|
||||
$("#icon_default").attr("src",
|
||||
"<?php echo $path; ?>" + icon + ".default.png");
|
||||
$("#icon_ok").attr("src",
|
||||
"<?php echo $path; ?>" + icon + ".ok.png");
|
||||
$("#icon_bad").attr("src",
|
||||
"<?php echo $path; ?>" + icon + ".bad.png");
|
||||
$("#icon_warning").attr("src",
|
||||
"<?php echo $path; ?>" + icon + ".warning.png");
|
||||
$("#icon_without_status").attr("style", "");
|
||||
$("#icon_default").attr("style", "");
|
||||
$("#icon_ok").attr("style", "");
|
||||
$("#icon_bad").attr("style", "");
|
||||
$("#icon_warning").attr("style", "");
|
||||
}
|
||||
|
||||
//$("#icon_default").attr("src", "<?php echo $path; ?>" + icon +
|
||||
}
|
||||
|
||||
//$("#icon_default").attr("src", "<?php echo $path; ?>" + icon +
|
||||
}
|
||||
|
||||
function show_modules_not_learning_mode_context_help() {
|
||||
if ($("input[name='modo'][value=1]").is(':checked')) {
|
||||
$("#modules_not_learning_mode_context_help").hide();
|
||||
function show_modules_not_learning_mode_context_help() {
|
||||
if ($("input[name='modo'][value=1]").is(':checked')) {
|
||||
$("#modules_not_learning_mode_context_help").hide();
|
||||
}
|
||||
else {
|
||||
$("#modules_not_learning_mode_context_help").show();
|
||||
}
|
||||
}
|
||||
else {
|
||||
$("#modules_not_learning_mode_context_help").show();
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready (function () {
|
||||
$("select#id_os").pandoraSelectOS ();
|
||||
|
||||
paint_qrcode("<?php echo ui_get_full_url('index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' . $id_agente); ?>", "#qr_code_agent_view", 128, 128);
|
||||
});
|
||||
/* ]]> */
|
||||
$(document).ready (function () {
|
||||
$("select#id_os").pandoraSelectOS ();
|
||||
|
||||
paint_qrcode(
|
||||
"<?php
|
||||
echo ui_get_full_url('index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' . $id_agente);
|
||||
?>",
|
||||
"#qr_code_agent_view", 128, 128);
|
||||
});
|
||||
|
||||
/* ]]> */
|
||||
</script>
|
||||
|
@ -784,6 +784,7 @@ $edit_module = (bool) get_parameter ('edit_module');
|
||||
if ($update_module || $create_module) {
|
||||
$id_grupo = agents_get_agent_group ($id_agente);
|
||||
|
||||
|
||||
if (!check_acl ($config["id_user"], $id_grupo, "AW")) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to create a module without admin rights");
|
||||
@ -803,7 +804,7 @@ if ($update_module || $create_module) {
|
||||
|
||||
$post_process = (string) get_parameter ('post_process', 0.0);
|
||||
//$prediction_module = 0;
|
||||
|
||||
|
||||
$max_timeout = (int) get_parameter ('max_timeout');
|
||||
$max_retries = (int) get_parameter ('max_retries');
|
||||
$min = (int) get_parameter_post ("min");
|
||||
@ -858,8 +859,8 @@ if ($update_module || $create_module) {
|
||||
$macros = io_json_mb_encode($macros);
|
||||
|
||||
$conf_array = explode("\n",$configuration_data);
|
||||
foreach($conf_array as $line) {
|
||||
if(preg_match("/^module_name\s*(.*)/", $line, $match)) {
|
||||
foreach ($conf_array as $line) {
|
||||
if (preg_match("/^module_name\s*(.*)/", $line, $match)) {
|
||||
$new_configuration_data .= "module_name $name\n";
|
||||
}
|
||||
// We delete from conf all the module macros starting with _field
|
||||
@ -870,7 +871,7 @@ if ($update_module || $create_module) {
|
||||
|
||||
$macros_for_data = enterprise_hook('config_agents_get_macros_data_conf', array($_POST));
|
||||
|
||||
if($macros_for_data !== ENTERPRISE_NOT_HOOK && $macros_for_data != '') {
|
||||
if ($macros_for_data !== ENTERPRISE_NOT_HOOK && $macros_for_data != '') {
|
||||
// Add macros to configuration file
|
||||
$new_configuration_data = str_replace('module_end', $macros_for_data."module_end", $new_configuration_data);
|
||||
}
|
||||
@ -950,9 +951,10 @@ if ($update_module || $create_module) {
|
||||
$wday = get_parameter('wday');
|
||||
$cron_interval = "$minute $hour $mday $month $wday";
|
||||
|
||||
if ($prediction_module != 3) {
|
||||
if ($prediction_module != MODULE_PREDICTION_SYNTHETIC) {
|
||||
unset($serialize_ops);
|
||||
enterprise_hook('modules_delete_synthetic_operations', array($id_agent_module));
|
||||
enterprise_hook('modules_delete_synthetic_operations',
|
||||
array($id_agent_module));
|
||||
}
|
||||
|
||||
$active_snmp_v3 = get_parameter('active_snmp_v3');
|
||||
@ -972,7 +974,8 @@ if ($update_module || $create_module) {
|
||||
// Make changes in the conf file if necessary
|
||||
enterprise_include_once('include/functions_config_agents.php');
|
||||
enterprise_hook('config_agents_write_module_in_conf',
|
||||
array($id_agente, io_safe_output($old_configuration_data), io_safe_output($configuration_data), $disabled));
|
||||
array($id_agente, io_safe_output($old_configuration_data),
|
||||
io_safe_output($configuration_data), $disabled));
|
||||
}
|
||||
|
||||
// MODULE UPDATE
|
||||
@ -1040,8 +1043,10 @@ if ($update_module) {
|
||||
if ($module_kind == MODULE_DATA) {
|
||||
unset($values['module_interval']);
|
||||
}
|
||||
|
||||
if ($prediction_module == 3 && $serialize_ops == '') {
|
||||
|
||||
if ($prediction_module == MODULE_PREDICTION_SYNTHETIC &&
|
||||
$serialize_ops == '') {
|
||||
|
||||
$result = false;
|
||||
}
|
||||
else {
|
||||
@ -1072,7 +1077,7 @@ if ($update_module) {
|
||||
$edit_module = true;
|
||||
|
||||
db_pandora_audit("Agent management",
|
||||
"Fail to try update module '$name' for agent ".$agent["nombre"]);
|
||||
"Fail to try update module '$name' for agent " . $agent["nombre"]);
|
||||
}
|
||||
else {
|
||||
if ($prediction_module == 3) {
|
||||
|
@ -296,8 +296,9 @@ $table_advanced->width = '98%';
|
||||
$table_advanced->class = 'databox_color';
|
||||
$table_advanced->data = array ();
|
||||
$table_advanced->style = array ();
|
||||
$table_advanced->style[0] = 'font-weight: bold; vertical-align: top';
|
||||
$table_advanced->style[3] = 'font-weight: bold; vertical-align: top';
|
||||
$table_advanced->style[0] =
|
||||
$table_advanced->style[3] =
|
||||
'font-weight: bold; vertical-align: top';
|
||||
$table_advanced->colspan = array ();
|
||||
|
||||
$table_advanced->data[0][0] = __('Description');
|
||||
@ -356,8 +357,9 @@ else {
|
||||
$table_advanced->data[2][1] .= html_print_input_hidden ('moduletype', $moduletype, true);
|
||||
|
||||
$table_advanced->data[2][3] = __('Post process').' ' . ui_print_help_icon ('postprocess', true);
|
||||
$table_advanced->data[2][4] = html_print_input_text ('post_process',
|
||||
$post_process, '', 15, 25, true, $disabledBecauseInPolicy);
|
||||
$table_advanced->data[2][4] =
|
||||
html_print_input_text('post_process',
|
||||
$post_process, '', 15, 25, true, $disabledBecauseInPolicy);
|
||||
|
||||
$table_advanced->data[3][0] = __('Min. Value');
|
||||
$table_advanced->colspan[3][1] = 2;
|
||||
@ -420,13 +422,18 @@ if ($__code_from == 'modules') {
|
||||
$__table_modules = 'ttag_module';
|
||||
$__id_where = 'b.id_agente_modulo';
|
||||
$__id = (int)$id_agent_module;
|
||||
|
||||
// Code comes from policy module editor
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
global $__id_pol_mod;
|
||||
$__table_modules= 'ttag_policy_module';
|
||||
$__id_where = 'b.id_policy_module';
|
||||
$__id = $__id_pol_mod;
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (!tags_has_user_acl_tags($config["id_user"])) {
|
||||
@ -468,28 +475,33 @@ else {
|
||||
true, true, false, false, 'width: 200px', '5');
|
||||
}
|
||||
}
|
||||
$table_advanced->data[6][2] = html_print_image('images/darrowright.png', true, array('id' => 'right', 'title' => __('Add tags to module'))); //html_print_input_image ('add', 'images/darrowright.png', 1, '', true, array ('title' => __('Add tags to module')));
|
||||
$table_advanced->data[6][2] = html_print_image('images/darrowright.png', true, array('id' => 'right', 'title' => __('Add tags to module'))); //html_print_input_image ('add', 'images/darrowright.png', 1, '', true, array ('title' => __('Add tags to module')));
|
||||
$table_advanced->data[6][2] .= '<br><br><br><br>' . html_print_image('images/darrowleft.png', true, array('id' => 'left', 'title' => __('Delete tags to module'))); //html_print_input_image ('add', 'images/darrowleft.png', 1, '', true, array ('title' => __('Delete tags to module')));
|
||||
|
||||
$table_advanced->data[6][3] = '<b>' . __('Tags selected') . '</b>';
|
||||
$table_advanced->data[6][4] = html_print_select_from_sql (
|
||||
$table_advanced->data[6][4] = html_print_select_from_sql (
|
||||
"SELECT a.id_tag, name
|
||||
FROM ttag a, $__table_modules b
|
||||
WHERE a.id_tag = b.id_tag AND $__id_where = $__id
|
||||
ORDER BY name",
|
||||
'id_tag_selected[]', '', '','','', true, true, false,
|
||||
false, 'width: 200px', '5');
|
||||
|
||||
|
||||
$table_advanced->data[7][0] = __('Quiet');
|
||||
$table_advanced->data[7][0] .= ui_print_help_tip(__('The module still stores data but the alerts and events will be stop'), true);
|
||||
$table_advanced->data[7][0] .= ui_print_help_tip(
|
||||
__('The module still stores data but the alerts and events will be stop'), true);
|
||||
$table_advanced->colspan[7][1] = 4;
|
||||
$table_advanced->data[7][1] = html_print_checkbox('quiet_module', 1,
|
||||
$quiet_module, true);
|
||||
|
||||
$table_advanced->data[8][0] = __('Critical instructions'). ui_print_help_tip(__("Instructions when the status is critical"), true);
|
||||
$table_advanced->data[8][0] = __('Critical instructions') .
|
||||
ui_print_help_tip(__("Instructions when the status is critical"), true);
|
||||
$table_advanced->data[8][1] = html_print_textarea ('critical_instructions', 2, 65, $critical_instructions, '', true);
|
||||
$table_advanced->colspan[8][1] = 4;
|
||||
|
||||
$table_advanced->data[9][0] = __('Warning instructions'). ui_print_help_tip(__("Instructions when the status is warning"), true);
|
||||
$table_advanced->data[9][0] = __('Warning instructions') .
|
||||
ui_print_help_tip(__("Instructions when the status is warning"), true);
|
||||
$table_advanced->data[9][1] = html_print_textarea ('warning_instructions', 2, 65, $warning_instructions, '', true);
|
||||
$table_advanced->colspan[9][1] = 4;
|
||||
|
||||
@ -497,7 +509,8 @@ $table_advanced->data[10][0] = __('Unknown instructions'). ui_print_help_tip(__(
|
||||
$table_advanced->data[10][1] = html_print_textarea ('unknown_instructions', 2, 65, $unknown_instructions, '', true);
|
||||
$table_advanced->colspan[10][1] = 4;
|
||||
|
||||
$table_advanced->data[11][0] = __('Cron') . ui_print_help_tip (__('If cron is set the module interval is ignored and the module runs on the specified date and time'), true);
|
||||
$table_advanced->data[11][0] = __('Cron') .
|
||||
ui_print_help_tip (__('If cron is set the module interval is ignored and the module runs on the specified date and time'), true);
|
||||
$table_advanced->data[11][1] = html_print_extended_select_for_cron ($hour, $minute, $mday, $month, $wday, true);
|
||||
$table_advanced->colspan[11][1] = 4;
|
||||
|
||||
|
@ -70,6 +70,7 @@ if (is_ajax ()) {
|
||||
|
||||
$fields_rows = array();
|
||||
for ($i = 1; $i <= 10; $i++) {
|
||||
|
||||
if (!empty($fields_descriptions[$i - 1])) {
|
||||
$fdesc = $fields_descriptions[$i - 1] .
|
||||
' <br><span style="font-size:xx-small; font-weight:normal;">' .
|
||||
|
@ -156,7 +156,7 @@ if ($delete_template) {
|
||||
$id = get_parameter ('id');
|
||||
$al_template = alerts_get_alert_template($id);
|
||||
|
||||
if ($al_template !== false){
|
||||
if ($al_template !== false) {
|
||||
// If user tries to delete a template with group=ALL then must have "PM" access privileges
|
||||
if ($al_template['id_group'] == 0) {
|
||||
if (! check_acl ($config['id_user'], 0, "PM")) {
|
||||
@ -233,6 +233,7 @@ $table->width = '98%';
|
||||
$table->data = array ();
|
||||
$table->head = array ();
|
||||
$table->style = array ();
|
||||
|
||||
$table->style[0] = 'font-weight: bold';
|
||||
$table->style[2] = 'font-weight: bold';
|
||||
|
||||
|
@ -286,7 +286,7 @@ $(document).ready (function () {
|
||||
else {
|
||||
|
||||
$('#table_macros-field' + i).replaceWith(field_row);
|
||||
if (old_value != '' && old_recovery_value != ''){
|
||||
if (old_value != '' || old_recovery_value != ''){
|
||||
$("[name=field" + i + "_value]").val(old_value);
|
||||
$("[name=field" + i + "_recovery_value]").val(old_recovery_value);
|
||||
}
|
||||
@ -311,6 +311,7 @@ $(document).ready (function () {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
render_command_preview(original_command);
|
||||
render_command_recovery_preview(original_command);
|
||||
|
||||
|
@ -126,6 +126,7 @@ if (!empty($result)) {
|
||||
}
|
||||
|
||||
html_print_table ($table);
|
||||
|
||||
}
|
||||
else {
|
||||
// No categories available or selected
|
||||
|
@ -119,7 +119,7 @@ echo "<table border=0 cellpadding=4 cellspacing=4 class=databox width=98%>";
|
||||
echo "<td align=center>";
|
||||
html_print_label (__("Name"),'name');
|
||||
echo "</td>";
|
||||
echo "<td align=center>";
|
||||
echo "<td align=center>";
|
||||
html_print_input_text ('name_category', $name_category);
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
|
@ -31,22 +31,22 @@ if (! check_acl ($config['id_user'], 0, "DM")) {
|
||||
$time["all"] = get_system_time ();
|
||||
|
||||
// 1 day ago
|
||||
$time["1day"] = $time["all"]-86400;
|
||||
$time["1day"] = $time["all"] - SECONDS_1DAY;
|
||||
|
||||
// 3 days ago
|
||||
$time["3day"] = $time["all"]-(86400*3);
|
||||
$time["3day"] = $time["all"] - ( SECONDS_1DAY * 3);
|
||||
|
||||
// 1 week ago
|
||||
$time["1week"] = $time["all"]-(86400*7);
|
||||
$time["1week"] = $time["all"] - SECONDS_1WEEK;
|
||||
|
||||
// 2 weeks ago
|
||||
$time["2week"] = $time["all"]-(86400*14);
|
||||
$time["2week"] = $time["all"] - SECONDS_2WEEK;
|
||||
|
||||
// 1 month ago
|
||||
$time["1month"] = $time["all"]-(86400*30);
|
||||
$time["1month"] = $time["all"] - SECONDS_1MONTH;
|
||||
|
||||
// Three months ago
|
||||
$time["3month"] = $time["all"]-(86400*90);
|
||||
$time["3month"] = $time["all"] - SECONDS_3MONTHS;
|
||||
|
||||
// Todo for a good DB maintenance
|
||||
/*
|
||||
|
@ -52,9 +52,11 @@ else if ($update != '') {
|
||||
'value' => $event_fields
|
||||
);
|
||||
//update 'event_fields' in tconfig table to keep the value at update.
|
||||
$result = db_process_sql_update('tconfig', $values, array ('token' => 'event_fields'));
|
||||
$result = db_process_sql_update('tconfig', $values,
|
||||
array ('token' => 'event_fields'));
|
||||
}
|
||||
|
||||
|
||||
$result_selected = array();
|
||||
|
||||
//show list of fields selected.
|
||||
|
@ -78,7 +78,10 @@ $own_info = get_user_info ($config['id_user']);
|
||||
// Get group list that user has access
|
||||
$groups_user = users_get_groups ($config['id_user'], "EW", users_can_manage_group_all(), true);
|
||||
|
||||
$sql = "SELECT * FROM tevent_filter WHERE id_group_filter IN (".implode(',', array_keys ($groups_user)).")";
|
||||
$sql = "
|
||||
SELECT *
|
||||
FROM tevent_filter
|
||||
WHERE id_group_filter IN (".implode(',', array_keys ($groups_user)).")";
|
||||
$filters = db_get_all_rows_sql($sql);
|
||||
|
||||
if ($filters === false)
|
||||
|
@ -145,6 +145,9 @@ if (defined('METACONSOLE')) {
|
||||
agents_meta_print_header();
|
||||
$sec = 'advanced';
|
||||
|
||||
echo '<div class="notify">';
|
||||
echo __("Edit or delete groups can cause problems with synchronization");
|
||||
echo '</div>';
|
||||
}
|
||||
else {
|
||||
|
||||
|
@ -37,7 +37,7 @@ if (is_ajax ()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(is_array($id_agents) && count($id_agents) == 1 && $id_agents[0] == '') {
|
||||
if (is_array($id_agents) && count($id_agents) == 1 && $id_agents[0] == '') {
|
||||
$id_agents = false;
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ $recursion = get_parameter ('recursion');
|
||||
$add = (bool) get_parameter_post ('add');
|
||||
|
||||
if ($add) {
|
||||
if(empty($id_agents) || $id_agents[0] == 0)
|
||||
if (empty($id_agents) || $id_agents[0] == 0)
|
||||
ui_print_result_message (false, '', __('Could not be added').". ".__('No agents selected'));
|
||||
else {
|
||||
$actions = get_parameter ('action');
|
||||
@ -76,9 +76,9 @@ if ($add) {
|
||||
|
||||
$options = array();
|
||||
|
||||
if($fires_min > 0)
|
||||
if ($fires_min > 0)
|
||||
$options['fires_min'] = $fires_min;
|
||||
if($fires_max > 0)
|
||||
if ($fires_max > 0)
|
||||
$options['fires_max'] = $fires_max;
|
||||
|
||||
if (empty($agent_alerts_id)) {
|
||||
@ -87,9 +87,9 @@ if ($add) {
|
||||
else {
|
||||
$results = true;
|
||||
foreach ($agent_alerts_id as $agent_alert_id) {
|
||||
foreach($actions as $action) {
|
||||
foreach ($actions as $action) {
|
||||
$result = alerts_add_alert_agent_module_action($agent_alert_id, $action, $options);
|
||||
if($result === false)
|
||||
if ($result === false)
|
||||
$results = false;
|
||||
}
|
||||
}
|
||||
@ -169,14 +169,14 @@ html_print_table ($table);
|
||||
$sql = 'SELECT id_agente FROM tagente_modulo WHERE id_agente_modulo IN (SELECT id_agent_module FROM talert_template_modules)';
|
||||
$agents_with_templates = db_get_all_rows_sql($sql);
|
||||
$agents_with_templates_json = array();
|
||||
foreach($agents_with_templates as $ag) {
|
||||
foreach ($agents_with_templates as $ag) {
|
||||
$agents_with_templates_json[] = $ag['id_agente'];
|
||||
}
|
||||
$agents_with_templates_json = json_encode($agents_with_templates_json);
|
||||
|
||||
echo "<input type='hidden' id='hidden-agents_with_templates' value='$agents_with_templates_json'>";
|
||||
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'" onsubmit="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
|
||||
echo '<div class="action-buttons" style="width: ' . $table->width . '" onsubmit="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
|
||||
html_print_input_hidden ('add', 1);
|
||||
html_print_submit_button (__('Add'), 'go', false, 'class="sub add"');
|
||||
echo '</div>';
|
||||
@ -189,7 +189,10 @@ ui_require_jquery_file ('pandora.controls');
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$(document).ready (function () {
|
||||
|
||||
|
||||
update_alerts();
|
||||
|
||||
var recursion;
|
||||
|
@ -205,7 +205,10 @@ ui_require_jquery_file ('pandora.controls');
|
||||
|
||||
<script type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
|
||||
$(document).ready (function () {
|
||||
|
||||
|
||||
$("#checkbox-recursion").click(function () {
|
||||
$("#id_group").trigger("change");
|
||||
});
|
||||
|
@ -38,6 +38,8 @@ $destiny_recursion = get_parameter ('destiny_recursion');
|
||||
|
||||
$do_operation = (bool) get_parameter ('do_operation');
|
||||
|
||||
|
||||
|
||||
if ($do_operation) {
|
||||
$result = agents_process_manage_config($source_id_agent,
|
||||
$destiny_id_agents);
|
||||
@ -166,12 +168,14 @@ $table->size[0] = '20%';
|
||||
$table->size[1] = '30%';
|
||||
$table->size[2] = '20%';
|
||||
$table->size[3] = '30%';
|
||||
|
||||
$table->data[0][0] = __('Group');
|
||||
$table->data[0][1] = html_print_select_groups(false, "AW", true, 'destiny_id_group',
|
||||
$destiny_id_group, false, '', '', true);
|
||||
$table->data[0][2] = __('Group recursion');
|
||||
$table->data[0][3] = html_print_checkbox ("destiny_recursion", 1,
|
||||
$destiny_recursion, true, false);
|
||||
|
||||
$status_list = array ();
|
||||
$status_list[AGENT_STATUS_NORMAL] = __('Normal');
|
||||
$status_list[AGENT_STATUS_WARNING] = __('Warning');
|
||||
@ -182,6 +186,7 @@ $status_list[AGENT_STATUS_NOT_INIT] = __('Not init');
|
||||
$table->data[1][0] = __('Status');
|
||||
$table->data[1][1] = html_print_select($status_list,
|
||||
'status_agents_destiny', 'selected', '', __('All'), AGENT_STATUS_ALL, true);
|
||||
|
||||
$table->data[2][0] = __('Agent');
|
||||
$table->data[2][0] .= '<span id="destiny_agent_loading" class="invisible">';
|
||||
$table->data[2][0] .= html_print_image ("images/spinner.png", true);
|
||||
@ -204,6 +209,7 @@ html_print_table ($table);
|
||||
echo '</fieldset>';
|
||||
|
||||
echo '<div class="action-buttons" style="width: ' . $table->width . '">';
|
||||
|
||||
html_print_input_hidden ('do_operation', 1);
|
||||
html_print_submit_button (__('Copy'), 'go', false, 'class="sub wand"');
|
||||
echo '</div>';
|
||||
@ -219,6 +225,8 @@ ui_require_jquery_file ('pandora.controls');
|
||||
<script type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
var module_alerts;
|
||||
|
||||
|
||||
$(document).ready (function () {
|
||||
var source_recursion;
|
||||
$("#checkbox-source_recursion").click(function () {
|
||||
@ -394,7 +402,14 @@ $(document).ready (function () {
|
||||
});
|
||||
|
||||
$("#manage_config_form").submit (function () {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$("h3:not([id=message])").remove ();
|
||||
|
||||
if ($("#source_id_agent").attr ("value") == 0) {
|
||||
$("#message").showMessage ("<?php echo __('No source agent to copy') ?>");
|
||||
return false;
|
||||
@ -419,6 +434,7 @@ $(document).ready (function () {
|
||||
}
|
||||
|
||||
$("#message").hide ();
|
||||
|
||||
return true;
|
||||
});
|
||||
});
|
||||
|
@ -143,7 +143,10 @@ ui_require_jquery_file ('pandora.controls');
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$(document).ready (function () {
|
||||
|
||||
|
||||
var recursion;
|
||||
|
||||
$("#checkbox-recursion").click(function () {
|
||||
|
@ -248,7 +248,11 @@ ui_require_jquery_file ('pandora.controls');
|
||||
|
||||
<script type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
|
||||
|
||||
$(document).ready (function () {
|
||||
|
||||
|
||||
$("#id_agents").change(agent_changed_by_multiple_agents_with_alerts);
|
||||
|
||||
$("#id_alert_template").change (function () {
|
||||
|
@ -372,6 +372,8 @@ else {
|
||||
|
||||
<script type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
|
||||
|
||||
$(document).ready (function () {
|
||||
$("#id_agents").change(agent_changed_by_multiple_agents);
|
||||
$("#module_name").change(module_changed_by_multiple_modules);
|
||||
@ -542,6 +544,7 @@ $(document).ready (function () {
|
||||
$("#status_agents").change(function() {
|
||||
$("#groups_select").trigger("change");
|
||||
});
|
||||
|
||||
});
|
||||
/* ]]> */
|
||||
</script>
|
||||
|
@ -436,9 +436,13 @@ ui_require_jquery_file ('bgiframe');
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
|
||||
|
||||
|
||||
//Use this function for change 3 icons when change the selectbox
|
||||
$(document).ready (function () {
|
||||
|
||||
|
||||
|
||||
$("#id_agents").change (function () {
|
||||
var idAgents = Array();
|
||||
jQuery.each ($("#id_agents option:selected"), function (i, val) {
|
||||
|
@ -413,10 +413,12 @@ $table->data['edit2'][1] = html_print_extended_select_for_time ('module_interval
|
||||
$table->data['edit2'][2] = __('Disabled');
|
||||
$table->data['edit2'][3] = html_print_select(array('' => __('No change'), '1' => __('Yes'), '0' => __('No')),'disabled','','','', '', true);
|
||||
|
||||
$table->data['edit3'][0] = __('Post process').ui_print_help_icon ('postprocess', true);
|
||||
$table->data['edit3'][0] = __('Post process') .
|
||||
ui_print_help_icon ('postprocess', true);
|
||||
$table->data['edit3'][1] = html_print_input_text ('post_process', '', '', 10, 15, true);
|
||||
$table->data['edit3'][2] = __('SMNP community');
|
||||
$table->data['edit3'][3] = html_print_input_text ('snmp_community', '', '', 10, 15, true);
|
||||
|
||||
$table->data['edit35'][0] = __('Target IP');
|
||||
$table->data['edit35'][1] = html_print_input_text ('ip_target', '', '', 15, 60, true);
|
||||
$table->data['edit35'][2] = __('SNMP version');
|
||||
@ -561,7 +563,10 @@ else {
|
||||
|
||||
<script type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
|
||||
$(document).ready (function () {
|
||||
|
||||
|
||||
$("#id_agents").change(agent_changed_by_multiple_agents);
|
||||
$("#module_name").change(module_changed_by_multiple_modules);
|
||||
|
||||
|
@ -141,19 +141,23 @@ if ($option == '') {
|
||||
}
|
||||
|
||||
$alertstab = array('text' => '<a href="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&tab=massive_alerts">'
|
||||
. html_print_image ('images/op_alerts.png', true, array ('title' => __('Alerts operations')))
|
||||
. html_print_image ('images/op_alerts.png', true,
|
||||
array ('title' => __('Alerts operations')))
|
||||
. '</a>', 'active' => $tab == 'massive_alerts');
|
||||
|
||||
$userstab = array('text' => '<a href="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&tab=massive_users">'
|
||||
. html_print_image ('images/op_workspace.png', true, array ('title' => __('Users operations')))
|
||||
. html_print_image ('images/op_workspace.png', true,
|
||||
array ('title' => __('Users operations')))
|
||||
. '</a>', 'active' => $tab == 'massive_users');
|
||||
|
||||
$agentstab = array('text' => '<a href="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&tab=massive_agents">'
|
||||
. html_print_image ('images/bricks.png', true, array ('title' => __('Agents operations')))
|
||||
. html_print_image ('images/bricks.png', true,
|
||||
array ('title' => __('Agents operations')))
|
||||
. '</a>', 'active' => $tab == 'massive_agents');
|
||||
|
||||
$modulestab = array('text' => '<a href="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&tab=massive_modules">'
|
||||
. html_print_image ('images/brick.png', true, array ('title' => __('Modules operations')))
|
||||
. html_print_image ('images/brick.png', true,
|
||||
array ('title' => __('Modules operations')))
|
||||
. '</a>', 'active' => $tab == 'massive_modules');
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -77,7 +77,7 @@ else {
|
||||
$agents[$row['id_agente']] = $row['nombre'];
|
||||
}
|
||||
|
||||
switch ($config['dbtype']){
|
||||
switch ($config['dbtype']) {
|
||||
case "mysql":
|
||||
case "postgresql":
|
||||
$rows = db_get_all_rows_sql('
|
||||
|
@ -93,11 +93,11 @@ if ($idReport != 0) {
|
||||
$edit = true;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (! $edit) {
|
||||
// The user that created the report should can delete it. Despite its permissions.
|
||||
$delete_report_bypass = false;
|
||||
|
||||
|
||||
if ($action == 'delete_report') {
|
||||
if ($config['id_user'] == $report['id_user'] || is_user_admin ($config["id_user"])) {
|
||||
$delete_report_bypass = true;
|
||||
@ -339,14 +339,14 @@ switch ($action) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (! $delete) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access report builder deletion");
|
||||
require ("general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$result = reports_delete_report ($idReport);
|
||||
if ($result !== false)
|
||||
db_pandora_audit("Report management", "Delete report #$idReport");
|
||||
@ -431,8 +431,14 @@ switch ($action) {
|
||||
$filter['metaconsole'] = 0;
|
||||
|
||||
$reports = reports_get_reports ($filter,
|
||||
array ('name', 'id_report', 'description', 'private',
|
||||
'id_user', 'id_group', 'non_interactive'), $return_all_group, 'RR', $group);
|
||||
array (
|
||||
'name',
|
||||
'id_report',
|
||||
'description',
|
||||
'private',
|
||||
'id_user',
|
||||
'id_group',
|
||||
'non_interactive'), $return_all_group, 'RR', $group);
|
||||
|
||||
$table->width = '0px';
|
||||
if (sizeof ($reports)) {
|
||||
@ -644,7 +650,7 @@ switch ($action) {
|
||||
}
|
||||
break;
|
||||
case 'update':
|
||||
case 'save':
|
||||
case 'save':
|
||||
switch ($activeTab) {
|
||||
case 'main':
|
||||
$reportName = get_parameter('name');
|
||||
@ -724,12 +730,13 @@ switch ($action) {
|
||||
$first_page = $config['custom_report_front_firstpage'];
|
||||
$footer = $config['custom_report_front_footer'];
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
$start_url = ui_get_full_url(false, false, false, false);
|
||||
$first_page = "<p style="text-align: center;">&nbsp;</p>
<p style="text-align: center;">&nbsp;</p>
<p style="text-align: center;">&nbsp;</p>
<p style="text-align: center;">&nbsp;</p>
<p style="text-align: center;">&nbsp;</p>
<p style="text-align: center;">&nbsp;</p>
<p style="text-align: center;">&nbsp;</p>
<p style="text-align: center;"><img src="" . $start_url . "/images/pandora_report_logo.png" alt="" width="800" /></p>
<p style="text-align: center;">&nbsp;</p>
<p style="text-align: center;"><span style="font-size: xx-large;">(_REPORT_NAME_)</span></p>
<p style="text-align: center;"><span style="font-size: large;">(_DATETIME_)</span></p>";
|
||||
$logo = $header = $footer = null;
|
||||
|
||||
|
||||
}
|
||||
|
||||
$idOrResult = db_process_sql_insert('treport',
|
||||
@ -769,7 +776,8 @@ switch ($action) {
|
||||
break;
|
||||
case 'item_editor':
|
||||
$resultOperationDB = null;
|
||||
$report = db_get_row_filter('treport', array('id_report' => $idReport));
|
||||
$report = db_get_row_filter('treport',
|
||||
array('id_report' => $idReport));
|
||||
|
||||
$reportName = $report['name'];
|
||||
$idGroupReport = $report['id_group'];
|
||||
@ -811,6 +819,8 @@ switch ($action) {
|
||||
$values['top_n'] = get_parameter('combo_sla_sort_options',0);
|
||||
$values['top_n_value'] = get_parameter('quantity');
|
||||
$values['text'] = get_parameter('text');
|
||||
$values['show_graph'] = get_parameter('combo_graph_options');
|
||||
|
||||
$good_format = true;
|
||||
break;
|
||||
case 'inventory':
|
||||
@ -842,11 +852,27 @@ switch ($action) {
|
||||
$values['top_n_value'] = get_parameter('max_values');
|
||||
$good_format = true;
|
||||
break;
|
||||
case 'availability':
|
||||
// HACK it is saved in show_graph field.
|
||||
// Show interfaces instead the modules
|
||||
$values['show_graph'] =
|
||||
get_parameter('checkbox_show_address_agent');
|
||||
$good_format = true;
|
||||
break;
|
||||
case 'simple_graph':
|
||||
case 'simple_baseline_graph':
|
||||
// HACK it is saved in show_graph field.
|
||||
$values['show_graph'] =
|
||||
(int)get_parameter('time_compare_overlapped');
|
||||
$values['period'] = get_parameter('period');
|
||||
$good_format = true;
|
||||
break;
|
||||
default:
|
||||
$values['period'] = get_parameter('period');
|
||||
$values['top_n'] = get_parameter('radiobutton_max_min_avg',0);
|
||||
$values['top_n_value'] = get_parameter('quantity');
|
||||
$values['text'] = get_parameter('text');
|
||||
$values['show_graph'] = get_parameter('combo_graph_options');
|
||||
$good_format = true;
|
||||
}
|
||||
|
||||
@ -878,7 +904,6 @@ switch ($action) {
|
||||
$values['order_uptodown'] = get_parameter ('radiobutton_order_uptodown');
|
||||
$values['exception_condition'] = (int)get_parameter('exception_condition', 0);
|
||||
$values['exception_condition_value'] = get_parameter('exception_condition_value');
|
||||
$values['show_graph'] = get_parameter('combo_graph_options');
|
||||
$values['id_module_group'] = get_parameter('combo_modulegroup');
|
||||
$values['id_group'] = get_parameter ('combo_group');
|
||||
$values['server_name'] = get_parameter ('server_name');
|
||||
@ -904,6 +929,8 @@ switch ($action) {
|
||||
$event_graph_by_criticity = get_parameter('event_graph_by_criticity', 0);
|
||||
$event_graph_validated_vs_unvalidated = get_parameter('event_graph_validated_vs_unvalidated', 0);
|
||||
|
||||
$event_filter_search = get_parameter('filter_search', '');
|
||||
|
||||
// If metaconsole is activated
|
||||
if ($config['metaconsole'] == 1 && defined('METACONSOLE')) {
|
||||
if (($values['type'] == 'custom_graph') or ($values['type'] == 'automatic_custom_graph')) {
|
||||
@ -970,6 +997,13 @@ switch ($action) {
|
||||
$style['event_graph_by_user_validator'] = $event_graph_by_user_validator;
|
||||
$style['event_graph_by_criticity'] = $event_graph_by_criticity;
|
||||
$style['event_graph_validated_vs_unvalidated'] = $event_graph_validated_vs_unvalidated;
|
||||
|
||||
switch ($values['type']) {
|
||||
case 'event_report_group':
|
||||
$style['event_filter_search'] =
|
||||
$event_filter_search;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'simple_graph':
|
||||
// Warning. We are using this column to hold this value to avoid
|
||||
@ -1021,6 +1055,8 @@ switch ($action) {
|
||||
$values['top_n'] = get_parameter('combo_sla_sort_options',0);
|
||||
$values['top_n_value'] = get_parameter('quantity');
|
||||
$values['text'] = get_parameter('text');
|
||||
$values['show_graph'] = get_parameter('combo_graph_options');
|
||||
|
||||
$good_format = true;
|
||||
break;
|
||||
case 'inventory':
|
||||
@ -1058,11 +1094,28 @@ switch ($action) {
|
||||
$values['top_n_value'] = get_parameter('max_values');
|
||||
$good_format = true;
|
||||
break;
|
||||
case 'availability':
|
||||
$values['period'] = get_parameter('period');
|
||||
// HACK it is saved in show_graph field.
|
||||
// Show interfaces instead the modules
|
||||
$values['show_graph'] =
|
||||
get_parameter('checkbox_show_address_agent');
|
||||
$good_format = true;
|
||||
break;
|
||||
case 'simple_graph':
|
||||
case 'simple_baseline_graph':
|
||||
// HACK it is saved in show_graph field.
|
||||
$values['show_graph'] =
|
||||
(int)get_parameter('time_compare_overlapped');
|
||||
$values['period'] = get_parameter('period');
|
||||
$good_format = true;
|
||||
break;
|
||||
default:
|
||||
$values['period'] = get_parameter('period');
|
||||
$values['top_n'] = get_parameter('radiobutton_max_min_avg',0);
|
||||
$values['top_n_value'] = get_parameter('quantity');
|
||||
$values['text'] = get_parameter('text');
|
||||
$values['show_graph'] = get_parameter('combo_graph_options');
|
||||
$good_format = true;
|
||||
}
|
||||
|
||||
@ -1110,7 +1163,6 @@ switch ($action) {
|
||||
$values['order_uptodown'] = get_parameter ('radiobutton_order_uptodown',0);
|
||||
$values['exception_condition'] = (int)get_parameter('radiobutton_exception_condition', 0);
|
||||
$values['exception_condition_value'] = get_parameter('exception_condition_value');
|
||||
$values['show_graph'] = get_parameter('combo_graph_options');
|
||||
$values['id_module_group'] = get_parameter('combo_modulegroup');
|
||||
$values['id_group'] = get_parameter ('combo_group');
|
||||
$values['server_name'] = get_parameter ('server_name');
|
||||
@ -1174,6 +1226,9 @@ switch ($action) {
|
||||
$event_graph_by_user_validator = get_parameter('event_graph_by_user_validator', 0);
|
||||
$event_graph_by_criticity = get_parameter('event_graph_by_criticity', 0);
|
||||
$event_graph_validated_vs_unvalidated = get_parameter('event_graph_validated_vs_unvalidated', 0);
|
||||
|
||||
$event_filter_search = get_parameter('filter_search', '');
|
||||
|
||||
//Added for events items
|
||||
$style['filter_event_no_validated'] = $filter_event_no_validated;
|
||||
$style['filter_event_validated'] = $filter_event_validated;
|
||||
@ -1184,6 +1239,14 @@ switch ($action) {
|
||||
$style['event_graph_by_user_validator'] = $event_graph_by_user_validator;
|
||||
$style['event_graph_by_criticity'] = $event_graph_by_criticity;
|
||||
$style['event_graph_validated_vs_unvalidated'] = $event_graph_validated_vs_unvalidated;
|
||||
|
||||
switch ($values['type']) {
|
||||
case 'event_report_group':
|
||||
$style['event_filter_search'] =
|
||||
$event_filter_search;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
case 'simple_graph':
|
||||
// Warning. We are using this column to hold this value to avoid
|
||||
@ -1548,7 +1611,7 @@ switch ($action) {
|
||||
switch ($activeTab) {
|
||||
case 'main':
|
||||
$buttons['list_reports']['active'] = true;
|
||||
$subsection = ' » '.__('Custom reporting');
|
||||
$subsection = ' » ' . __('Custom reporting');
|
||||
break;
|
||||
default:
|
||||
$subsection = reporting_enterprise_add_subsection_main($activeTab, $buttons);
|
||||
|
@ -809,7 +809,7 @@ function cleanFields(item) {
|
||||
tinymce.get('text-label').setContent("(_VALUE_)");
|
||||
}
|
||||
|
||||
fill_parent_select();
|
||||
//fill_parent_select();
|
||||
|
||||
var anyText = $("#any_text").html(); //Trick for catch the translate text.
|
||||
$("#module")
|
||||
|
@ -188,6 +188,7 @@ foreach ($layoutDatas as $layoutData) {
|
||||
case STATIC_GRAPH:
|
||||
case ICON:
|
||||
case GROUP_ITEM:
|
||||
case SERVICE:
|
||||
$table->data[$i + 1][1] =
|
||||
html_print_select ($images_list,
|
||||
'image_' . $idLayoutData, $layoutData['image'], '',
|
||||
|
@ -233,7 +233,7 @@ switch ($activeTab) {
|
||||
$values['label_color'] = get_parameter('label_color_' . $id, '#000000');
|
||||
|
||||
if (enterprise_installed()) {
|
||||
enterprise_visual_map_update_action_from_list_elements($type, $values);
|
||||
enterprise_visual_map_update_action_from_list_elements($type, $values, $id);
|
||||
}
|
||||
|
||||
db_process_sql_update('tlayout_data', $values, array('id' => $id));
|
||||
|
@ -66,8 +66,9 @@ if ($search_modules) {
|
||||
|
||||
|
||||
if ($get_module_detail) {
|
||||
|
||||
// This script is included manually to be included after jquery and avoid error
|
||||
ui_include_time_picker();
|
||||
ui_require_jquery_file("ui.datepicker-" . get_user_language(), "include/javascript/i18n/");
|
||||
|
||||
$module_id = (int)get_parameter('id_module');
|
||||
$period = get_parameter("period", SECONDS_1DAY);
|
||||
@ -80,8 +81,8 @@ if ($get_module_detail) {
|
||||
|
||||
|
||||
$group = agents_get_agentmodule_group ($module_id);
|
||||
$agentId = get_parameter("id_agent");
|
||||
$server_name = get_parameter('server_name');
|
||||
$agentId = (int) get_parameter("id_agent");
|
||||
$server_name = (string) get_parameter('server_name');
|
||||
|
||||
if (defined ('METACONSOLE')) {
|
||||
$server = metaconsole_get_connection ($server_name);
|
||||
@ -128,7 +129,7 @@ if ($get_module_detail) {
|
||||
$formtable->data[0][3] = "<a href='javascript: show_module_detail_dialog(" . $module_id .", ". $agentId.", \"" . $server_name . "\", 0, -1)'>". html_print_image ("images/refresh.png", true, array ("style" => 'vertical-align: middle;', "border" => "0" )) . "</a>";
|
||||
$formtable->rowspan[0][3] = 2;
|
||||
$formtable->cellstyle[0][3] = 'vertical-align: middle;';
|
||||
|
||||
|
||||
$formtable->data[1][0] = html_print_radio_button_extended(
|
||||
"selection_mode", 'range','', $selection_mode, false, '',
|
||||
'style="margin-right: 15px;"', true) . __("Specify time range");
|
||||
@ -285,9 +286,8 @@ if ($get_module_detail) {
|
||||
html_print_table($table);
|
||||
}
|
||||
|
||||
if (defined ('METACONSOLE')) {
|
||||
if (defined ('METACONSOLE'))
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC150329';
|
||||
$build_version = 'PC150514';
|
||||
$pandora_version = 'v5.1SP2';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
|
@ -120,17 +120,17 @@ switch ($config["dbtype"]) {
|
||||
|
||||
|
||||
/* Color constants */
|
||||
define('COL_CRITICAL','#f85858');
|
||||
define('COL_WARNING','#ffea59');
|
||||
define('COL_WARNING_DARK','#FFB900');
|
||||
define('COL_NORMAL','#6EB432');
|
||||
define('COL_NOTINIT','#3BA0FF');
|
||||
define('COL_UNKNOWN','#AAAAAA');
|
||||
define('COL_ALERTFIRED','#FF8800');
|
||||
define('COL_MINOR','#F099A2');
|
||||
define('COL_MAJOR','#C97A4A');
|
||||
define('COL_INFORMATIONAL','#E4E4E4');
|
||||
define('COL_MAINTENANCE','#3BA0FF');
|
||||
define('COL_CRITICAL', '#FC4444');
|
||||
define('COL_WARNING', '#FAD403');
|
||||
define('COL_WARNING_DARK', '#FFB900');
|
||||
define('COL_NORMAL', '#80BA27');
|
||||
define('COL_NOTINIT', '#5BB6E5');
|
||||
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');
|
||||
|
@ -181,14 +181,26 @@ function mysql_db_get_row ($table, $field_search, $condition, $fields = false) {
|
||||
* @return mixed A matrix with all the values in the table
|
||||
*/
|
||||
function mysql_db_get_all_rows_in_table($table, $order_field = "", $order = 'ASC') {
|
||||
if ($order_field != "") {
|
||||
return db_get_all_rows_sql ("SELECT *
|
||||
FROM `".$table."`
|
||||
ORDER BY ".$order_field . " " . $order);
|
||||
}
|
||||
else {
|
||||
return db_get_all_rows_sql ("SELECT * FROM `".$table."`");
|
||||
$sql = "
|
||||
SELECT *
|
||||
FROM `".$table."`";
|
||||
|
||||
if (!empty($order_field)) {
|
||||
if (is_array($order_field)) {
|
||||
foreach ($order_field as $i => $o) {
|
||||
$order_field[$i] = $o . " " . $order;
|
||||
}
|
||||
$sql .= "
|
||||
ORDER BY " . implode(",", $order_field);
|
||||
}
|
||||
else {
|
||||
$sql .= "
|
||||
ORDER BY ".$order_field . " " . $order;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return db_get_all_rows_sql($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -477,8 +477,8 @@ function human_time_description_raw ($seconds, $exactly = false, $units = 'large
|
||||
$returnTime .= "$mins $minutesString ";
|
||||
}
|
||||
else {
|
||||
$returnTime = sprintf("%02d",$hours) . ':' .
|
||||
sprintf("%02d",$mins);
|
||||
$returnTime = sprintf("%02d", $hours) . ':' .
|
||||
sprintf("%02d", $mins);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ function config_update_config () {
|
||||
case 'general':
|
||||
if (!config_update_value ('language', (string) get_parameter ('language')))
|
||||
$error_update[] = __('Language code for Pandora');
|
||||
if (!config_update_value ('remote_config', (string) get_parameter ('remote_config')))
|
||||
if (!config_update_value ('remote_config', io_safe_input((string) get_parameter ('remote_config'))))
|
||||
$error_update[] = __('Remote config directory');
|
||||
if (!config_update_value ('loginhash_pwd', (string) get_parameter ('loginhash_pwd')))
|
||||
$error_update[] = __('Auto login (hash) password');
|
||||
@ -130,7 +130,7 @@ function config_update_config () {
|
||||
$error_update[] = __('Automatic check for updates');
|
||||
if (!config_update_value ('https', (bool) get_parameter ('https')))
|
||||
$error_update[] = __('Enforce https');
|
||||
if (!config_update_value ('attachment_store', (string) get_parameter ('attachment_store')))
|
||||
if (!config_update_value ('attachment_store', io_safe_input((string) get_parameter ('attachment_store'))))
|
||||
$error_update[] = __('Attachment store');
|
||||
if (!config_update_value ('list_ACL_IPs_for_API', (string) get_parameter('list_ACL_IPs_for_API')))
|
||||
$error_update[] = __('IP list with API access');
|
||||
@ -405,7 +405,7 @@ function config_update_config () {
|
||||
$error_update[] = __('Show QR code header');
|
||||
if (!config_update_value ('status_images_set', (string) get_parameter ('status_images_set')))
|
||||
$error_update[] = __('Status icon set');
|
||||
if (!config_update_value ('fontpath', (string) get_parameter ('fontpath')))
|
||||
if (!config_update_value ('fontpath', io_safe_input((string) get_parameter ('fontpath'))))
|
||||
$error_update[] = __('Font path');
|
||||
if (!config_update_value ('font_size', get_parameter('font_size')))
|
||||
$error_update[] = __('Font size');
|
||||
@ -443,7 +443,7 @@ function config_update_config () {
|
||||
$error_update[] = __('Fixed menu');
|
||||
if (!config_update_value ('paginate_module', get_parameter('paginate_module')))
|
||||
$error_update[] = __('Paginate module');
|
||||
if (!config_update_value ('graphviz_bin_dir', get_parameter('graphviz_bin_dir')))
|
||||
if (!config_update_value ('graphviz_bin_dir', io_safe_input(get_parameter('graphviz_bin_dir'))))
|
||||
$error_update[] = __('Custom graphviz directory');
|
||||
if (!config_update_value ('networkmap_max_width', get_parameter('networkmap_max_width')))
|
||||
$error_update[] = __('Networkmap max width');
|
||||
@ -531,7 +531,7 @@ function config_update_config () {
|
||||
$error_update[] = __('Name resolution for IP address');
|
||||
break;
|
||||
case 'log':
|
||||
if (!config_update_value ('log_dir', get_parameter('log_dir')))
|
||||
if (!config_update_value ('log_dir', io_safe_input(get_parameter('log_dir'))))
|
||||
$error_update[] = __('Netflow max lifetime');
|
||||
if (!config_update_value ('log_max_lifetime', (int)get_parameter('log_max_lifetime')))
|
||||
$error_update[] = __('Log max lifetime');
|
||||
@ -805,21 +805,21 @@ function config_process_config () {
|
||||
// dir.
|
||||
if (!isset ($config['attachment_store'])) {
|
||||
config_update_value('attachment_store',
|
||||
$config['homedir'] . '/attachment');
|
||||
io_safe_input($config['homedir']) . '/attachment');
|
||||
}
|
||||
else {
|
||||
//Fixed when the user moves the pandora console to another dir
|
||||
//after the first uses.
|
||||
if (!is_dir($config['attachment_store'])) {
|
||||
config_update_value('attachment_store',
|
||||
$config['homedir'] . '/attachment');
|
||||
io_safe_input($config['homedir']) . '/attachment');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!isset ($config['fontpath'])) {
|
||||
config_update_value('fontpath',
|
||||
$config['homedir'] . '/include/fonts/smallfont.ttf');
|
||||
io_safe_input($config['homedir']) . '/include/fonts/smallfont.ttf');
|
||||
}
|
||||
|
||||
if (!isset ($config['style'])) {
|
||||
@ -1299,8 +1299,8 @@ function config_check () {
|
||||
}
|
||||
|
||||
// Get remote file dir.
|
||||
$remote_config = db_get_value_filter('value',
|
||||
'tconfig', array('token' => 'remote_config'));
|
||||
$remote_config = io_safe_output(db_get_value_filter('value',
|
||||
'tconfig', array('token' => 'remote_config')));
|
||||
|
||||
|
||||
if (enterprise_installed()) {
|
||||
@ -1362,7 +1362,7 @@ function config_check () {
|
||||
'no_close' => true, 'force_style' => 'color: #000000 !important'), '', true);
|
||||
}
|
||||
|
||||
$fontpath = db_get_value_filter('value', 'tconfig', array('token' => 'fontpath'));
|
||||
$fontpath = io_safe_output(db_get_value_filter('value', 'tconfig', array('token' => 'fontpath')));
|
||||
if (($fontpath == "") OR (!file_exists ($fontpath))) {
|
||||
$config["alert_cnt"]++;
|
||||
$_SESSION["alert_msg"] .= ui_print_error_message(
|
||||
@ -1408,6 +1408,7 @@ function config_check () {
|
||||
$PHPmemory_limit = config_return_in_bytes(ini_get('memory_limit'));
|
||||
$PHPmax_execution_time = ini_get('max_execution_time');
|
||||
$PHPsafe_mode = ini_get('safe_mode');
|
||||
$PHPdisable_functions = ini_get('disable_functions');
|
||||
|
||||
if ($PHPsafe_mode === '1') {
|
||||
$config["alert_cnt"]++;
|
||||
@ -1452,6 +1453,15 @@ function config_check () {
|
||||
'message' => sprintf(__('Recommended value is: %s'), sprintf(__('%s or greater'), '500M')) . '<br><br>' . __('Please, change it on your PHP configuration file (php.ini) or contact with administrator'),
|
||||
'no_close' => true, 'force_style' => 'color: #000000 !important'), '', true);
|
||||
}
|
||||
|
||||
if (preg_match("/system/", $PHPdisable_functions) or preg_match("/exec/", $PHPdisable_functions)) {
|
||||
$config["alert_cnt"]++;
|
||||
$_SESSION["alert_msg"] .= ui_print_info_message(
|
||||
array('title' => __("Problems with disable functions in PHP.INI"),
|
||||
'message' => __("Variable disable_functions containts functions system() or exec(), in PHP configuration file (php.ini)"). '<br /><br />' .
|
||||
__('Please, change it on your PHP configuration file (php.ini) or contact with administrator (Dont forget restart apache process after changes)'),
|
||||
'no_close' => true, 'force_style' => 'color: #000000 !important'), '', true);
|
||||
}
|
||||
}
|
||||
|
||||
function config_return_in_bytes($val) {
|
||||
|
@ -1195,16 +1195,16 @@ function db_get_fields($table) {
|
||||
*/
|
||||
function db_search_in_history_db ($utimestamp) {
|
||||
global $config;
|
||||
|
||||
|
||||
$search_in_history_db = false;
|
||||
if ($config['history_db_enabled'] == 1) {
|
||||
$history_db_start_period = $config['history_db_days'] * SECONDS_1DAY;
|
||||
|
||||
|
||||
// If the date is newer than the newest history db data
|
||||
if (time() - $history_db_start_period >= $utimestamp)
|
||||
$search_in_history_db = true;
|
||||
}
|
||||
|
||||
|
||||
return $search_in_history_db;
|
||||
}
|
||||
|
||||
|
@ -1085,7 +1085,8 @@ function events_print_type_description ($type, $return = false) {
|
||||
*/
|
||||
function events_get_group_events ($id_group, $period, $date,
|
||||
$filter_event_validated = false, $filter_event_critical = false,
|
||||
$filter_event_warning = false, $filter_event_no_validated = false) {
|
||||
$filter_event_warning = false, $filter_event_no_validated = false,
|
||||
$filter_event_filter_search = false) {
|
||||
|
||||
global $config;
|
||||
|
||||
@ -1115,9 +1116,16 @@ function events_get_group_events ($id_group, $period, $date,
|
||||
if ($filter_event_no_validated) {
|
||||
$sql_where .= ' AND estado = 0 ';
|
||||
}
|
||||
|
||||
if (!empty($filter_event_filter_search)) {
|
||||
$sql_where .= ' AND (evento LIKE "%'. io_safe_input($filter_event_filter_search) . '%"'.
|
||||
' OR id_evento LIKE "%' . io_safe_input($filter_event_filter_search) . '%")';
|
||||
}
|
||||
|
||||
$sql_where .= sprintf(' AND id_grupo IN (%s) AND utimestamp > %d
|
||||
AND utimestamp <= %d ', implode (",", $id_group), $datelimit, $date);
|
||||
|
||||
|
||||
return events_get_events_grouped($sql_where, 0, 1000);
|
||||
}
|
||||
|
||||
@ -2403,7 +2411,9 @@ function events_clean_tags ($tags) {
|
||||
*/
|
||||
function events_get_count_events_by_agent ($id_group, $period, $date,
|
||||
$filter_event_validated = false, $filter_event_critical = false,
|
||||
$filter_event_warning = false, $filter_event_no_validated = false) {
|
||||
$filter_event_warning = false, $filter_event_no_validated = false,
|
||||
$filter_event_filter_search = null) {
|
||||
|
||||
global $config;
|
||||
|
||||
$id_group = groups_safe_acl ($config["id_user"], $id_group, "AR");
|
||||
@ -2434,6 +2444,11 @@ function events_get_count_events_by_agent ($id_group, $period, $date,
|
||||
$sql_where .= ' AND estado = 0 ';
|
||||
}
|
||||
|
||||
if (!empty($filter_event_filter_search)) {
|
||||
$sql_where .= ' AND (evento LIKE "%%'. io_safe_input($filter_event_filter_search) . '%%"'.
|
||||
' OR id_evento LIKE "%%' . io_safe_input($filter_event_filter_search) . '%%")';
|
||||
}
|
||||
|
||||
$sql = sprintf ('SELECT id_agente,
|
||||
(SELECT t2.nombre
|
||||
FROM tagente AS t2
|
||||
@ -2475,7 +2490,9 @@ function events_get_count_events_by_agent ($id_group, $period, $date,
|
||||
*/
|
||||
function events_get_count_events_validated_by_user ($filter, $period, $date,
|
||||
$filter_event_validated = false, $filter_event_critical = false,
|
||||
$filter_event_warning = false, $filter_event_no_validated = false) {
|
||||
$filter_event_warning = false, $filter_event_no_validated = false,
|
||||
$filter_event_filter_search = null) {
|
||||
|
||||
global $config;
|
||||
|
||||
$sql_filter = ' AND 1=1 ';
|
||||
@ -2516,6 +2533,11 @@ function events_get_count_events_validated_by_user ($filter, $period, $date,
|
||||
$sql_where .= ' AND estado = 0 ';
|
||||
}
|
||||
|
||||
if (!empty($filter_event_filter_search)) {
|
||||
$sql_where .= ' AND (evento LIKE "%%'. io_safe_input($filter_event_filter_search) . '%%"'.
|
||||
' OR id_evento LIKE "%%' . io_safe_input($filter_event_filter_search) . '%%")';
|
||||
}
|
||||
|
||||
$sql = sprintf ('SELECT id_usuario,
|
||||
(SELECT t2.fullname
|
||||
FROM tusuario AS t2
|
||||
@ -2557,7 +2579,9 @@ function events_get_count_events_validated_by_user ($filter, $period, $date,
|
||||
*/
|
||||
function events_get_count_events_by_criticity ($filter, $period, $date,
|
||||
$filter_event_validated = false, $filter_event_critical = false,
|
||||
$filter_event_warning = false, $filter_event_no_validated = false) {
|
||||
$filter_event_warning = false, $filter_event_no_validated = false,
|
||||
$filter_event_filter_search = null) {
|
||||
|
||||
global $config;
|
||||
|
||||
$sql_filter = ' AND 1=1 ';
|
||||
@ -2598,6 +2622,11 @@ function events_get_count_events_by_criticity ($filter, $period, $date,
|
||||
$sql_where .= ' AND estado = 0 ';
|
||||
}
|
||||
|
||||
if (!empty($filter_event_filter_search)) {
|
||||
$sql_where .= ' AND (evento LIKE "%%'. io_safe_input($filter_event_filter_search) . '%%"'.
|
||||
' OR id_evento LIKE "%%' . io_safe_input($filter_event_filter_search) . '%%")';
|
||||
}
|
||||
|
||||
$sql = sprintf ('SELECT criticity,
|
||||
COUNT(*) AS count
|
||||
FROM tevento
|
||||
@ -2632,7 +2661,9 @@ function events_get_count_events_by_criticity ($filter, $period, $date,
|
||||
*/
|
||||
function events_get_count_events_validated ($filter, $period, $date,
|
||||
$filter_event_validated = false, $filter_event_critical = false,
|
||||
$filter_event_warning = false, $filter_event_no_validated = false) {
|
||||
$filter_event_warning = false, $filter_event_no_validated = false,
|
||||
$filter_event_filter_search = null) {
|
||||
|
||||
global $config;
|
||||
|
||||
$sql_filter = ' AND 1=1 ';
|
||||
@ -2673,6 +2704,11 @@ function events_get_count_events_validated ($filter, $period, $date,
|
||||
$sql_where .= ' AND estado = 0 ';
|
||||
}
|
||||
|
||||
if (!empty($filter_event_filter_search)) {
|
||||
$sql_where .= ' AND (evento LIKE "%%'. io_safe_input($filter_event_filter_search) . '%%"'.
|
||||
' OR id_evento LIKE "%%' . io_safe_input($filter_event_filter_search) . '%%")';
|
||||
}
|
||||
|
||||
$sql = sprintf ('SELECT estado,
|
||||
COUNT(*) AS count
|
||||
FROM tevento
|
||||
|
@ -705,8 +705,8 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
|
||||
}*/
|
||||
|
||||
if ($show_unknown) {
|
||||
$legend['unknown'.$series_suffix] = __('Unknown').$series_suffix_str;
|
||||
$chart_extra_data['legend_unknown'] = $legend['unknown'.$series_suffix_str];
|
||||
$legend['unknown' . $series_suffix] = __('Unknown') . $series_suffix_str;
|
||||
$chart_extra_data['legend_unknown'] = $legend['unknown' . $series_suffix_str];
|
||||
}
|
||||
}
|
||||
|
||||
@ -721,7 +721,6 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
|
||||
global $config;
|
||||
global $graphic_type;
|
||||
|
||||
|
||||
$flash_chart = $config['flash_charts'];
|
||||
|
||||
enterprise_include_once("include/functions_reporting.php");
|
||||
@ -1383,7 +1382,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
||||
$height, $color, $module_name_list, $long_index,
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], $fixed_font_size,
|
||||
"", $ttl, $homeurl, $background_color);
|
||||
$unit, $ttl, $homeurl, $background_color);
|
||||
break;
|
||||
case CUSTOM_GRAPH_STACKED_LINE:
|
||||
return stacked_line_graph($flash_charts, $graph_values,
|
||||
@ -1555,10 +1554,14 @@ function graph_agent_status ($id_agent = false, $width = 300, $height = 200, $re
|
||||
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
|
||||
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
||||
|
||||
$colors = array(COL_CRITICAL, COL_WARNING, COL_NORMAL, COL_UNKNOWN);
|
||||
//$colors = array(COL_CRITICAL, COL_WARNING, COL_NORMAL, COL_UNKNOWN);
|
||||
$colors[__('Critical')] = COL_CRITICAL;
|
||||
$colors[__('Warning')] = COL_WARNING;
|
||||
$colors[__('Normal')] = COL_NORMAL;
|
||||
$colors[__('Unknown')] = COL_UNKNOWN;
|
||||
|
||||
if ($show_not_init) {
|
||||
$colors[] = COL_NOTINIT;
|
||||
$colors[__('Not init')] = COL_NOTINIT;
|
||||
}
|
||||
|
||||
if (array_sum($data) == 0) {
|
||||
@ -2831,6 +2834,7 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
|
||||
if ($uncompressed_module) {
|
||||
$avg_only = 1;
|
||||
}
|
||||
$search_in_history_db = db_search_in_history_db($datelimit);
|
||||
|
||||
// Get event data (contains alert data too)
|
||||
if ($show_unknown == 1 || $show_events == 1 || $show_alerts == 1) {
|
||||
@ -2861,7 +2865,7 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
|
||||
"utimestamp > $datelimit",
|
||||
"utimestamp < $date",
|
||||
'order' => 'utimestamp ASC'),
|
||||
array ('datos', 'utimestamp'));
|
||||
array ('datos', 'utimestamp'), 'AND', $search_in_history_db);
|
||||
if ($data === false) {
|
||||
$data = array ();
|
||||
}
|
||||
@ -3542,6 +3546,7 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events,
|
||||
if ($uncompressed_module) {
|
||||
$avg_only = 1;
|
||||
}
|
||||
$search_in_history_db = db_search_in_history_db($datelimit);
|
||||
|
||||
// Get event data (contains alert data too)
|
||||
if ($show_events == 1 || $show_alerts == 1) {
|
||||
@ -3562,7 +3567,7 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events,
|
||||
"utimestamp > $datelimit",
|
||||
"utimestamp < $date",
|
||||
'order' => 'utimestamp ASC'),
|
||||
array ('datos', 'utimestamp'));
|
||||
array ('datos', 'utimestamp'), 'AND', $search_in_history_db);
|
||||
if ($data === false) {
|
||||
$data = array ();
|
||||
}
|
||||
|
@ -1355,6 +1355,118 @@ function modules_get_moduletypes ($type = "all", $rows = "nombre") {
|
||||
return $return;
|
||||
}
|
||||
|
||||
function modules_get_first_contact_date($id_agent_module) {
|
||||
global $config;
|
||||
|
||||
// TODO REMOVE THE TIME IN PLANNED DOWNTIME
|
||||
|
||||
// TODO FOR OTHER KIND OF DATA
|
||||
|
||||
$sql = "
|
||||
SELECT utimestamp
|
||||
FROM tagente_datos
|
||||
WHERE id_agente_modulo = " . (int)($id_agent_module) . "
|
||||
ORDER BY utimestamp ASC
|
||||
LIMIT 1";
|
||||
|
||||
$first_date = db_get_sql($sql, 0, $config['history_db_enabled']);
|
||||
|
||||
return $first_date;
|
||||
}
|
||||
|
||||
function modules_get_count_datas($id_agent_module, $date_init, $date_end) {
|
||||
$interval = modules_get_interval ($id_agent_module);
|
||||
|
||||
// TODO REMOVE THE TIME IN PLANNED DOWNTIME
|
||||
|
||||
if (!is_numeric($date_init)) {
|
||||
$date_init = strtotime($date_init);
|
||||
}
|
||||
|
||||
if (!is_numeric($date_end)) {
|
||||
$date_end = strtotime($date_end);
|
||||
}
|
||||
|
||||
$first_date = modules_get_first_contact_date($id_agent_module);
|
||||
|
||||
if ($date_init < $first_date) {
|
||||
$date_init = $first_date;
|
||||
}
|
||||
|
||||
$diff = $date_end - $date_init;
|
||||
|
||||
return ($diff / $interval);
|
||||
}
|
||||
|
||||
function modules_get_data_with_value($id_agent_module, $date_init,
|
||||
$date_end, $value, $split_interval = false) {
|
||||
|
||||
global $config;
|
||||
|
||||
// TODO REMOVE THE TIME IN PLANNED DOWNTIME
|
||||
|
||||
// TODO FOR OTHER KIND OF DATA
|
||||
|
||||
if (!is_numeric($date_init)) {
|
||||
$date_init = strtotime($date_init);
|
||||
}
|
||||
|
||||
if (!is_numeric($date_end)) {
|
||||
$date_end = strtotime($date_end);
|
||||
}
|
||||
|
||||
$sql = "
|
||||
SELECT *
|
||||
FROM tagente_datos
|
||||
WHERE
|
||||
datos = " . (int)$value . "
|
||||
AND id_agente_modulo = " . (int)$id_agent_module . "
|
||||
AND (utimestamp >= " . $date_init . " AND utimestamp <= " . $date_end . ")";
|
||||
|
||||
$data = db_get_all_rows_sql($sql,
|
||||
$config['history_db_enabled']);
|
||||
|
||||
if (empty($data)) {
|
||||
$data = array();
|
||||
}
|
||||
|
||||
if ($split_interval) {
|
||||
$temp = array();
|
||||
$previous_utimestamp = false;
|
||||
foreach ($data as $row) {
|
||||
if ($previous_utimestamp === false) {
|
||||
$previous_utimestamp = $row['utimestamp'];
|
||||
|
||||
$temp[] = $row;
|
||||
}
|
||||
else {
|
||||
$diff = $row['utimestamp'] - $previous_utimestamp;
|
||||
|
||||
$interval = modules_get_interval($id_agent_module);
|
||||
|
||||
if ($diff > $interval) {
|
||||
$fake_count = (int)($diff / $interval);
|
||||
|
||||
$fake = $row;
|
||||
for ($iterator = 1; $iterator <= $fake_count; $iterator++) {
|
||||
$fake['utimestamp'] = $previous_utimestamp + ($iterator * $interval);
|
||||
$temp[] = $fake;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$temp[] = $row;
|
||||
}
|
||||
|
||||
$previous_utimestamp = $row['utimestamp'];
|
||||
|
||||
$data = $temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the interval value of an agent module.
|
||||
*
|
||||
@ -1519,8 +1631,10 @@ function modules_get_previous_data ($id_agent_module, $utimestamp = 0, $string =
|
||||
ORDER BY utimestamp DESC',
|
||||
$id_agent_module, $utimestamp, $utimestamp - SECONDS_2DAY);
|
||||
|
||||
|
||||
|
||||
$search_in_history_db = db_search_in_history_db($utimestamp);
|
||||
|
||||
|
||||
return db_get_row_sql ($sql, $search_in_history_db);
|
||||
}
|
||||
|
||||
@ -1554,7 +1668,7 @@ function modules_get_next_data ($id_agent_module, $utimestamp = 0, $string = 0)
|
||||
$id_agent_module, $utimestamp + $interval, $utimestamp);
|
||||
|
||||
$search_in_history_db = db_search_in_history_db($utimestamp);
|
||||
|
||||
|
||||
return db_get_row_sql ($sql, $search_in_history_db);
|
||||
}
|
||||
|
||||
@ -1631,6 +1745,23 @@ function modules_get_agentmodule_data ($id_agent_module, $period,
|
||||
$values[$key]["agent_name"] = $agent_name;
|
||||
}
|
||||
|
||||
if ($search_in_history_db) {
|
||||
$datos = array();
|
||||
foreach ($values as $key => $value) {
|
||||
$utimestamp[$key] = $value['utimestamp'];
|
||||
}
|
||||
|
||||
array_multisort($utimestamp, SORT_DESC, $values);
|
||||
foreach ($utimestamp as $key => $utimes) {
|
||||
$datos[$key] = array('utimestamp'=>$utimes,
|
||||
'data'=>$values[$key]["data"],
|
||||
'module_name'=>$values[$key]["module_name"],
|
||||
'agent_id'=>$values[$key]["agent_id"],
|
||||
'agent_name'=>$values[$key]["agent_name"]
|
||||
);
|
||||
}
|
||||
$values = $datos;
|
||||
}
|
||||
return $values;
|
||||
}
|
||||
|
||||
|
@ -1103,6 +1103,12 @@ function netflow_draw_item ($start_date, $end_date, $interval_length, $type, $fi
|
||||
$aggregate = $filter['aggregate'];
|
||||
$unit = $filter['output'];
|
||||
$interval = $end_date - $start_date;
|
||||
if (defined ('METACONSOLE')) {
|
||||
$width = 950;
|
||||
} else {
|
||||
$width = 850;
|
||||
}
|
||||
$height = 320;
|
||||
|
||||
// Process item
|
||||
switch ($type) {
|
||||
@ -1119,7 +1125,8 @@ function netflow_draw_item ($start_date, $end_date, $interval_length, $type, $fi
|
||||
if ($interval_length != 0) {
|
||||
$html .= " <b>" . _('Resolution') . ":</b> $interval_length " . __('seconds');
|
||||
}
|
||||
$html .= graph_netflow_aggregate_area ($data, $interval, 850, 320, netflow_format_unit ($unit));
|
||||
|
||||
$html .= graph_netflow_aggregate_area ($data, $interval, $width, $height, netflow_format_unit ($unit));
|
||||
return $html;
|
||||
}
|
||||
else if ($output == 'PDF') {
|
||||
@ -1128,7 +1135,7 @@ function netflow_draw_item ($start_date, $end_date, $interval_length, $type, $fi
|
||||
if ($interval_length != 0) {
|
||||
$html .= " <b>" . _('Resolution') . ":</b> $interval_length " . __('seconds');
|
||||
}
|
||||
$html .= graph_netflow_aggregate_area ($data, $interval, 850, 320, netflow_format_unit ($unit), 2, true);
|
||||
$html .= graph_netflow_aggregate_area ($data, $interval, $width, $height, netflow_format_unit ($unit), 2, true);
|
||||
return $html;
|
||||
}
|
||||
else if ($output == 'XML') {
|
||||
|
@ -400,6 +400,7 @@ function reporting_get_agentmodule_data_sum ($id_agent_module,
|
||||
return $total;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get SLA of a module.
|
||||
*
|
||||
@ -416,7 +417,7 @@ function reporting_get_agentmodule_data_sum ($id_agent_module,
|
||||
* @return float SLA percentage of the requested module. False if no data were
|
||||
* found
|
||||
*/
|
||||
function reporting_get_agentmodule_sla ($id_agent_module, $period = 0, $min_value = 1, $max_value = false, $date = 0, $daysWeek = null, $timeFrom = null, $timeTo = null) {
|
||||
function reporting_get_agentmodule_sla_day ($id_agent_module, $period = 0, $min_value = 1, $max_value = false, $date = 0, $daysWeek = null, $timeFrom = null, $timeTo = null) {
|
||||
global $config;
|
||||
|
||||
if (empty($id_agent_module))
|
||||
@ -494,6 +495,7 @@ function reporting_get_agentmodule_sla ($id_agent_module, $period = 0, $min_valu
|
||||
|
||||
// Get previous data
|
||||
$previous_data = modules_get_previous_data ($id_agent_module, $datelimit);
|
||||
|
||||
if ($previous_data !== false) {
|
||||
$previous_data['utimestamp'] = $datelimit;
|
||||
array_unshift ($interval_data, $previous_data);
|
||||
@ -501,6 +503,7 @@ function reporting_get_agentmodule_sla ($id_agent_module, $period = 0, $min_valu
|
||||
|
||||
// Get next data
|
||||
$next_data = modules_get_next_data ($id_agent_module, $date);
|
||||
|
||||
if ($next_data !== false) {
|
||||
$next_data['utimestamp'] = $date;
|
||||
array_push ($interval_data, $next_data);
|
||||
@ -541,6 +544,8 @@ function reporting_get_agentmodule_sla ($id_agent_module, $period = 0, $min_valu
|
||||
$previous_status = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
foreach ($interval_data as $data) {
|
||||
// Previous status was critical
|
||||
if ($previous_status == 1) {
|
||||
@ -570,6 +575,226 @@ function reporting_get_agentmodule_sla ($id_agent_module, $period = 0, $min_valu
|
||||
// Return the percentage of SLA compliance
|
||||
return (float) (100 - ($bad_period / $period) * 100);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get SLA of a module.
|
||||
*
|
||||
* @param int Agent module to calculate SLA
|
||||
* @param int Period to check the SLA compliance.
|
||||
* @param int Minimum data value the module in the right interval
|
||||
* @param int Maximum data value the module in the right interval. False will
|
||||
* ignore max value
|
||||
* @param int Beginning date of the report in UNIX time (current date by default).
|
||||
* @param array $dayWeek Array of days week to extract as array('monday' => false, 'tuesday' => true....), and by default is null.
|
||||
* @param string $timeFrom Time in the day to start to extract in mysql format, by default null.
|
||||
* @param string $timeTo Time in the day to end to extract in mysql format, by default null.
|
||||
*
|
||||
* @return float SLA percentage of the requested module. False if no data were
|
||||
* found
|
||||
*/
|
||||
function reporting_get_agentmodule_sla ($id_agent_module, $period = 0,
|
||||
$min_value = 1, $max_value = false, $date = 0, $daysWeek = null,
|
||||
$timeFrom = null, $timeTo = null) {
|
||||
|
||||
global $config;
|
||||
|
||||
if (empty($id_agent_module))
|
||||
return false;
|
||||
|
||||
// Set initial conditions
|
||||
$bad_period = 0;
|
||||
// Limit date to start searching data
|
||||
$datelimit = $date - $period;
|
||||
$search_in_history_db = db_search_in_history_db($datelimit);
|
||||
|
||||
// Initialize variables
|
||||
if (empty ($date)) {
|
||||
$date = get_system_time ();
|
||||
}
|
||||
if ($daysWeek === null) {
|
||||
$daysWeek = array();
|
||||
}
|
||||
|
||||
|
||||
// Calculate the SLA for large time without hours
|
||||
if ($timeFrom == $timeTo) {
|
||||
// Get interval data
|
||||
$sql = sprintf ('SELECT *
|
||||
FROM tagente_datos
|
||||
WHERE id_agente_modulo = %d
|
||||
AND utimestamp > %d AND utimestamp <= %d',
|
||||
$id_agent_module, $datelimit, $date);
|
||||
|
||||
//Add the working times (mon - tue - wed ...) and from time to time
|
||||
$days = array();
|
||||
//Translate to mysql week days
|
||||
if ($daysWeek) {
|
||||
foreach ($daysWeek as $key => $value) {
|
||||
if (!$value) {
|
||||
if ($key == 'monday') {
|
||||
$days[] = 2;
|
||||
}
|
||||
if ($key == 'tuesday') {
|
||||
$days[] = 3;
|
||||
}
|
||||
if ($key == 'wednesday') {
|
||||
$days[] = 4;
|
||||
}
|
||||
if ($key == 'thursday') {
|
||||
$days[] = 5;
|
||||
}
|
||||
if ($key == 'friday') {
|
||||
$days[] = 6;
|
||||
}
|
||||
if ($key == 'saturday') {
|
||||
$days[] = 7;
|
||||
}
|
||||
if ($key == 'sunday') {
|
||||
$days[] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count($days) > 0) {
|
||||
$sql .= ' AND DAYOFWEEK(FROM_UNIXTIME(utimestamp)) NOT IN (' . implode(',', $days) . ')';
|
||||
}
|
||||
|
||||
$sql .= "\n";
|
||||
$sql .= ' ORDER BY utimestamp ASC';
|
||||
$interval_data = db_get_all_rows_sql ($sql, $search_in_history_db);
|
||||
|
||||
if ($interval_data === false) {
|
||||
$interval_data = array ();
|
||||
}
|
||||
|
||||
// Calculate planned downtime dates
|
||||
$downtime_dates = reporting_get_planned_downtimes_intervals($id_agent_module, $datelimit, $date);
|
||||
|
||||
// Get previous data
|
||||
$previous_data = modules_get_previous_data ($id_agent_module, $datelimit);
|
||||
|
||||
if ($previous_data !== false) {
|
||||
$previous_data['utimestamp'] = $datelimit;
|
||||
array_unshift ($interval_data, $previous_data);
|
||||
}
|
||||
|
||||
// Get next data
|
||||
$next_data = modules_get_next_data ($id_agent_module, $date);
|
||||
|
||||
if ($next_data !== false) {
|
||||
$next_data['utimestamp'] = $date;
|
||||
array_push ($interval_data, $next_data);
|
||||
}
|
||||
else if (count ($interval_data) > 0) {
|
||||
// Propagate the last known data to the end of the interval
|
||||
$next_data = array_pop ($interval_data);
|
||||
array_push ($interval_data, $next_data);
|
||||
$next_data['utimestamp'] = $date;
|
||||
array_push ($interval_data, $next_data);
|
||||
}
|
||||
|
||||
if (count ($interval_data) < 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$first_data = array_shift ($interval_data);
|
||||
|
||||
// Do not count the empty start of an interval as 0
|
||||
if ($first_data['utimestamp'] != $datelimit) {
|
||||
$period = $date - $first_data['utimestamp'];
|
||||
}
|
||||
|
||||
$previous_utimestamp = $first_data['utimestamp'];
|
||||
if ((($max_value > $min_value AND ($first_data['datos'] > $max_value OR $first_data['datos'] < $min_value))) OR
|
||||
($max_value <= $min_value AND $first_data['datos'] < $min_value)) {
|
||||
|
||||
$previous_status = 1;
|
||||
foreach ($downtime_dates as $date_dt) {
|
||||
if (($date_dt['date_from'] <= $previous_utimestamp) AND ($date_dt['date_to'] >= $previous_utimestamp)) {
|
||||
$previous_status = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$previous_status = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
foreach ($interval_data as $data) {
|
||||
// Previous status was critical
|
||||
if ($previous_status == 1) {
|
||||
$bad_period += $data['utimestamp'] - $previous_utimestamp;
|
||||
}
|
||||
|
||||
if (array_key_exists('datos', $data)) {
|
||||
// Re-calculate previous status for the next data
|
||||
if ((($max_value > $min_value AND ($data['datos'] > $max_value OR $data['datos'] < $min_value))) OR
|
||||
($max_value <= $min_value AND $data['datos'] < $min_value)) {
|
||||
|
||||
$previous_status = 1;
|
||||
foreach ($downtime_dates as $date_dt) {
|
||||
if (($date_dt['date_from'] <= $data['utimestamp']) AND ($date_dt['date_to'] >= $data['utimestamp'])) {
|
||||
$previous_status = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$previous_status = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$previous_utimestamp = $data['utimestamp'];
|
||||
}
|
||||
|
||||
// Return the percentage of SLA compliance
|
||||
return (float) (100 - ($bad_period / $period) * 100);
|
||||
}
|
||||
elseif ($period <= SECONDS_1DAY) {
|
||||
|
||||
|
||||
return reporting_get_agentmodule_sla_day(
|
||||
$id_agent_module,
|
||||
$period,
|
||||
$min_value,
|
||||
$max_value,
|
||||
$date,
|
||||
$daysWeek,
|
||||
$timeFrom,
|
||||
$timeTo);
|
||||
}
|
||||
else {
|
||||
// Extract the data each day
|
||||
|
||||
$sla = 0;
|
||||
|
||||
$i = 0;
|
||||
for ($interval = 0; $interval <= $period; $interval = $interval + SECONDS_1DAY) {
|
||||
$datelimit = $date - $interval;
|
||||
|
||||
$sla_day = reporting_get_agentmodule_sla(
|
||||
$id_agent_module,
|
||||
SECONDS_1DAY,
|
||||
$min_value,
|
||||
$max_value,
|
||||
$datelimit + $interval,
|
||||
$daysWeek,
|
||||
$timeFrom, $timeTo);
|
||||
|
||||
|
||||
$sla += $sla_day;
|
||||
$i++;
|
||||
}
|
||||
|
||||
$sla = $sla / $i;
|
||||
|
||||
return $sla;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Get several SLA data for an agentmodule within a period divided on subperiods
|
||||
*
|
||||
@ -3013,10 +3238,13 @@ function reporting_get_agents_detailed_event ($id_agents, $period = 0,
|
||||
function reporting_get_group_detailed_event ($id_group, $period = 0,
|
||||
$date = 0, $return = false, $html = true,
|
||||
$filter_event_validated = false, $filter_event_critical = false,
|
||||
$filter_event_warning = false, $filter_event_no_validated = false) {
|
||||
|
||||
$filter_event_warning = false, $filter_event_no_validated = false,
|
||||
$filter_event_filter_search = null) {
|
||||
|
||||
global $config;
|
||||
|
||||
|
||||
|
||||
if (!is_numeric ($date)) {
|
||||
$date = strtotime ($date);
|
||||
}
|
||||
@ -3043,7 +3271,8 @@ function reporting_get_group_detailed_event ($id_group, $period = 0,
|
||||
|
||||
$events = events_get_group_events($id_group, $period, $date,
|
||||
$filter_event_validated, $filter_event_critical,
|
||||
$filter_event_warning, $filter_event_no_validated);
|
||||
$filter_event_warning, $filter_event_no_validated,
|
||||
$filter_event_filter_search);
|
||||
|
||||
if ($events) {
|
||||
$note = '';
|
||||
@ -3419,6 +3648,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||
$sizem = '1.5';
|
||||
$sizgraph_w = '450';
|
||||
$sizgraph_h = '100';
|
||||
|
||||
$sla_width = '250';
|
||||
}
|
||||
else {
|
||||
$sizem = '3';
|
||||
@ -3505,12 +3736,29 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||
|
||||
$urlImage = ui_get_full_url(false, false, false, false);
|
||||
|
||||
$data[0] = grafico_modulo_string ($content['id_agent_module'], $content['period'],
|
||||
false, $sizgraph_w, $sizgraph_h, '', '', false, $only_avg, false,
|
||||
$report["datetime"], $only_image, $urlImage);
|
||||
$data[0] = grafico_modulo_string (
|
||||
$content['id_agent_module'],
|
||||
$content['period'],
|
||||
false,
|
||||
$sizgraph_w,
|
||||
$sizgraph_h,
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
$only_avg,
|
||||
false,
|
||||
$report["datetime"],
|
||||
$only_image,
|
||||
$urlImage);
|
||||
|
||||
}
|
||||
else {
|
||||
// HACK it is saved in show_graph field.
|
||||
$time_compare_overlapped = false;
|
||||
if ($content['show_graph']) {
|
||||
$time_compare_overlapped = 'overlapped';
|
||||
}
|
||||
|
||||
|
||||
$data[0] = grafico_modulo_sparse(
|
||||
$content['id_agent_module'],
|
||||
@ -3533,7 +3781,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||
1,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
$time_compare_overlapped,
|
||||
true);
|
||||
}
|
||||
|
||||
@ -3652,11 +3900,35 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||
array_push ($table->data, $data_desc);
|
||||
}
|
||||
|
||||
// HACK it is saved in show_graph field.
|
||||
$time_compare_overlapped = false;
|
||||
if ($content['show_graph']) {
|
||||
$time_compare_overlapped = 'overlapped';
|
||||
}
|
||||
|
||||
$data = array ();
|
||||
$data[0] = grafico_modulo_sparse($content['id_agent_module'], $content['period'],
|
||||
false, $sizgraph_w, $sizgraph_h, '', '', false, true, true,
|
||||
$report["datetime"], '', true, 0, true, $only_image,
|
||||
ui_get_full_url(false, false, false, false));
|
||||
$data[0] = grafico_modulo_sparse(
|
||||
$content['id_agent_module'],
|
||||
$content['period'],
|
||||
false,
|
||||
$sizgraph_w,
|
||||
$sizgraph_h,
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
$report["datetime"],
|
||||
'',
|
||||
true,
|
||||
0,
|
||||
true,
|
||||
only_image,
|
||||
ui_get_full_url(false, false, false, false),
|
||||
1,
|
||||
false,
|
||||
'',
|
||||
$time_compare_overlapped);
|
||||
|
||||
/*$data[0] = graphic_combined_module(
|
||||
$modules,
|
||||
@ -4238,9 +4510,21 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||
$dataslice[0] .= "<br>";
|
||||
$dataslice[0] .= modules_get_agentmodule_name ($sla['id_agent_module']);
|
||||
|
||||
$dataslice[1] = graph_sla_slicebar ($sla['id_agent_module'], $content['period'],
|
||||
$sla['sla_min'], $sla['sla_max'], $report['datetime'], $content, $content['time_from'],
|
||||
$content['time_to'], 650, 25, $urlImage, 1, false, false);
|
||||
$dataslice[1] = graph_sla_slicebar (
|
||||
$sla['id_agent_module'],
|
||||
$content['period'],
|
||||
$sla['sla_min'],
|
||||
$sla['sla_max'],
|
||||
$report['datetime'],
|
||||
$content,
|
||||
$content['time_from'],
|
||||
$content['time_to'],
|
||||
$sla_width,
|
||||
25,
|
||||
$urlImage,
|
||||
1,
|
||||
false,
|
||||
false);
|
||||
|
||||
array_push ($tableslice->data, $dataslice);
|
||||
}
|
||||
@ -4759,6 +5043,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||
$filter_event_validated = $style['filter_event_validated'];
|
||||
$filter_event_critical = $style['filter_event_critical'];
|
||||
$filter_event_warning = $style['filter_event_warning'];
|
||||
$filter_event_filter_search = $style['event_filter_search'];
|
||||
|
||||
$event_graph_by_agent = $style['event_graph_by_agent'];
|
||||
$event_graph_by_user_validator = $style['event_graph_by_user_validator'];
|
||||
@ -4771,10 +5056,12 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||
$filter_event_validated,
|
||||
$filter_event_critical,
|
||||
$filter_event_warning,
|
||||
$filter_event_no_validated);
|
||||
if(!empty($data[0])) {
|
||||
$filter_event_no_validated,
|
||||
$filter_event_filter_search);
|
||||
|
||||
if (!empty($data[0])) {
|
||||
array_push ($table->data, $data);
|
||||
|
||||
|
||||
$table->colspan[$next_row][0] = 3;
|
||||
$next_row++;
|
||||
}
|
||||
@ -4786,7 +5073,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||
$filter_event_validated,
|
||||
$filter_event_critical,
|
||||
$filter_event_warning,
|
||||
$filter_event_no_validated);
|
||||
$filter_event_no_validated,
|
||||
$filter_event_filter_search);
|
||||
|
||||
$table_event_graph = null;
|
||||
$table_event_graph->width = '100%';
|
||||
@ -4812,7 +5100,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||
$filter_event_validated,
|
||||
$filter_event_critical,
|
||||
$filter_event_warning,
|
||||
$filter_event_no_validated);
|
||||
$filter_event_no_validated,
|
||||
$filter_event_filter_search);
|
||||
|
||||
$table_event_graph = null;
|
||||
$table_event_graph->head[0] = __('Events validated by user');
|
||||
@ -4838,7 +5127,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||
$filter_event_validated,
|
||||
$filter_event_critical,
|
||||
$filter_event_warning,
|
||||
$filter_event_no_validated);
|
||||
$filter_event_no_validated,
|
||||
$filter_event_filter_search);
|
||||
|
||||
$colors = get_criticity_pie_colors($data_graph);
|
||||
|
||||
@ -4866,7 +5156,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||
$filter_event_validated,
|
||||
$filter_event_critical,
|
||||
$filter_event_warning,
|
||||
$filter_event_no_validated);
|
||||
$filter_event_no_validated,
|
||||
$filter_event_filter_search);
|
||||
|
||||
$table_event_graph = null;
|
||||
$table_event_graph->head[0] = __('Amount events validated');
|
||||
@ -5311,6 +5602,311 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||
case 'network_interfaces_report':
|
||||
reporting_network_interfaces_table($content, $report, $mini, $item_title, $table);
|
||||
break;
|
||||
case 'availability':
|
||||
if (empty($item_title)) {
|
||||
$item_title = __('Availability');
|
||||
}
|
||||
reporting_header_content($mini, $content, $report, $table, $item_title);
|
||||
|
||||
// Put description at the end of the module (if exists)
|
||||
$table->colspan[1][0] = 3;
|
||||
if ($content["description"] != "") {
|
||||
$data_desc = array();
|
||||
$data_desc[0] = $content["description"];
|
||||
array_push($table->data, $data_desc);
|
||||
}
|
||||
|
||||
$sql = sprintf("
|
||||
SELECT id_agent_module,
|
||||
server_name, operation
|
||||
FROM treport_content_item
|
||||
WHERE id_report_content = %d",
|
||||
$content['id_rc']);
|
||||
|
||||
$items = db_process_sql ($sql);
|
||||
if (empty($items)) {
|
||||
$data = array ();
|
||||
$table->colspan[2][0] = 3;
|
||||
$data[0] =
|
||||
__('There are no Agent/Modules defined');
|
||||
array_push ($table->data, $data);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$data = array();
|
||||
|
||||
$avg = 0;
|
||||
$min = null;
|
||||
$min_text = "";
|
||||
$max = null;
|
||||
$max_text = "";
|
||||
$count = 0;
|
||||
foreach ($items as $item) {
|
||||
//aaMetaconsole connection
|
||||
$server_name = $item ['server_name'];
|
||||
if (($config ['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) {
|
||||
$connection = metaconsole_get_connection($server_name);
|
||||
if (metaconsole_load_external_db($connection) != NOERR) {
|
||||
//ui_print_error_message ("Error connecting to ".$server_name);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (modules_is_disable_agent($item['id_agent_module'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$row = array();
|
||||
|
||||
$text = "";
|
||||
|
||||
// HACK it is saved in show_graph field.
|
||||
// Show interfaces instead the modules
|
||||
if ($content['show_graph']) {
|
||||
$text = $row['ip_address'] = agents_get_address(
|
||||
modules_get_agentmodule_agent($item['id_agent_module']));
|
||||
}
|
||||
else {
|
||||
$text = $row['module'] = modules_get_agentmodule_name(
|
||||
$item['id_agent_module']);
|
||||
}
|
||||
$row['agent'] = modules_get_agentmodule_agent_name(
|
||||
$item['id_agent_module']);
|
||||
|
||||
$text = $row['agent'] . " (" . $text . ")";
|
||||
|
||||
|
||||
$monitor_value = reporting_get_agentmodule_sla(
|
||||
$item['id_agent_module'],
|
||||
$content['period'],
|
||||
1,
|
||||
false,
|
||||
$report["datetime"]);
|
||||
|
||||
if ($monitor_value === false) {
|
||||
$row['checks'] = __('Unknown');
|
||||
$row['failed'] = __('Unknown');
|
||||
$row['fail'] = __('Unknown');
|
||||
$row['poling_time'] = __('Unknown');
|
||||
$row['time_unavaliable'] = __('Unknown');
|
||||
$row['ok'] = __('Unknown');
|
||||
}
|
||||
else {
|
||||
$count_checks = modules_get_count_datas(
|
||||
$item['id_agent_module'],
|
||||
$report["datetime"] - $content['period'],
|
||||
$report["datetime"]);
|
||||
$count_fails = count(
|
||||
modules_get_data_with_value(
|
||||
$item['id_agent_module'],
|
||||
$report["datetime"] - $content['period'],
|
||||
$report["datetime"],
|
||||
0, true));
|
||||
$percent_ok = (($count_checks - $count_fails) * 100) / $count_checks;
|
||||
$percent_fail = 100 - $percent_ok;
|
||||
|
||||
$row['ok'] = format_numeric($percent_ok, 2) . " %";
|
||||
$row['fail'] = format_numeric($percent_fail, 2) . " %";
|
||||
$row['checks'] = format_numeric($count_checks, 2);
|
||||
$row['failed'] = format_numeric($count_fails ,2);
|
||||
$row['poling_time'] = human_time_description_raw(
|
||||
($count_checks - $count_fails) * modules_get_interval($item['id_agent_module']),
|
||||
true);
|
||||
$row['time_unavaliable'] = "-";
|
||||
if ($count_fails > 0) {
|
||||
$row['time_unavaliable'] = human_time_description_raw(
|
||||
$count_fails * modules_get_interval($item['id_agent_module']),
|
||||
true);
|
||||
}
|
||||
}
|
||||
|
||||
$data[] = $row;
|
||||
|
||||
|
||||
$avg = (($avg * $count) + $monitor_value) / ($count + 1);
|
||||
if (is_null($min)) {
|
||||
$min = $percent_ok;
|
||||
$min_text = $text;
|
||||
}
|
||||
else {
|
||||
if ($min > $percent_ok) {
|
||||
$min = $percent_ok;
|
||||
$min_text = $text;
|
||||
}
|
||||
}
|
||||
if (is_null($max)) {
|
||||
$max = $percent_ok;
|
||||
$max_text = $text;
|
||||
}
|
||||
else {
|
||||
if ($max < $percent_ok) {
|
||||
$max = $percent_ok;
|
||||
$max_text = $text;
|
||||
}
|
||||
}
|
||||
|
||||
//Restore dbconnection
|
||||
if (($config ['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
$count++;
|
||||
}
|
||||
|
||||
switch ($content['order_uptodown']) {
|
||||
case REPORT_ITEM_ORDER_BY_AGENT_NAME:
|
||||
$temp = array();
|
||||
foreach ($data as $row) {
|
||||
$i = 0;
|
||||
foreach ($temp as $t_row) {
|
||||
if (strcmp($row['agent'], $t_row['agent']) < 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
array_splice($temp, $i, 0, array($row));
|
||||
}
|
||||
|
||||
$data = $temp;
|
||||
break;
|
||||
case REPORT_ITEM_ORDER_BY_ASCENDING:
|
||||
$temp = array();
|
||||
foreach ($data as $row) {
|
||||
$i = 0;
|
||||
foreach ($temp as $t_row) {
|
||||
if ($content['show_graph']) {
|
||||
if (strcmp($row['ip_address'], $t_row['ip_address']) < 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (strcmp($row['module'], $t_row['module']) < 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
array_splice($temp, $i, 0, array($row));
|
||||
}
|
||||
|
||||
$data = $temp;
|
||||
break;
|
||||
case REPORT_ITEM_ORDER_BY_DESCENDING:
|
||||
$temp = array();
|
||||
foreach ($data as $row) {
|
||||
$i = 0;
|
||||
foreach ($temp as $t_row) {
|
||||
if ($content['show_graph']) {
|
||||
if (strcmp($row['ip_address'], $t_row['ip_address']) > 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (strcmp($row['module'], $t_row['module']) > 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
array_splice($temp, $i, 0, array($row));
|
||||
}
|
||||
|
||||
$data = $temp;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$table1->width = '99%';
|
||||
$table1->data = array ();
|
||||
$table1->head = array ();
|
||||
$table1->head[0] = __('Agent');
|
||||
// HACK it is saved in show_graph field.
|
||||
// Show interfaces instead the modules
|
||||
if ($content['show_graph']) {
|
||||
$table1->head[1] = __('IP Address');
|
||||
}
|
||||
else {
|
||||
$table1->head[1] = __('Module');
|
||||
}
|
||||
$table1->head[2] = __('# Checks');
|
||||
$table1->head[3] = __('# Failed');
|
||||
$table1->head[4] = __('% Fail');
|
||||
$table1->head[5] = __('Poling time');
|
||||
$table1->head[6] = __('Time unavailable');
|
||||
$table1->head[7] = __('% Ok');
|
||||
|
||||
$table1->style[0] = 'text-align: left';
|
||||
$table1->style[1] = 'text-align: left';
|
||||
$table1->style[2] = 'text-align: right';
|
||||
$table1->style[3] = 'text-align: right';
|
||||
$table1->style[4] = 'text-align: right';
|
||||
$table1->style[5] = 'text-align: right';
|
||||
$table1->style[6] = 'text-align: right';
|
||||
$table1->style[7] = 'text-align: right';
|
||||
|
||||
foreach ($data as $row) {
|
||||
$table_row = array();
|
||||
$table_row[] = $row['agent'];
|
||||
if ($content['show_graph']) {
|
||||
$table_row[] = $row['ip_address'];
|
||||
}
|
||||
else {
|
||||
$table_row[] = $row['module'];
|
||||
}
|
||||
$table_row[] = $row['checks'];
|
||||
$table_row[] = $row['failed'];
|
||||
$table_row[] = $row['fail'];
|
||||
$table_row[] = $row['poling_time'];
|
||||
$table_row[] = $row['time_unavaliable'];
|
||||
$table_row[] = $row['ok'];
|
||||
|
||||
$table1->data[] = $table_row;
|
||||
}
|
||||
|
||||
$table->colspan[2][0] = 3;
|
||||
$data = array();
|
||||
$data[0] = html_print_table($table1, true);
|
||||
array_push ($table->data, $data);
|
||||
|
||||
if ($content['show_resume']) {
|
||||
$table1->width = '99%';
|
||||
$table1->data = array ();
|
||||
$table1->head = array ();
|
||||
$table1->style = array();
|
||||
$table1->head['min_text'] = '';
|
||||
$table1->head['min'] = __('Min Value');
|
||||
$table1->head['avg'] = __('Average Value');
|
||||
$table1->head['max_text'] = '';
|
||||
$table1->head['max'] = __('Max Value');
|
||||
$table1->style['min_text'] = 'text-align: left';
|
||||
$table1->style['min'] = 'text-align: right';
|
||||
$table1->style['avg'] = 'text-align: right';
|
||||
$table1->style['max_text'] = 'text-align: left';
|
||||
$table1->style['max'] = 'text-align: right';
|
||||
|
||||
$table1->data[] = array(
|
||||
'min_text' => $min_text,
|
||||
'min' => format_numeric($min, 2) . "%",
|
||||
'avg' => format_numeric($avg, 2) . "%",
|
||||
'max_text' => $max_text,
|
||||
'max' => format_numeric($max, 2) . "%"
|
||||
);
|
||||
|
||||
$table->colspan[3][0] = 3;
|
||||
$data = array();
|
||||
$data[0] = html_print_table($table1, true);
|
||||
array_push ($table->data, $data);
|
||||
}
|
||||
break;
|
||||
case 'general':
|
||||
if (empty($item_title)) {
|
||||
$item_title = __('General');
|
||||
@ -5330,6 +5926,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||
array_push($table->data, $data_desc);
|
||||
}
|
||||
|
||||
|
||||
|
||||
switch ($group_by_agent) {
|
||||
//0 means not group by agent
|
||||
case 0:
|
||||
@ -7667,7 +8265,8 @@ function reporting_template_graphs_get_user ($id_user = 0, $only_names = false,
|
||||
function reporting_get_count_events_by_agent ($id_group, $period = 0,
|
||||
$date = 0,
|
||||
$filter_event_validated = false, $filter_event_critical = false,
|
||||
$filter_event_warning = false, $filter_event_no_validated = false) {
|
||||
$filter_event_warning = false, $filter_event_no_validated = false,
|
||||
$filter_event_filter_search = false) {
|
||||
|
||||
if (!is_numeric ($date)) {
|
||||
$date = strtotime ($date);
|
||||
@ -7678,7 +8277,8 @@ function reporting_get_count_events_by_agent ($id_group, $period = 0,
|
||||
|
||||
return events_get_count_events_by_agent($id_group, $period, $date,
|
||||
$filter_event_validated, $filter_event_critical,
|
||||
$filter_event_warning, $filter_event_no_validated);
|
||||
$filter_event_warning, $filter_event_no_validated,
|
||||
$filter_event_filter_search);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -7695,7 +8295,8 @@ function reporting_get_count_events_by_agent ($id_group, $period = 0,
|
||||
function reporting_get_count_events_validated_by_user ($filter, $period = 0,
|
||||
$date = 0,
|
||||
$filter_event_validated = false, $filter_event_critical = false,
|
||||
$filter_event_warning = false, $filter_event_no_validated = false) {
|
||||
$filter_event_warning = false, $filter_event_no_validated = false,
|
||||
$filter_event_filter_search = null) {
|
||||
|
||||
if (!is_numeric ($date)) {
|
||||
$date = strtotime ($date);
|
||||
@ -7706,7 +8307,8 @@ function reporting_get_count_events_validated_by_user ($filter, $period = 0,
|
||||
|
||||
return events_get_count_events_validated_by_user($filter, $period, $date,
|
||||
$filter_event_validated, $filter_event_critical,
|
||||
$filter_event_warning, $filter_event_no_validated);
|
||||
$filter_event_warning, $filter_event_no_validated,
|
||||
$filter_event_filter_search);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -7723,7 +8325,8 @@ function reporting_get_count_events_validated_by_user ($filter, $period = 0,
|
||||
function reporting_get_count_events_by_criticity ($filter, $period = 0,
|
||||
$date = 0,
|
||||
$filter_event_validated = false, $filter_event_critical = false,
|
||||
$filter_event_warning = false, $filter_event_no_validated = false) {
|
||||
$filter_event_warning = false, $filter_event_no_validated = false,
|
||||
$filter_event_filter_search = null) {
|
||||
|
||||
if (!is_numeric ($date)) {
|
||||
$date = strtotime ($date);
|
||||
@ -7734,7 +8337,8 @@ function reporting_get_count_events_by_criticity ($filter, $period = 0,
|
||||
|
||||
return events_get_count_events_by_criticity($filter, $period, $date,
|
||||
$filter_event_validated, $filter_event_critical,
|
||||
$filter_event_warning, $filter_event_no_validated);
|
||||
$filter_event_warning, $filter_event_no_validated,
|
||||
$filter_event_filter_search);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -7751,7 +8355,8 @@ function reporting_get_count_events_by_criticity ($filter, $period = 0,
|
||||
function reporting_get_count_events_validated ($filter, $period = 0,
|
||||
$date = 0,
|
||||
$filter_event_validated = false, $filter_event_critical = false,
|
||||
$filter_event_warning = false, $filter_event_no_validated = false) {
|
||||
$filter_event_warning = false, $filter_event_no_validated = false,
|
||||
$filter_event_filter_search = null) {
|
||||
|
||||
if (!is_numeric ($date)) {
|
||||
$date = strtotime ($date);
|
||||
@ -7762,7 +8367,8 @@ function reporting_get_count_events_validated ($filter, $period = 0,
|
||||
|
||||
return events_get_count_events_validated($filter, $period, $date,
|
||||
$filter_event_validated, $filter_event_critical,
|
||||
$filter_event_warning, $filter_event_no_validated);
|
||||
$filter_event_warning, $filter_event_no_validated,
|
||||
$filter_event_filter_search);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -576,7 +576,8 @@ function reports_get_report_types ($template = false, $not_editor = false) {
|
||||
'name' => __('Top n'));
|
||||
$types['network_interfaces_report'] = array('optgroup' => __('Grouped'),
|
||||
'name' => __('Network interfaces'));
|
||||
|
||||
$types['availability'] = array('optgroup' => __('Grouped'),
|
||||
'name' => __('Availability'));
|
||||
|
||||
|
||||
$types['text'] = array('optgroup' => __('Text/HTML '),
|
||||
|
@ -452,14 +452,14 @@ function treeview_printTable($id_agente, $server_data = array()) {
|
||||
|
||||
if ($config["agentaccess"]) {
|
||||
$access_graph = '<div style="width: 290px; margin-left: 30px;">';
|
||||
$access_graph .= graphic_agentaccess($id_agente, 290, 110, 86400, true);
|
||||
$access_graph .= graphic_agentaccess($id_agente, 290, 110, SECONDS_1DAY, true);
|
||||
$access_graph .= '</div><br>';
|
||||
|
||||
ui_toggle($access_graph, __('Agent access rate (24h)'));
|
||||
}
|
||||
|
||||
$events_graph = '<div style="width: 290px; height: 15px; margin-left: 30px; position: static;">';
|
||||
$events_graph .= graph_graphic_agentevents ($id_agente, 290, 15, 86400, '', true);
|
||||
$events_graph .= graph_graphic_agentevents ($id_agente, 290, 15, SECONDS_1DAY, '', true);
|
||||
$events_graph .= '</div><br><br>';
|
||||
|
||||
ui_toggle($events_graph, __('Events (24h)'));
|
||||
|
@ -137,7 +137,10 @@ function users_get_groups_for_select($id_user, $privilege = "AR", $returnAllGro
|
||||
*
|
||||
* @return array A list of the groups the user has certain privileges.
|
||||
*/
|
||||
function users_get_groups ($id_user = false, $privilege = "AR", $returnAllGroup = true, $returnAllColumns = false, $id_groups = null, $keys_field = 'id_grupo') {
|
||||
function users_get_groups ($id_user = false, $privilege = "AR",
|
||||
$returnAllGroup = true, $returnAllColumns = false, $id_groups = null,
|
||||
$keys_field = 'id_grupo') {
|
||||
|
||||
if (empty ($id_user)) {
|
||||
global $config;
|
||||
|
||||
@ -159,7 +162,7 @@ function users_get_groups ($id_user = false, $privilege = "AR", $returnAllGroup
|
||||
$groups = db_get_all_rows_filter('tgrupo', array('id_grupo' => $list_id_groups, 'order' => 'parent, nombre'));
|
||||
}
|
||||
else {
|
||||
$groups = db_get_all_rows_in_table ('tgrupo', 'parent, nombre');
|
||||
$groups = db_get_all_rows_in_table ('tgrupo', array('parent', 'nombre'));
|
||||
}
|
||||
|
||||
$user_groups = array ();
|
||||
|
@ -1237,6 +1237,7 @@ function visual_map_print_visual_map ($id_layout, $show_links = true,
|
||||
else
|
||||
echo '<div style="left: 0px; top: 0px; text-align: center; z-index: '.$z_index.'; '.($layout_data['label_color'][0] == '#' ? 'color: '.$layout_data['label_color'].';' : '').' position: absolute; margin-left: '.$layout_data['pos_x'].'px; margin-top:'.$layout_data['pos_y'].'px;" id="layout-data-'.$layout_data['id'].'" class="layout-data">';
|
||||
|
||||
echo "<div style='width:150px'>";
|
||||
if ($show_links) {
|
||||
if ((!empty($layout_data['id_agent'])
|
||||
&& empty($layout_data['id_layout_linked']))
|
||||
@ -1412,7 +1413,7 @@ function visual_map_print_visual_map ($id_layout, $show_links = true,
|
||||
}
|
||||
echo "</div>";
|
||||
|
||||
echo "</a>";
|
||||
echo "</a> </div>";
|
||||
break;
|
||||
|
||||
|
||||
@ -2304,7 +2305,8 @@ function visual_map_create_internal_name_item($label = null, $type, $image, $age
|
||||
}
|
||||
|
||||
function visual_map_get_items_parents($idVisual) {
|
||||
$items = db_get_all_rows_filter('tlayout_data',array('id_layout' => $idVisual));
|
||||
$items = db_get_all_rows_sql(sprintf("SELECT * FROM tlayout_data where id_layout = %s order by label",$idVisual));
|
||||
//$items = db_get_all_fields_in_table('tlayout_data',array('id_layout' => $idVisual));
|
||||
if ($items == false) {
|
||||
$items = array();
|
||||
}
|
||||
|
@ -511,8 +511,8 @@ function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumul
|
||||
$('#extra_'+graph_id).text(from+'-'+to);
|
||||
var extra_height = parseInt($('#extra_'+graph_id).css('height').split('px')[0]);
|
||||
var extra_width = parseInt($('#extra_'+graph_id).css('width').split('px')[0]);
|
||||
$('#extra_'+graph_id).css('left',pos.pageX-(extra_width/2)+'px');
|
||||
$('#extra_'+graph_id).css('top',plot.offset().top-extra_height-5+'px');
|
||||
$('#extra_'+graph_id).css('left',pos.pageX-(extra_width/4)+'px');
|
||||
//$('#extra_'+graph_id).css('top',plot.offset().top-extra_height-5+'px');
|
||||
$('#extra_'+graph_id).show();
|
||||
}
|
||||
});
|
||||
@ -860,7 +860,7 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
|
||||
$('#timestamp_'+graph_id).text(labels_long[j]);
|
||||
}
|
||||
|
||||
$('#timestamp_'+graph_id).css('top', plot.offset().top-$('#timestamp_'+graph_id).height()*1.5);
|
||||
//$('#timestamp_'+graph_id).css('top', plot.offset().top-$('#timestamp_'+graph_id).height()*1.5);
|
||||
|
||||
var timesize = $('#timestamp_'+graph_id).width();
|
||||
|
||||
|
@ -69,6 +69,7 @@ if ((! file_exists ("include/config.php")) || (! is_readable ("include/config.ph
|
||||
session_start ();
|
||||
require_once ("include/config.php");
|
||||
|
||||
|
||||
// If metaconsole activated, redirect to it
|
||||
if ($config['metaconsole'] == 1 && $config['enterprise_installed'] == 1) {
|
||||
header ("Location: " . $config['homeurl'] . "enterprise/meta");
|
||||
@ -167,7 +168,7 @@ if (strlen($search) > 0) {
|
||||
$searchPage = true;
|
||||
}
|
||||
|
||||
// Login process
|
||||
// Login process
|
||||
if (! isset ($config['id_user']) && isset ($_GET["login"])) {
|
||||
include_once('include/functions_db.php'); //Include it to use escape_string_sql function
|
||||
|
||||
|
@ -63,7 +63,7 @@
|
||||
<div style='height: 10px'>
|
||||
<?php
|
||||
$version = '5.1SP2';
|
||||
$build = '150329';
|
||||
$build = '150514';
|
||||
$banner = "v$version Build $build";
|
||||
|
||||
error_reporting(0);
|
||||
|
@ -157,18 +157,6 @@ switch ($sortField) {
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'data':
|
||||
switch ($sort) {
|
||||
case 'up':
|
||||
$selectDataUp = $selected;
|
||||
$order = array('field' => 'tagente_estado.datos', 'order' => 'ASC');
|
||||
break;
|
||||
case 'down':
|
||||
$selectDataDown = $selected;
|
||||
$order = array('field' => 'tagente_estado.datos', 'order' => 'DESC');
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'last_contact':
|
||||
switch ($sort) {
|
||||
case 'up':
|
||||
@ -415,9 +403,7 @@ $table->head[5] = __('Status') . ' ' .
|
||||
'<a href="' . $url . '&sort_field=status&sort=up&refr=&filter_monitors=1&status_filter_monitor=' .$status_filter_monitor.' &status_text_monitor='. $status_text_monitor.'&status_module_group= '.$status_module_group.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectStatusUp, "alt" => "up")) . '</a>' .
|
||||
'<a href="' . $url . '&sort_field=status&sort=down&refr=&filter_monitors=1&status_filter_monitor=' .$status_filter_monitor.' &status_text_monitor='. $status_text_monitor.'&status_module_group= '.$status_module_group.'">' . html_print_image("images/sort_down.png", true, array("style" => $selectStatusDown, "alt" => "down")) . '</a>';
|
||||
$table->head[6] = __('Warn');
|
||||
$table->head[7] = __('Data') . ' ' .
|
||||
'<a href="' . $url . '&sort_field=data&sort=up&refr=&filter_monitors=1&status_filter_monitor=' .$status_filter_monitor.' &status_text_monitor='. $status_text_monitor.'&status_module_group= '.$status_module_group.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectDataUp, "alt" => "up")) . '</a>' .
|
||||
'<a href="' . $url . '&sort_field=data&sort=down&refr=&filter_monitors=1&status_filter_monitor=' .$status_filter_monitor.' &status_text_monitor='. $status_text_monitor.'&status_module_group= '.$status_module_group.'">' . html_print_image("images/sort_down.png", true, array("style" => $selectDataDown, "alt" => "down")) . '</a>';
|
||||
$table->head[7] = __('Data');
|
||||
$table->head[8] = __('Graph');
|
||||
$table->head[9] = __('Last contact') . ' ' .
|
||||
'<a href="' . $url . '&sort_field=last_contact&sort=up&refr=&filter_monitors=1&status_filter_monitor=' .$status_filter_monitor.' &status_text_monitor='. $status_text_monitor.'&status_module_group= '.$status_module_group.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectLastContactUp, "alt" => "up")) . '</a>' .
|
||||
|
@ -53,7 +53,16 @@ if (isset ($_GET["update_netgroup"])) {
|
||||
}
|
||||
|
||||
// Get group list that user has access
|
||||
$groups_full = users_get_groups ($config['id_user'], "AR", true, true);
|
||||
$groups_full = users_get_groups ($config['id_user'], "AR", true, true,
|
||||
null, 'id_grupo', true);
|
||||
|
||||
foreach ($groups_full as $i => $g) {
|
||||
if ($g['id_grupo'] == 0) {
|
||||
$groups_full[$i]['parent'] = -1;
|
||||
}
|
||||
}
|
||||
|
||||
$groups_full = sort_by_hierarchy($groups_full);
|
||||
|
||||
$groups = array();
|
||||
foreach ($groups_full as $group) {
|
||||
@ -140,5 +149,16 @@ else {
|
||||
"</div>";
|
||||
}
|
||||
|
||||
function sort_by_hierarchy($groups, $parent = -1) {
|
||||
$return = array();
|
||||
foreach ($groups as $g) {
|
||||
if ($g['parent'] == $parent) {
|
||||
$return[] = $g;
|
||||
|
||||
$return = array_merge($return, sort_by_hierarchy($groups, $g['id_grupo']));
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
?>
|
||||
|
||||
|
@ -167,7 +167,7 @@ $interface_traffic_modules = array(
|
||||
array_values($interface_traffic_modules),
|
||||
$config['homeurl'],
|
||||
array_keys($interface_traffic_modules),
|
||||
array_fill(0, count($interface_traffic_modules),"bytes/s"),
|
||||
array("bytes"),
|
||||
false);
|
||||
|
||||
echo '</div>';
|
||||
|
@ -645,22 +645,6 @@ switch ($sortField) {
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'data':
|
||||
switch ($sort) {
|
||||
case 'up':
|
||||
$selectDataUp = $selected;
|
||||
$order = array(
|
||||
'field' => 'tagente_estado.datos',
|
||||
'order' => 'ASC');
|
||||
break;
|
||||
case 'down':
|
||||
$selectDataDown = $selected;
|
||||
$order = array(
|
||||
'field' => 'tagente_estado.datos',
|
||||
'order' => 'DESC');
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'timestamp':
|
||||
switch ($sort) {
|
||||
case 'up':
|
||||
@ -975,11 +959,6 @@ $table->head[8] = __('Warn');
|
||||
$table->align[8] = "left";
|
||||
|
||||
$table->head[9] = __('Data');
|
||||
if (! defined ('METACONSOLE')) {
|
||||
$table->head[9] .= ' <a href="index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=' . $refr . '&offset=' . $offset . '&ag_group=' . $ag_group . '&ag_freestring=' . $ag_freestring . '&ag_modulename=' . $ag_modulename . '&status=' . $status . $ag_custom_fields_params . '&sort_field=data&sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectDataUp, "alt" => "up")) . '</a>' .
|
||||
'<a href="index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=' . $refr . '&offset=' . $offset . '&ag_group=' . $ag_group . '&ag_freestring=' . $ag_freestring . '&ag_modulename=' . $ag_modulename . '&status=' . $status . $ag_custom_fields_params . '&sort_field=data&sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectDataDown, "alt" => "down")) . '</a>';
|
||||
}
|
||||
|
||||
$table->align[9] = "left";
|
||||
|
||||
$table->head[10] = __('Timestamp');
|
||||
|
@ -246,7 +246,12 @@ if (is_ajax ()) {
|
||||
|
||||
foreach ($idAgents as $idA) {
|
||||
if (empty($metaconsole_server_name)) {
|
||||
$row = explode ('|', $idA);
|
||||
if (strstr($idA, "|@_@|")) {
|
||||
$row = explode ('|@_@|', $idA);
|
||||
}
|
||||
else {
|
||||
$row = explode ('|', $idA);
|
||||
}
|
||||
$server_name = $row[0];
|
||||
$id_agent = $row [1];
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ if (!empty($tag_with)) {
|
||||
foreach ($tag_with as $id_tag) {
|
||||
if ($first) $first = false;
|
||||
else $sql_post .= " OR ";
|
||||
$sql_post .= "tags = '" . tags_get_name($id_tag) . "'";
|
||||
$sql_post .= "tags LIKE ('%" . tags_get_name($id_tag) . "%')";
|
||||
}
|
||||
$sql_post .= ' ) ';
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ if ($layers != false) {
|
||||
break;
|
||||
case "oracle":
|
||||
$timestampLastOperation = db_get_value_sql(
|
||||
"SELECT ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (86400)) FROM dual");
|
||||
"SELECT ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (" . SECONDS_1DAY . ")) FROM dual");
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -90,6 +90,7 @@ $time = get_parameter_post ('time', date (TIME_FORMAT, get_system_time ()));
|
||||
$connection_name = get_parameter('connection_name', '');
|
||||
$interval_length = (int) get_parameter('interval_length', 300);
|
||||
$address_resolution = (int) get_parameter('address_resolution', $config['netflow_get_ip_hostname']);
|
||||
$filter_selected = (int) get_parameter('filter_selected', 0);
|
||||
|
||||
// Read buttons
|
||||
$draw = get_parameter('draw_button', '');
|
||||
@ -301,8 +302,9 @@ echo '<form method="post" action="' . $config['homeurl'] . 'index.php?sec=netf&s
|
||||
$sql = "SELECT *
|
||||
FROM tnetflow_filter
|
||||
WHERE id_group IN (".implode(',', array_keys ($user_groups)).")";
|
||||
echo "<td colspan='3'>" . html_print_select_from_sql ($sql, 'filter_id', $filter_id, '', __('none'), 0, true) . "</td>";
|
||||
|
||||
echo "<td colspan='3'>" . html_print_select_from_sql ($sql, 'filter_id', $filter_id, '', __('Select a filter'), 0, true);
|
||||
html_print_input_hidden("filter_selected", $filter_selected, false);
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
|
||||
|
||||
@ -351,8 +353,13 @@ echo '<form method="post" action="' . $config['homeurl'] . 'index.php?sec=netf&s
|
||||
echo "</tr>";
|
||||
echo "<tr class='filter_advance' style='display: none;'>";
|
||||
|
||||
echo "<td>" . ui_print_help_icon ('pcap_filter', true, ui_get_full_url(false, false, false, false)) . "</td>";
|
||||
echo "<td colspan='5'>" . html_print_textarea ('advanced_filter', 4, 40, $filter['advanced_filter'], "style='min-height: 0px; width: 90%;'", true) . "</td>";
|
||||
if ($netflow_disable_custom_lvfilters) {
|
||||
echo "<td></td>";
|
||||
echo "<td></td>";
|
||||
} else {
|
||||
echo "<td>" . ui_print_help_icon ('pcap_filter', true) . "</td>";
|
||||
echo "<td colspan='5'>" . html_print_textarea ('advanced_filter', 4, 40, $filter['advanced_filter'], "style='min-height: 0px; width: 90%;'", true) . "</td>";
|
||||
}
|
||||
|
||||
echo "</tr>";
|
||||
echo "<tr>";
|
||||
@ -395,9 +402,17 @@ echo'</form>';
|
||||
if ($draw != '') {
|
||||
// Draw
|
||||
echo "<br/>";
|
||||
|
||||
// No filter selected
|
||||
if ($netflow_disable_custom_lvfilters && $filter_selected == 0) {
|
||||
ui_print_error_message(__('No filter selected'));
|
||||
}
|
||||
// Draw the netflow chart
|
||||
else {
|
||||
echo netflow_draw_item ($start_date, $end_date,
|
||||
$interval_length, $chart_type, $filter,
|
||||
$max_aggregates, $connection_name, 'HTML', $address_resolution);
|
||||
}
|
||||
}
|
||||
|
||||
enterprise_hook('close_meta_frame');
|
||||
@ -466,6 +481,7 @@ ui_include_time_picker();
|
||||
// Check right filter type
|
||||
$("#radiobtn0001").attr("checked", "checked");
|
||||
|
||||
$("#hidden-filter_selected").val(0);
|
||||
$("#text-ip_dst").val('');
|
||||
$("#text-ip_src").val('');
|
||||
$("#text-dst_port").val('');
|
||||
@ -480,6 +496,7 @@ ui_include_time_picker();
|
||||
}
|
||||
else {
|
||||
// Load fields from DB
|
||||
$("#hidden-filter_selected").val(1);
|
||||
|
||||
// Get filter type
|
||||
<?php
|
||||
|
@ -46,17 +46,17 @@ enterprise_include("include/functions_reporting.php");
|
||||
$pure = get_parameter('pure',0);
|
||||
|
||||
// Get different date to search the report.
|
||||
$date = (string) get_parameter ('date', date(DATE_FORMAT));
|
||||
$time = (string) get_parameter ('time', date(TIME_FORMAT));
|
||||
$date = (string)get_parameter('date', date(DATE_FORMAT));
|
||||
$time = (string)get_parameter('time', date(TIME_FORMAT));
|
||||
|
||||
$datetime = strtotime ($date . ' ' . $time);
|
||||
$report["datetime"] = $datetime;
|
||||
|
||||
// Calculations in order to modify init date of the report
|
||||
$date_init_less = strtotime(date('Y-m-j')) - 86400;
|
||||
$date_init_less = strtotime(date('Y-m-j')) - SECONDS_1DAY;
|
||||
$date_init = get_parameter('date_init', date(DATE_FORMAT, $date_init_less));
|
||||
$time_init = get_parameter('time_init', date(TIME_FORMAT, $date_init_less));
|
||||
$datetime_init = strtotime ($date_init.' '.$time_init);
|
||||
$datetime_init = strtotime($date_init . ' ' . $time_init);
|
||||
$enable_init_date = get_parameter('enable_init_date', 0);
|
||||
|
||||
// Standard header
|
||||
@ -68,17 +68,17 @@ $options = array();
|
||||
$options['list_reports'] = array('active' => false,
|
||||
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&pure='.$pure.'">' .
|
||||
html_print_image("images/report_list.png", true, array ("title" => __('Report list'))) .'</a>');
|
||||
|
||||
|
||||
if (check_acl ($config['id_user'], 0, "RW")) {
|
||||
$options['main']['text'] = '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=main&action=edit&id_report=' . $id_report . '&pure='.$pure.'">' .
|
||||
html_print_image("images/op_reporting.png", true, array ("title" => __('Main data'))) .'</a>';
|
||||
|
||||
|
||||
$options['list_items']['text'] = '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=edit&id_report=' . $id_report . '&pure='.$pure.'">' .
|
||||
html_print_image("images/list.png", true, array ("title" => __('List items'))) .'</a>';
|
||||
|
||||
|
||||
$options['item_editor']['text'] = '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=item_editor&action=new&id_report=' . $id_report . '&pure='.$pure.'">' .
|
||||
html_print_image("images/pen.png", true, array ("title" => __('Item editor'))) .'</a>';
|
||||
|
||||
|
||||
if (enterprise_installed()) {
|
||||
$options = reporting_enterprise_add_Tabs($options, $id_report);
|
||||
}
|
||||
|
@ -383,15 +383,15 @@ foreach ($contents as $content) {
|
||||
|
||||
$data["module"] = io_safe_output_xml (db_get_value ('nombre', 'tagente_modulo', 'id_agente_modulo', $content['id_agent_module']));
|
||||
$data["agent"] = io_safe_output_xml (modules_get_agentmodule_agent_name ($content['id_agent_module']));
|
||||
html_debug_print($content, true);
|
||||
|
||||
$graph = db_get_row ("tgraph", "id_graph", $content['id_gs']);
|
||||
$data["title"] = __('Custom graph');
|
||||
$data["objdata"] = array();
|
||||
html_debug_print($graph, true);
|
||||
|
||||
$result = db_get_all_rows_field_filter ("tgraph_source","id_graph",$content['id_gs']);
|
||||
$modules = array ();
|
||||
$weights = array ();
|
||||
html_debug_print($result, true);
|
||||
|
||||
if ($result === false) {
|
||||
$result = array();
|
||||
}
|
||||
|
@ -222,9 +222,9 @@ if ($view_mode === false) {
|
||||
if ($config["user_can_update_password"]) {
|
||||
$data = array();
|
||||
$data[0] = __('New Password');
|
||||
$data[0] .= '<br>' . html_print_input_text_extended ("password_new", "", '', '', '40', '25', $view_mode, '', 'class="input"', true, true);
|
||||
$data[0] .= '<br>' . html_print_input_text_extended ("password_new", "", '', '', '40', '45', $view_mode, '', 'class="input"', true, true);
|
||||
$data[1] = __('Password confirmation');
|
||||
$data[1] .= '<br>' . html_print_input_text_extended ("password_conf", "", '', '', '40', '25', $view_mode, '', 'class="input"', true, true);
|
||||
$data[1] .= '<br>' . html_print_input_text_extended ("password_conf", "", '', '', '40', '45', $view_mode, '', 'class="input"', true, true);
|
||||
$table->rowclass[] = '';
|
||||
$table->rowstyle[] = 'font-weight: bold;';
|
||||
$table->data[] = $data;
|
||||
@ -282,7 +282,6 @@ if (!$meta) {
|
||||
$data[1] = __('Home screen'). ui_print_help_tip(__('User can customize the home page. By default, will display \'Agent Detail\'. Example: Select \'Other\' and type sec=estado&sec2=operation/agentes/estado_agente to show agent detail view'), true);
|
||||
$values = array (
|
||||
'Default' =>__('Default'),
|
||||
'Dashboard'=>__('Dashboard'),
|
||||
'Visual console'=>__('Visual console'),
|
||||
'Event list'=>__('Event list'),
|
||||
'Group view'=>__('Group view'),
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 5.1SP2
|
||||
%define release 150329
|
||||
%define release 150514
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 5.1SP2
|
||||
%define release 150329
|
||||
%define release 150514
|
||||
%define httpd_name httpd
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name apache2
|
||||
|
@ -38,7 +38,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
|
||||
('graph_res','5'),
|
||||
('step_compact','1'),
|
||||
('db_scheme_version','5.1SP2'),
|
||||
('db_scheme_build','PD150329'),
|
||||
('db_scheme_build','PD150514'),
|
||||
('show_unknown','0'),
|
||||
('show_lastalerts','1'),
|
||||
('style','pandora'),
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-server
|
||||
Version: 5.1SP2-150329
|
||||
Version: 5.1SP2-150514
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="5.1SP2-150329"
|
||||
pandora_version="5.1SP2-150514"
|
||||
|
||||
package_cpan=0
|
||||
package_pandora=1
|
||||
|
@ -43,7 +43,7 @@ our @EXPORT = qw(
|
||||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "5.1SP2";
|
||||
my $pandora_build = "150329";
|
||||
my $pandora_build = "150514";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
# Setup hash
|
||||
|
@ -247,7 +247,7 @@ sub get_agent_from_name ($$) {
|
||||
|
||||
return undef if (! defined ($name) || $name eq '');
|
||||
|
||||
return get_db_single_row ($dbh, 'SELECT * FROM tagente WHERE tagente.nombre = ?', $name);
|
||||
return get_db_single_row ($dbh, 'SELECT * FROM tagente WHERE tagente.nombre = ?', safe_input($name));
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
@ -624,15 +624,26 @@ sub pandora_execute_alert ($$$$$$$$;$) {
|
||||
|
||||
# Simple alert
|
||||
if (defined ($alert->{'id_template_module'})) {
|
||||
@actions = get_db_rows ($dbh, 'SELECT *, talert_template_module_actions.id AS id_alert_template_module_actions
|
||||
FROM talert_template_module_actions, talert_actions, talert_commands
|
||||
WHERE talert_template_module_actions.id_alert_action = talert_actions.id
|
||||
AND talert_actions.id_alert_command = talert_commands.id
|
||||
AND talert_template_module_actions.id_alert_template_module = ?
|
||||
AND ((fires_min = 0 AND fires_max = 0)
|
||||
OR (fires_min <= fires_max AND ? >= fires_min AND ? <= fires_max)
|
||||
OR (fires_min > fires_max AND ? >= fires_min))',
|
||||
$alert->{'id_template_module'}, $alert->{'times_fired'}, $alert->{'times_fired'}, $alert->{'times_fired'});
|
||||
if ($alert_mode == RECOVERED_ALERT) {
|
||||
@actions = get_db_rows ($dbh, 'SELECT *, talert_template_module_actions.id AS id_alert_template_module_actions
|
||||
FROM talert_template_module_actions, talert_actions, talert_commands
|
||||
WHERE talert_template_module_actions.id_alert_action = talert_actions.id
|
||||
AND talert_actions.id_alert_command = talert_commands.id
|
||||
AND talert_template_module_actions.id_alert_template_module = ?
|
||||
AND ((fires_min = 0 AND fires_max = 0)
|
||||
OR ? >= fires_min)',
|
||||
$alert->{'id_template_module'}, $alert->{'times_fired'});
|
||||
} else {
|
||||
@actions = get_db_rows ($dbh, 'SELECT *, talert_template_module_actions.id AS id_alert_template_module_actions
|
||||
FROM talert_template_module_actions, talert_actions, talert_commands
|
||||
WHERE talert_template_module_actions.id_alert_action = talert_actions.id
|
||||
AND talert_actions.id_alert_command = talert_commands.id
|
||||
AND talert_template_module_actions.id_alert_template_module = ?
|
||||
AND ((fires_min = 0 AND fires_max = 0)
|
||||
OR (fires_min <= fires_max AND ? >= fires_min AND ? <= fires_max)
|
||||
OR (fires_min > fires_max AND ? >= fires_min))',
|
||||
$alert->{'id_template_module'}, $alert->{'times_fired'}, $alert->{'times_fired'}, $alert->{'times_fired'});
|
||||
}
|
||||
|
||||
# Get default action
|
||||
if ($#actions < 0) {
|
||||
@ -644,15 +655,25 @@ sub pandora_execute_alert ($$$$$$$$;$) {
|
||||
}
|
||||
# Event alert
|
||||
else {
|
||||
@actions = get_db_rows ($dbh, 'SELECT * FROM tevent_alert_action, talert_actions, talert_commands
|
||||
WHERE tevent_alert_action.id_alert_action = talert_actions.id
|
||||
AND talert_actions.id_alert_command = talert_commands.id
|
||||
AND tevent_alert_action.id_event_alert = ?
|
||||
AND ((fires_min = 0 AND fires_max = 0)
|
||||
OR (fires_min <= fires_max AND ? >= fires_min AND ? <= fires_max)
|
||||
OR (fires_min > fires_max AND ? >= fires_min))',
|
||||
$alert->{'id'}, $alert->{'times_fired'}, $alert->{'times_fired'}, $alert->{'times_fired'});
|
||||
|
||||
if ($alert_mode == RECOVERED_ALERT) {
|
||||
@actions = get_db_rows ($dbh, 'SELECT * FROM tevent_alert_action, talert_actions, talert_commands
|
||||
WHERE tevent_alert_action.id_alert_action = talert_actions.id
|
||||
AND talert_actions.id_alert_command = talert_commands.id
|
||||
AND tevent_alert_action.id_event_alert = ?
|
||||
AND ((fires_min = 0 AND fires_max = 0)
|
||||
OR ? >= fires_min)',
|
||||
$alert->{'id'}, $alert->{'times_fired'});
|
||||
} else {
|
||||
@actions = get_db_rows ($dbh, 'SELECT * FROM tevent_alert_action, talert_actions, talert_commands
|
||||
WHERE tevent_alert_action.id_alert_action = talert_actions.id
|
||||
AND talert_actions.id_alert_command = talert_commands.id
|
||||
AND tevent_alert_action.id_event_alert = ?
|
||||
AND ((fires_min = 0 AND fires_max = 0)
|
||||
OR (fires_min <= fires_max AND ? >= fires_min AND ? <= fires_max)
|
||||
OR (fires_min > fires_max AND ? >= fires_min))',
|
||||
$alert->{'id'}, $alert->{'times_fired'}, $alert->{'times_fired'}, $alert->{'times_fired'});
|
||||
}
|
||||
|
||||
# Get default action
|
||||
if ($#actions < 0) {
|
||||
@actions = get_db_rows ($dbh, 'SELECT * FROM talert_actions, talert_commands
|
||||
@ -710,7 +731,7 @@ sub pandora_execute_alert ($$$$$$$$;$) {
|
||||
if ($event_generated == 0) {
|
||||
|
||||
#If we've spotted an alert recovered, we set the new event's severity to 2 (NORMAL), otherwise the original value is maintained.
|
||||
my ($text, $event, $severity) = ($alert_mode == 0) ? ('recovered', 'alert_recovered', 2) : ('fired', 'alert_fired', $alert->{'priority'});
|
||||
my ($text, $event, $severity) = ($alert_mode == RECOVERED_ALERT) ? ('recovered', 'alert_recovered', 2) : ('fired', 'alert_fired', $alert->{'priority'});
|
||||
|
||||
pandora_event ($pa_config, "Alert $text (" . safe_output($alert->{'name'}) . ") " . (defined ($module) ? 'assigned to ('. safe_output($module->{'nombre'}) . ")" : ""),
|
||||
(defined ($agent) ? $agent->{'id_grupo'} : 0), (defined ($agent) ? $agent->{'id_agente'} : 0), $severity, (defined ($alert->{'id_template_module'}) ? $alert->{'id_template_module'} : 0),
|
||||
@ -762,7 +783,7 @@ sub pandora_execute_action ($$$$$$$$$;$) {
|
||||
}
|
||||
|
||||
# Recovery fields, thanks to Kato Atsushi
|
||||
if ($alert_mode == 0) {
|
||||
if ($alert_mode == RECOVERED_ALERT) {
|
||||
# Field 1 is a special case where [RECOVER] prefix is not added even when it is defined
|
||||
$field1 = $alert->{'field1_recovery'} ? $alert->{'field1_recovery'} : $field1;
|
||||
$field1 = $action->{'field1_recovery'} ? $action->{'field1_recovery'} : $field1;
|
||||
|
@ -57,6 +57,8 @@ our @EXPORT = qw(
|
||||
ICMPSERVER
|
||||
SNMPSERVER
|
||||
$DEVNULL
|
||||
RECOVERED_ALERT
|
||||
FIRED_ALERT
|
||||
cron_get_closest_in_range
|
||||
cron_next_execution
|
||||
cron_next_execution_date
|
||||
@ -106,6 +108,10 @@ use constant EVENTSERVER => 10;
|
||||
use constant ICMPSERVER => 11;
|
||||
use constant SNMPSERVER => 12;
|
||||
|
||||
# Alert modes
|
||||
use constant RECOVERED_ALERT => 0;
|
||||
use constant FIRED_ALERT => 1;
|
||||
|
||||
# /dev/null
|
||||
our $DEVNULL = ($^O eq 'MSWin32') ? '/Nul' : '/dev/null';
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user