Merge remote-tracking branch 'origin/develop' into ent-11830-reemplazar-sistema-de-websocket-gotty-actual

This commit is contained in:
alejandro.campos@artica.es 2023-09-28 16:36:59 +02:00
commit 85598d5012
143 changed files with 10781 additions and 6111 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.773.3-230919
Version: 7.0NG.773.3-230928
Architecture: all
Priority: optional
Section: admin

View File

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

View File

@ -1031,7 +1031,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.773.3';
use constant AGENT_BUILD => '230919';
use constant AGENT_BUILD => '230928';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_agent_linux
%define version 7.0NG.773.3
%define release 230919
%define release 230928
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -0,0 +1,169 @@
#
#Pandora FMS Linux Agent
#
%global __os_install_post %{nil}
%define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux
%define version 7.0NG.773.3
%define release 230919
%define debug_package %{nil}
Summary: Pandora FMS Linux agent, binary version
Name: %{name}
Version: %{version}
Release: %{release}
License: GPL
Vendor: ArticaST <http://www.artica.es>
Source0: %{source_name}-%{version}.tar.gz
URL: http://pandorafms.org
Group: System/Monitoring
Packager: Sancho Lerena <slerena@artica.es>
Prefix: /usr/share
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
BuildArch: x86_64
Requires(pre): shadow-utils
Requires(post): chkconfig /bin/ln
Requires(preun): chkconfig /bin/rm /usr/sbin/userdel
Requires: coreutils unzip
Requires: util-linux procps grep
Requires: /sbin/ip /bin/awk
Requires: perl-interpreter
Requires: perl-IO-Compress
Requires: libnsl
AutoReq: 0
Provides: %{name}-%{version}
%description
Pandora FMS agent for unix. Pandora FMS is an OpenSource full-featured monitoring software.
%prep
rm -rf $RPM_BUILD_ROOT
%setup -q -n unix
%build
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{prefix}/pandora_agent/
mkdir -p $RPM_BUILD_ROOT/usr/bin/
mkdir -p $RPM_BUILD_ROOT/usr/sbin/
mkdir -p $RPM_BUILD_ROOT/etc/pandora/
mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d/
mkdir -p $RPM_BUILD_ROOT/var/log/pandora/
mkdir -p $RPM_BUILD_ROOT/usr/share/man/man1/
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/
cp -aRf * $RPM_BUILD_ROOT%{prefix}/pandora_agent/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/tentacle_client $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_exec $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_daemon $RPM_BUILD_ROOT/etc/rc.d/init.d/pandora_agent_daemon
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/pandora_agent.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/tentacle_client.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/Linux/pandora_agent.conf $RPM_BUILD_ROOT/usr/share/pandora_agent/pandora_agent.conf.rpmnew
install -m 0644 pandora_agent_logrotate $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/pandora_agent
if [ -f $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent.spec ] ; then
rm $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent.spec
fi
%clean
rm -Rf $RPM_BUILD_ROOT
%pre
getent passwd pandora >/dev/null || \
/usr/sbin/useradd -d %{prefix}/pandora -s /bin/false -M -g 0 pandora
exit 0
chown pandora:root /var/log/pandora
%post
if [ ! -d /etc/pandora ] ; then
mkdir -p /etc/pandora
fi
if [ ! -f /usr/share/pandora_agent/pandora_agent.conf ] ; then
cp /usr/share/pandora_agent/pandora_agent.conf.rpmnew /usr/share/pandora_agent/pandora_agent.conf
fi
if [ ! -f /etc/pandora/pandora_agent.conf ] ; then
ln -s /usr/share/pandora_agent/pandora_agent.conf /etc/pandora/pandora_agent.conf
else
[[ ! -f /etc/pandora/pandora_agent.conf.rpmnew ]] && ln -s /usr/share/pandora_agent/pandora_agent.conf.rpmnew /etc/pandora/pandora_agent.conf.rpmnew
fi
if [ ! -e /etc/pandora/plugins ]; then
ln -s /usr/share/pandora_agent/plugins /etc/pandora
fi
if [ ! -e /etc/pandora/collections ]; then
mkdir -p /usr/share/pandora_agent/collections
ln -s /usr/share/pandora_agent/collections /etc/pandora
fi
if [ ! -e /etc/pandora/commands ]; then
mkdir -p /usr/share/pandora_agent/commands
ln -s /usr/share/pandora_agent/commands /etc/pandora
fi
mkdir -p /var/spool/pandora/data_out
if [ ! -d /var/log/pandora ]; then
mkdir -p /var/log/pandora
fi
if [ `command -v systemctl` ];
then
echo "Copying new version of pandora_agent_daemon service"
cp -f /usr/share/pandora_agent/pandora_agent_daemon.service /usr/lib/systemd/system/
chmod -x /usr/lib/systemd/system/pandora_agent_daemon.service
# Enable the services on SystemD
systemctl enable pandora_agent_daemon.service
else
/sbin/chkconfig --add pandora_agent_daemon
/sbin/chkconfig pandora_agent_daemon on
fi
if [ "$1" -gt 1 ]
then
echo "If Pandora Agent daemon was running with init.d script,"
echo "please stop it manually and start the service with systemctl"
fi
%preun
# Upgrading
if [ "$1" = "1" ]; then
exit 0
fi
/sbin/chkconfig --del pandora_agent_daemon
/etc/rc.d/init.d/pandora_agent_daemon stop >/dev/null 2>&1 || :
# Remove symbolic links
pushd /etc/pandora
for f in pandora_agent.conf plugins collections
do
[ -L $f ] && rm -f $f
done
exit 0
%files
%defattr(750,root,root)
/usr/bin/pandora_agent
%defattr(755,pandora,root)
%{prefix}/pandora_agent
%defattr(755,root,root)
/usr/bin/pandora_agent_exec
/usr/bin/tentacle_client
/etc/rc.d/init.d/pandora_agent_daemon
%defattr(644,root,root)
/usr/share/man/man1/pandora_agent.1.gz
/usr/share/man/man1/tentacle_client.1.gz
%config(noreplace) %{_sysconfdir}/logrotate.d/pandora_agent

View File

@ -0,0 +1,170 @@
#
#Pandora FMS Linux Agent
#
%global __os_install_post %{nil}
%define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux
%define version 7.0NG.773.3
%define release 230919
%define debug_package %{nil}
Summary: Pandora FMS Linux agent, binary version
Name: %{name}
Version: %{version}
Release: %{release}
License: GPL
Vendor: ArticaST <http://www.artica.es>
Source0: %{source_name}-%{version}.tar.gz
URL: http://pandorafms.org
Group: System/Monitoring
Packager: Sancho Lerena <slerena@artica.es>
Prefix: /usr/share
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
BuildArch: x86_64
Requires(pre): shadow-utils
Requires(post): chkconfig /bin/ln
Requires(preun): chkconfig /bin/rm /usr/sbin/userdel
Requires: coreutils unzip
Requires: util-linux procps grep
Requires: /sbin/ip /bin/awk
Requires: perl-interpreter
Requires: perl-IO-Compress
Requires: libnsl
Requires: libxcrypt-compat
AutoReq: 0
Provides: %{name}-%{version}
%description
Pandora FMS agent for unix. Pandora FMS is an OpenSource full-featured monitoring software.
%prep
rm -rf $RPM_BUILD_ROOT
%setup -q -n unix
%build
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{prefix}/pandora_agent/
mkdir -p $RPM_BUILD_ROOT/usr/bin/
mkdir -p $RPM_BUILD_ROOT/usr/sbin/
mkdir -p $RPM_BUILD_ROOT/etc/pandora/
mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d/
mkdir -p $RPM_BUILD_ROOT/var/log/pandora/
mkdir -p $RPM_BUILD_ROOT/usr/share/man/man1/
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/
cp -aRf * $RPM_BUILD_ROOT%{prefix}/pandora_agent/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/tentacle_client $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_exec $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_daemon $RPM_BUILD_ROOT/etc/rc.d/init.d/pandora_agent_daemon
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/pandora_agent.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/tentacle_client.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/Linux/pandora_agent.conf $RPM_BUILD_ROOT/usr/share/pandora_agent/pandora_agent.conf.rpmnew
install -m 0644 pandora_agent_logrotate $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/pandora_agent
if [ -f $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent.spec ] ; then
rm $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent.spec
fi
%clean
rm -Rf $RPM_BUILD_ROOT
%pre
getent passwd pandora >/dev/null || \
/usr/sbin/useradd -d %{prefix}/pandora -s /bin/false -M -g 0 pandora
exit 0
chown pandora:root /var/log/pandora
%post
if [ ! -d /etc/pandora ] ; then
mkdir -p /etc/pandora
fi
if [ ! -f /usr/share/pandora_agent/pandora_agent.conf ] ; then
cp /usr/share/pandora_agent/pandora_agent.conf.rpmnew /usr/share/pandora_agent/pandora_agent.conf
fi
if [ ! -f /etc/pandora/pandora_agent.conf ] ; then
ln -s /usr/share/pandora_agent/pandora_agent.conf /etc/pandora/pandora_agent.conf
else
[[ ! -f /etc/pandora/pandora_agent.conf.rpmnew ]] && ln -s /usr/share/pandora_agent/pandora_agent.conf.rpmnew /etc/pandora/pandora_agent.conf.rpmnew
fi
if [ ! -e /etc/pandora/plugins ]; then
ln -s /usr/share/pandora_agent/plugins /etc/pandora
fi
if [ ! -e /etc/pandora/collections ]; then
mkdir -p /usr/share/pandora_agent/collections
ln -s /usr/share/pandora_agent/collections /etc/pandora
fi
if [ ! -e /etc/pandora/commands ]; then
mkdir -p /usr/share/pandora_agent/commands
ln -s /usr/share/pandora_agent/commands /etc/pandora
fi
mkdir -p /var/spool/pandora/data_out
if [ ! -d /var/log/pandora ]; then
mkdir -p /var/log/pandora
fi
if [ `command -v systemctl` ];
then
echo "Copying new version of pandora_agent_daemon service"
cp -f /usr/share/pandora_agent/pandora_agent_daemon.service /usr/lib/systemd/system/
chmod -x /usr/lib/systemd/system/pandora_agent_daemon.service
# Enable the services on SystemD
systemctl enable pandora_agent_daemon.service
else
/sbin/chkconfig --add pandora_agent_daemon
/sbin/chkconfig pandora_agent_daemon on
fi
if [ "$1" -gt 1 ]
then
echo "If Pandora Agent daemon was running with init.d script,"
echo "please stop it manually and start the service with systemctl"
fi
%preun
# Upgrading
if [ "$1" = "1" ]; then
exit 0
fi
/sbin/chkconfig --del pandora_agent_daemon
/etc/rc.d/init.d/pandora_agent_daemon stop >/dev/null 2>&1 || :
# Remove symbolic links
pushd /etc/pandora
for f in pandora_agent.conf plugins collections
do
[ -L $f ] && rm -f $f
done
exit 0
%files
%defattr(750,root,root)
/usr/bin/pandora_agent
%defattr(755,pandora,root)
%{prefix}/pandora_agent
%defattr(755,root,root)
/usr/bin/pandora_agent_exec
/usr/bin/tentacle_client
/etc/rc.d/init.d/pandora_agent_daemon
%defattr(644,root,root)
/usr/share/man/man1/pandora_agent.1.gz
/usr/share/man/man1/tentacle_client.1.gz
%config(noreplace) %{_sysconfdir}/logrotate.d/pandora_agent

View File

@ -5,7 +5,7 @@
%define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux
%define version 7.0NG.773.3
%define release 230919
%define release 230928
Summary: Pandora FMS Linux agent, binary version
Name: %{name}
@ -26,6 +26,7 @@ Requires(preun): chkconfig /bin/rm /usr/sbin/userdel
Requires: coreutils unzip
Requires: util-linux procps grep
Requires: /sbin/ip /bin/awk
Requires: perl
#Requires: libnsl
AutoReq: 0
Provides: %{name}-%{version}

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_agent_linux
%define version 7.0NG.773.3
%define release 230919
%define release 230928
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.773.3"
PI_BUILD="230919"
PI_BUILD="230928"
OS_NAME=`uname -s`
FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{230919}
{230928}
ViewReadme
{Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.773.3 Build 230919")
#define PANDORA_VERSION ("7.0NG.773.3 Build 230928")
string pandora_path;
string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Pandora FMS"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.773.3(Build 230919))"
VALUE "ProductVersion", "(7.0NG.773.3(Build 230928))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.773.3-230919
Version: 7.0NG.773.3-230928
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.773.3-230919"
pandora_version="7.0NG.773.3-230928"
package_pear=0
package_pandora=1

View File

@ -1708,4 +1708,12 @@ enterprise/godmode/wizards/Cloud.class.php
enterprise/images/wizard/applications.png
enterprise/images/wizard/cloud.png
enterprise/images/wizard/consoletasks.png
pandora_websocket_engine
pandora_websocket_engine
operation/incidents/configure_integriaims_incident.php
operation/incidents/dashboard_detail_integriaims_incident.php
operation/incidents/incident_statistics.php
operation/incidents/integriaims_export_csv.php
operation/incidents/list_integriaims_incidents.php
include/functions_incidents.php
include/functions_integriaims.php
include/ajax/integria_incidents.ajax.php

View File

@ -14,6 +14,43 @@ CREATE TABLE IF NOT EXISTS `tgraph_analytics_filter` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
ALTER TABLE `tusuario` MODIFY COLUMN `integria_user_level_pass` TEXT;
DROP TABLE `tincidencia`;
DROP TABLE `tnota`;
DROP TABLE `tattachment`;
ALTER TABLE `talert_commands` ADD CONSTRAINT UNIQUE (`name`);
ALTER TABLE `talert_actions` MODIFY COLUMN `name` VARCHAR(500);
ALTER TABLE `talert_actions` ADD CONSTRAINT UNIQUE (`name`);
SET @command_name = 'Pandora&#x20;ITSM&#x20;Ticket';
SET @command_description = 'Create&#x20;a&#x20;ticket&#x20;in&#x20;Pandora&#x20;ITSM';
SET @action_name = 'Create&#x20;Pandora&#x20;ITSM&#x20;ticket';
UPDATE `talert_commands` SET `name` = @command_name, `description` = @command_description WHERE `name` = 'Integria&#x20;IMS&#x20;Ticket' AND `internal` = 1;
INSERT IGNORE INTO `talert_commands` (`name`, `command`, `description`, `internal`, `fields_descriptions`, `fields_values`) VALUES (@command_name,'Internal&#x20;type',@command_description,1,'["Ticket&#x20;title","Ticket&#x20;group&#x20;ID","Ticket&#x20;priority","Ticket&#x20;owner","Ticket&#x20;type","Ticket&#x20;status","Ticket&#x20;description","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_"]','["", "_ITSM_groups_", "_ITSM_priorities_","_ITSM_users_","_ITSM_types_","_ITSM_status_","_html_editor_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_"]');
SELECT @id_alert_command := `id` FROM `talert_commands` WHERE `name` = @command_name;
UPDATE `talert_actions` SET `name` = @action_name WHERE `name` = 'Create&#x20;Integria&#x20;IMS&#x20;ticket' AND `id_alert_command` = @id_alert_command;
INSERT IGNORE INTO `talert_actions` (`name`, `id_alert_command`) VALUES (@action_name,@id_alert_command);
SET @event_response_name = 'Create&#x20;ticket&#x20;in&#x20;Pandora&#x20;ITSM&#x20;from&#x20;event';
SET @event_response_description = 'Create&#x20;a&#x20;ticket&#x20;in&#x20;Pandora&#x20;ITSM&#x20;from&#x20;an&#x20;event';
SET @event_response_target = 'index.php?sec=manageTickets&amp;sec2=operation/ITSM/itsm&amp;operation=edit&amp;from_event=_event_id_';
SET @event_response_type = 'url';
SET @event_response_id_group = 0;
SET @event_response_modal_width = 0;
SET @event_response_modal_height = 0;
SET @event_response_new_window = 1;
SET @event_response_params = '';
SET @event_response_server_to_exec = 0;
SET @event_response_command_timeout = 90;
SET @event_response_display_command = 1;
UPDATE `tevent_response` SET `name` = @event_response_name, `description` = @event_response_description, `target` = @event_response_target, `display_command` = @event_response_display_command WHERE `name` = 'Create&#x20;ticket&#x20;in&#x20;IntegriaIMS&#x20;from&#x20;event';
INSERT IGNORE INTO `tevent_response` (`name`, `description`, `target`,`type`,`id_group`,`modal_width`,`modal_height`,`new_window`,`params`,`server_to_exec`,`command_timeout`,`display_command`) VALUES (@event_response_name, @event_response_description, @event_response_target, @event_response_type, @event_response_id_group, @event_response_modal_width, @event_response_modal_height, @event_response_new_window, @event_response_params, @event_response_server_to_exec, @event_response_command_timeout, @event_response_display_command);
UPDATE `twelcome_tip`
SET title = 'Scheduled&#x20;downtimes',
url = 'https://pandorafms.com/manual/en/documentation/04_using/11_managing_and_administration#scheduled_downtimes'
@ -23,6 +60,12 @@ UPDATE tagente_modulo SET `tcp_send` = '2c' WHERE `tcp_send` = '2';
UPDATE tpolicy_modules SET `tcp_send` = '2c' WHERE `tcp_send` = '2';
UPDATE tnetwork_component SET `tcp_send` = '2c' WHERE `tcp_send` = '2';
ALTER TABLE talert_templates
ADD COLUMN `time_window` ENUM ('thirty_days','this_month','seven_days','this_week','one_day','today'),
ADD COLUMN `math_function` ENUM ('avg', 'min', 'max', 'sum'),
ADD COLUMN `condition` ENUM ('lower', 'greater', 'equal'),
MODIFY COLUMN `type` ENUM ('regex', 'max_min', 'max', 'min', 'equal', 'not_equal', 'warning', 'critical', 'onchange', 'unknown', 'always', 'not_normal', 'complex');
ALTER TABLE `tsesion_filter_log_viewer`
CHANGE COLUMN `date_range` `custom_date` INT NULL DEFAULT NULL ,
CHANGE COLUMN `start_date_defined` `date` VARCHAR(45) NULL DEFAULT NULL ,
@ -47,4 +90,25 @@ ADD COLUMN `time_end` VARCHAR(45) NULL AFTER `date_end`;
UPDATE `tdiscovery_apps` SET `version` = '1.1' WHERE `short_name` = 'pandorafms.vmware';
-- Insert new Proxmox APP
SET @short_name = 'pandorafms.proxmox';
SET @name = 'Proxmox';
SET @section = 'app';
SET @description = 'Monitor&#x20;Proxmox&#x20;VMs,&#x20;LXC,&#x20;backups&#x20;and&#x20;nodes&#x20;from&#x20;a&#x20;specific&#x20;host';
SET @version = '1.0';
INSERT IGNORE INTO `tdiscovery_apps` (`id_app`, `short_name`, `name`, `section`, `description`, `version`) VALUES ('', @short_name, @name, @section, @description, @version);
SELECT @id_app := `id_app` FROM `tdiscovery_apps` WHERE `short_name` = @short_name;
-- Insert into tdiscovery_apps_scripts
INSERT IGNORE INTO `tdiscovery_apps_scripts` (`id_app`, `macro`, `value`) VALUES (@id_app, '_exec1_', 'bin/pandora_proxmox');
-- Insert into tdiscovery_apps_executions
INSERT IGNORE INTO `tdiscovery_apps_executions` (`id`, `id_app`, `execution`) VALUES (1, @id_app, '&#039;_exec1_&#039;&#x20;-g&#x20;&#039;__taskGroup__&#039;&#x20;--host&#x20;&#039;_host_&#039;&#x20;--port&#x20;&#039;_port_&#039;&#x20;--user&#x20;&#039;_user_&#039;&#x20;--password&#x20;&#039;_password_&#039;&#x20;--vm&#x20;&#039;_scanVM_&#039;&#x20;--lxc&#x20;&#039;_scanLXC_&#039;&#x20;--backups&#x20;&#039;_scanBackups_&#039;&#x20;--nodes&#x20;&#039;_scanNodes_&#039;&#x20;--transfer_mode&#x20;tentacle&#x20;--tentacle_address&#x20;&#039;_tentacleIP_&#039;&#x20;--tentacle_port&#x20;&#039;_tentaclePort_&#039;&#x20;--as_discovery_plugin&#x20;1');
ALTER TABLE `treport_content` ADD COLUMN `cat_security_hardening` INT NOT NULL DEFAULT 0;
ALTER TABLE `treport_content` ADD COLUMN `ignore_skipped` INT NOT NULL DEFAULT 0;
ALTER TABLE `treport_content` ADD COLUMN `status_of_check` TINYTEXT;
ALTER TABLE `tservice` ADD COLUMN `enable_horizontal_tree` TINYINT NOT NULL DEFAULT 0;
COMMIT;

View File

@ -352,6 +352,21 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
$display_counter = 'display:none';
}
$header_setup = '';
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
$header_setup .= '<div id="header_logout"><a class="white" href="'.ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup&section=general').'">';
$header_setup .= html_print_image(
'images/configuration@svg.svg',
true,
[
'alt' => __('Setup'),
'class' => 'bot invert_filter main_menu_icon',
'title' => __('Setup'),
]
);
$header_setup .= '</a></div>';
}
$header_autorefresh = '<div id="header_autorefresh">';
$header_autorefresh .= $autorefresh_link_open_img;
$header_autorefresh .= $autorefresh_img;
@ -428,7 +443,7 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
);
// Logout.
$header_logout = '<div id="header_logout"><a class="white" href="'.ui_get_full_url('index.php?bye=bye').'">';
$header_logout = '<div id="header_logout"><a onClick=\'if (!confirm("'.__('Are you sure?').'")) return false;\' class="white" href="'.ui_get_full_url('index.php?bye=bye').'">';
$header_logout .= html_print_image(
'images/sign_out@header.svg',
true,
@ -454,7 +469,7 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
} else {
echo '<div class="header_left"><span class="header_title">'.$config['custom_title_header'].'</span><span class="header_subtitle">'.$config['custom_subtitle_header'].'</span></div>
<div class="header_center">'.$header_searchbar.'</div>
<div class="header_right">'.$header_autorefresh, $header_autorefresh_counter, $header_discovery, $header_welcome, $servers_list, $modal_help, $header_user, $header_logout.'</div>';
<div class="header_right">'.$header_autorefresh, $header_autorefresh_counter, $header_discovery, $header_welcome, $servers_list, $modal_help, $header_setup, $header_user, $header_logout.'</div>';
}
?>
</div> <!-- Closes #table_header_inner -->

View File

@ -1,31 +1,43 @@
<?php
/**
* ITSM.
*
* @category ITSM view
* @package Pandora FMS
* @subpackage Opensource
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2023 Pandora FMS
* Please see https://pandorafms.com/community/ for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
use PandoraFMS\ITSM\ITSM;
// Pandora FMS - https://pandorafms.com
// ==================================================
// Copyright (c) 2005-2023 Pandora FMS
// Please see https://pandorafms.com/community/ for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
global $config;
require_once 'include/functions_incidents.php';
check_login();
if (!$config['integria_enabled']) {
ui_print_error_message(__('In order to access ticket management system, integration with Integria IMS must be enabled and properly configured'));
if (!$config['ITSM_enabled']) {
ui_print_error_message(__('In order to access ticket management system, integration with ITSM must be enabled and properly configured'));
return;
}
$group = $id_grupo;
if (! check_acl($config['id_user'], $group, 'AW', $id_agente)) {
if (! check_acl($config['id_user'], $id_grupo, 'AW', $id_agente)) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access agent manager'
@ -34,104 +46,11 @@ if (! check_acl($config['id_user'], $group, 'AW', $id_agente)) {
return;
}
$offset = (int) get_parameter('offset', 0);
// See if id_agente is set (either POST or GET, otherwise -1
$id_agent = (int) get_parameter('id_agente');
$groups = users_get_groups($config['id_user'], 'AR');
$filter = ' AND id_agent = '.$id_agent;
$url = 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=incident&id_agente='.$id_agent;
$params = [
'',
'-10',
'1',
'-1',
'0',
'',
'',
'',
agents_get_name($id_agent),
];
$result = integria_api_call(null, null, null, null, 'get_incidents', $params, false, 'json', ',');
$result = json_decode($result, true);
if (empty($result) === true) {
$result = [];
$count = 0;
echo '<div class="nf">'.__('No incidents associated to this agent').'</div><br />';
return;
} else {
$count = count($result);
$result = array_slice($result, $offset, $config['block_size']);
try {
$ITSM = new ITSM();
echo $ITSM->getTableIncidencesForAgent($id_agente);
} catch (Exception $e) {
echo $e->getMessage();
}
// Show pagination.
ui_pagination($count, $url, $offset, 0, false, 'offset');
// ($count + $offset) it's real count of incidents because it's use LIMIT $offset in query.
echo '<br />';
// Show headers.
$table->width = '100%';
$table->class = 'databox';
$table->cellpadding = 4;
$table->cellspacing = 4;
$table->head = [];
$table->data = [];
$table->size = [];
$table->align = [];
$table->head[0] = __('ID');
$table->head[1] = __('Status');
$table->head[2] = __('Incident');
$table->head[3] = __('Priority');
$table->head[4] = __('Group');
$table->head[5] = __('Updated');
$table->size[0] = 43;
$table->size[7] = 50;
$table->align[1] = 'center';
$table->align[3] = 'center';
$table->align[4] = 'center';
$rowPair = true;
$iterator = 0;
foreach ($result as $row) {
if ($rowPair) {
$table->rowclass[$iterator] = 'rowPair';
} else {
$table->rowclass[$iterator] = 'rowOdd';
}
$rowPair = !$rowPair;
$iterator++;
$data = [];
$data[0] = '<a href="index.php?sec=incident&sec2=operation/incidents/dashboard_detail_integriaims_incident&incident_id='.$row['id_incidencia'].'">'.$row['id_incidencia'].'</a>';
$attach = incidents_get_attach($row['id_incidencia']);
if (!empty($attach)) {
$data[0] .= '&nbsp;&nbsp;'.html_print_image('images/attachment.png', true, ['style' => 'align:middle;']);
}
$data[1] = incidents_print_status_img($row['estado'], true);
$data[2] = '<a href="index.php?sec=incident&sec2=operation/incidents/dashboard_detail_integriaims_incident&incident_id='.$row['id_incidencia'].'">'.substr(io_safe_output($row['titulo']), 0, 45).'</a>';
$data[3] = incidents_print_priority_img($row['prioridad'], true);
$data[4] = $row['id_grupo'];
$data[5] = ui_print_timestamp($row['actualizacion'], true);
array_push($table->data, $data);
}
html_print_table($table);
echo '</div>';
unset($table);
echo '<br><br>';
echo '<div id="both">&nbsp;</div>';
html_print_action_buttons('');

View File

@ -39,6 +39,7 @@ ui_require_javascript_file('encode_decode_base64');
ui_require_css_file('agent_manager');
use PandoraFMS\Event;
use PandoraFMS\ITSM\ITSM;
check_login();
@ -607,23 +608,6 @@ if ($id_agente) {
$agent_wizard['active'] = false;
}
$total_incidents = agents_get_count_incidents($id_agente);
// Incident tab.
if ($total_incidents > 0) {
$incidenttab['text'] = html_print_menu_button(
[
'href' => 'index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=incident&amp;id_agente='.$id_agente,
'image' => 'images/logs@svg.svg',
'title' => __('Incidents'),
],
true
);
$incidenttab['active'] = ($tab === 'incident');
}
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') === true) {
if ($has_remote_conf !== false) {
$agent_name = agents_get_name($id_agente);
@ -2092,7 +2076,6 @@ if ($create_module) {
if ($disable_module) {
hd($disable_module, true);
$result = modules_change_disabled($disable_module, 1);
$module_name = modules_get_agentmodule_name($disable_module);
@ -2116,13 +2099,11 @@ if ($create_module) {
if ($result === NOERR) {
hd($disable_module, true);
db_pandora_audit(
AUDIT_LOG_MODULE_MANAGEMENT,
'Disable #'.$disable_module.' | '.$module_name.' | '.io_safe_output($agent['alias'])
);
} else {
hd($disable_module, true);
db_pandora_audit(
AUDIT_LOG_MODULE_MANAGEMENT,
'Fail to disable #'.$disable_module.' | '.$module_name.' | '.io_safe_output($agent['alias'])

View File

@ -751,6 +751,10 @@ if ($agents !== false) {
'index.php?sec=reporting&sec2=operation/cluster/cluster&op=view&id=%s',
$cluster->id()
);
$agentAlertUrl = sprintf(
'index.php?sec=estado&sec2=operation/cluster/cluster&op=update&id=%s&page=6',
$cluster->id()
);
} else {
$main_tab = ($check_aw === true) ? 'main' : 'module';
$agentNameUrl = sprintf(
@ -762,6 +766,10 @@ if ($agents !== false) {
'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=%s',
$agent['id_agente']
);
$agentAlertUrl = sprintf(
'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente=%s',
$agent['id_agente']
);
}
if (empty($agent['alias']) === true) {
@ -825,7 +833,7 @@ if ($agents !== false) {
);
}
if ((int) $agent['id_os'] !== 100) {
if ((int) $agent['id_os'] != CLUSTER_OS_ID) {
$additionalOptionsAgentName[] = html_print_anchor(
[
'href' => ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$agent['id_agente']),
@ -837,7 +845,7 @@ if ($agents !== false) {
$additionalOptionsAgentName[] = html_print_anchor(
[
'href' => ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente='.$agent['id_agente']),
'href' => ui_get_full_url($agentAlertUrl),
'content' => __('Alerts'),
],
true
@ -942,7 +950,7 @@ if ($agents !== false) {
$os
)
),
'onClick' => ($agent['id_os'] === CLUSTER_OS_ID) ? sprintf('if (!confirm(\'%s\')) return false', $agentDisableEnableCaption) : 'return true;',
'onClick' => ($agent['id_os'] == CLUSTER_OS_ID) ? sprintf('if (!confirm(\'%s\')) return false', $agentDisableEnableCaption) : 'return true;',
'image' => sprintf('images/%s', $agentDisableEnableIcon),
'title' => $agentDisableEnableTitle,
],
@ -950,7 +958,7 @@ if ($agents !== false) {
);
if ($check_aw === true && is_management_allowed() === true) {
if ($agent['id_os'] !== CLUSTER_OS_ID) {
if ($agent['id_os'] != CLUSTER_OS_ID) {
$onClickActionDeleteAgent = 'if (!confirm(\' '.__('Are you sure?').'\')) return false;';
} else {
$onClickActionDeleteAgent = 'if (!confirm(\' '.__('WARNING! - You are going to delete a cluster agent. Are you sure?').'\')) return false;';

View File

@ -405,6 +405,12 @@ $actions = array_slice($actions, $offset, $limit);
$rowPair = true;
$iterator = 0;
foreach ($actions as $action) {
if ((isset($config['ITSM_enabled']) === false || (bool) $config['ITSM_enabled'] === false)
&& $action['name'] === 'Create&#x20;Pandora&#x20;ITSM&#x20;ticket'
) {
continue;
}
if ($rowPair) {
$table->rowclass[$iterator] = 'rowPair';
} else {

View File

@ -1,16 +1,33 @@
<?php
/**
* Alerts commands.
*
* @category Alerts
* @package Pandora FMS
* @subpackage Opensource
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2023 Pandora FMS
* Please see https://pandorafms.com/community/ for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
use PandoraFMS\ITSM\ITSM;
// Pandora FMS - https://pandorafms.com
// ==================================================
// Copyright (c) 2005-2023 Pandora FMS
// Please see https://pandorafms.com/community/ for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars.
global $config;
@ -51,9 +68,9 @@ if (is_ajax()) {
$get_recovery_fields = (int) get_parameter('get_recovery_fields', 1);
// Snmp alerts are not in the metaconsole so they cannot be centralized.
$is_management_allowed = false;
$management_is_not_allowed = false;
if ($get_recovery_fields !== 0) {
$is_management_allowed = !is_management_allowed();
$management_is_not_allowed = !is_management_allowed();
}
// If command ID is not provided, check for action id.
@ -135,6 +152,17 @@ if (is_ajax()) {
$style = ((int) $field_hidden === 1) ? '-webkit-text-security: disc; font-family: text-security-disc;' : '';
$recovery_disabled = 0;
if (empty($command) === false && $command['name'] === io_safe_input('Pandora ITSM Ticket')) {
if ($management_is_not_allowed == 0) {
if (preg_match('/^_html_editor_$/i', $field_value) || $field_description === 'Ticket status') {
$recovery_disabled = 0;
} else {
$recovery_disabled = 1;
}
}
}
if (!empty($field_value)) {
$field_value = io_safe_output($field_value);
// HTML type.
@ -150,7 +178,7 @@ if (is_ajax()) {
0,
'',
false,
$is_management_allowed,
$management_is_not_allowed,
"UndefineTinyMCE('#textarea_field".$i."_value')",
'',
true
@ -162,7 +190,7 @@ if (is_ajax()) {
0,
'',
true,
$is_management_allowed,
$management_is_not_allowed,
"defineTinyMCE('#textarea_field".$i."_value')",
'',
true
@ -177,7 +205,7 @@ if (is_ajax()) {
'class="fields w100p"',
true,
'',
$is_management_allowed
$management_is_not_allowed
);
$editor_type_chkbx = '<div id="command_div"><b><small>';
@ -187,7 +215,7 @@ if (is_ajax()) {
0,
'',
false,
$is_management_allowed,
$management_is_not_allowed,
"UndefineTinyMCE('#textarea_field".$i."_recovery_value')",
'',
true
@ -199,7 +227,7 @@ if (is_ajax()) {
0,
'',
true,
$is_management_allowed,
$management_is_not_allowed,
"defineTinyMCE('#textarea_field".$i."_recovery_value')",
'',
true
@ -214,7 +242,7 @@ if (is_ajax()) {
'class="fields_recovery"',
true,
'',
$is_management_allowed
$management_is_not_allowed || $recovery_disabled
);
} else if (preg_match('/^_content_type_$/i', $field_value)) {
$editor_type_chkbx = '<div id="command_div"><b><small>';
@ -228,7 +256,7 @@ if (is_ajax()) {
'text/plain',
'',
'',
$is_management_allowed,
$management_is_not_allowed,
'',
'',
true
@ -240,7 +268,7 @@ if (is_ajax()) {
'text/html',
'',
'text/html',
$is_management_allowed,
$management_is_not_allowed,
'',
'',
true
@ -259,7 +287,7 @@ if (is_ajax()) {
'text/plain',
'',
'',
$is_management_allowed,
$management_is_not_allowed,
'',
'',
true
@ -271,7 +299,7 @@ if (is_ajax()) {
'text/html',
'',
'text/html',
$is_management_allowed,
$management_is_not_allowed,
'',
'',
true
@ -279,78 +307,304 @@ if (is_ajax()) {
$editor_type_chkbx .= '</small></b></div>';
$rfield = $editor_type_chkbx;
// Select type.
} else if (preg_match('/^_integria_type_custom_field_$/i', $field_value)) {
$ffield = '';
$rfield = '';
} else if (preg_match('/^_custom_field_ITSM_$/i', $field_value)) {
$ffield = '';
$rfield = '';
$ffield .= '<div name="field'.$i.'_value_container">'.html_print_switch(
[
'name' => 'field'.$i.'_value[]',
'value' => '',
]
).'</div>';
$rfield .= '<div name="field'.$i.'_recovery_value_container">'.html_print_switch(
[
'name' => 'field'.$i.'_recovery_value[]',
'value' => '',
]
).'</div>';
$ffield .= '<div name="field'.$i.'_value_container">'.html_print_switch(
[
'name' => 'field'.$i.'_value[]',
'value' => '',
]
).'</div>';
$rfield .= '<div name="field'.$i.'_recovery_value_container">'.html_print_switch(
[
'name' => 'field'.$i.'_recovery_value[]',
'value' => '',
'disabled' => $management_is_not_allowed || $recovery_disabled,
]
).'</div>';
$ffield .= html_print_select(
'',
'field'.$i.'_value[]',
$ffield .= html_print_select(
'',
'field'.$i.'_value[]',
'',
'',
__('None'),
'',
true,
false,
false,
'fields',
$management_is_not_allowed,
'width: 100%;',
false,
false,
false,
'',
false,
false,
false,
false,
false
);
$rfield .= html_print_select(
'',
'field'.$i.'_recovery_value[]',
'',
'',
__('None'),
'',
true,
false,
false,
'fields',
$management_is_not_allowed || $recovery_disabled,
'width: 100%;',
false,
false,
false,
'',
false,
false,
false,
false,
false
);
$ffield .= html_print_input_text(
'field'.$i.'_value[]',
'',
'',
50,
50,
true,
false,
false,
'',
'datepicker',
'',
'off',
false,
'',
'',
'',
$management_is_not_allowed
);
$rfield .= html_print_input_text(
'field'.$i.'_recovery_value[]',
'',
'',
50,
50,
true,
false,
false,
'',
'datepicker',
'',
'off',
false,
'',
'',
'',
$management_is_not_allowed || $recovery_disabled
);
$ffield .= html_print_textarea(
'field'.$i.'_value[]',
5,
1,
'',
'style="min-height:40px; '.$style.'" class="fields"',
true,
'',
$management_is_not_allowed
);
$rfield .= html_print_textarea(
'field'.$i.'_recovery_value[]',
5,
1,
'',
'style="min-height:40px; '.$style.'" class="fields_recovery',
true,
'',
$management_is_not_allowed || $recovery_disabled
);
$values_input_number = [
'name' => 'field'.$i.'_value[]',
'value' => 0,
'id' => 'field'.$i.'_value',
'return' => true,
];
if ($management_is_not_allowed === true) {
$values_input_number['disabled'] = true;
}
$ffield .= html_print_input_number($values_input_number);
$values_input_number_recovery = [
'name' => 'field'.$i.'_recovery_value[]',
'value' => 0,
'id' => 'field'.$i.'_recovery_value',
'return' => true,
];
if ($management_is_not_allowed || $recovery_disabled) {
$values_input_number_recovery['disabled'] = true;
}
$rfield .= html_print_input_number($values_input_number_recovery);
$ffield .= html_print_input_text(
'field'.$i.'_value[]',
'',
'',
50,
255,
true,
false,
false,
'',
'normal w98p',
'',
'off',
false,
false,
'',
'',
$management_is_not_allowed
);
$rfield .= html_print_input_text(
'field'.$i.'_recovery_value[]',
'',
'',
50,
255,
true,
false,
false,
'',
'normal w98p',
'',
'off',
false,
false,
'',
'',
$management_is_not_allowed || $recovery_disabled
);
} else if (str_starts_with($field_value, '_ITSM_')) {
$nothing = '';
$nothing_value = 0;
$mode = 'select';
switch ($field_value) {
case '_ITSM_groups_':
$fields_array = [];
try {
$ITSM = new ITSM();
$fields_array = $ITSM->getGroups();
} catch (\Throwable $th) {
$error = $th->getMessage();
$fields_array = [];
}
break;
case '_ITSM_priorities_':
$fields_array = [];
try {
$ITSM = new ITSM();
$fields_array = $ITSM->getPriorities();
} catch (\Throwable $th) {
$error = $th->getMessage();
$fields_array = [];
}
break;
case '_ITSM_types_':
$fields_array = [];
try {
$ITSM = new ITSM();
$fields_array = $ITSM->getObjectypes();
} catch (\Throwable $th) {
$error = $th->getMessage();
$fields_array = [];
}
$nothing = __('None');
$nothing_value = 0;
break;
case '_ITSM_status_':
$fields_array = [];
try {
$ITSM = new ITSM();
$fields_array = $ITSM->getStatus();
} catch (\Throwable $th) {
$error = $th->getMessage();
$fields_array = [];
}
break;
default:
// Nothing.
$mode = '';
break;
}
if ($mode === 'select') {
$ffield = html_print_select(
$fields_array,
'field'.$i.'_value',
'',
'',
__('None'),
'',
$nothing,
$nothing_value,
true,
false,
false,
'fields',
$is_management_allowed,
'width: 100%;'
$management_is_not_allowed
);
$rfield .= html_print_select(
'',
'field'.$i.'_recovery_value[]',
$rfield = html_print_select(
$fields_array,
'field'.$i.'_recovery_value',
'',
'',
__('None'),
'',
$nothing,
$nothing_value,
true,
false,
false,
'fields',
$is_management_allowed,
'width: 100%;'
'fields_recovery',
$management_is_not_allowed || $recovery_disabled
);
$ffield .= html_print_input_text('field'.$i.'_value[]', '', '', 10, 10, true, false, false, '', 'datepicker');
$rfield .= html_print_input_text('field'.$i.'_recovery_value[]', '', '', 10, 10, true, false, false, '', 'datepicker');
$ffield .= html_print_textarea(
'field'.$i.'_value[]',
5,
1,
} else {
$ffield = html_print_autocomplete_users_from_pandora_itsm(
'field'.$i.'_value',
'',
'style="min-height:40px; '.$style.'" class="fields"',
true,
'',
$is_management_allowed
0,
$management_is_not_allowed,
false,
'ITSM_users'
);
$rfield .= html_print_textarea(
'field'.$i.'_recovery_value[]',
5,
1,
$rfield = html_print_autocomplete_users_from_pandora_itsm(
'field'.$i.'_recovery_value',
'',
'style="min-height:40px; '.$style.'" class="fields_recovery',
true,
'',
$is_management_allowed
0,
$management_is_not_allowed || $recovery_disabled,
false,
'ITSM_users'
);
}
} else {
$fields_value_select = [];
$force_print_select = false;
@ -468,7 +722,7 @@ if (is_ajax()) {
false,
false,
'fields',
$is_management_allowed
$management_is_not_allowed
);
$rfield = html_print_select(
$fields_value_select,
@ -481,7 +735,7 @@ if (is_ajax()) {
false,
false,
'fields_recovery',
$is_management_allowed
$management_is_not_allowed || $recovery_disabled
);
} else {
$ffield = html_print_textarea(
@ -492,7 +746,7 @@ if (is_ajax()) {
'style="'.$style.'" class="fields min-height-40px w100p"',
true,
'',
$is_management_allowed
$management_is_not_allowed
);
$rfield = html_print_textarea(
'field'.$i.'_recovery_value',
@ -502,7 +756,7 @@ if (is_ajax()) {
'style="'.$style.'" class="fields_recovery min-height-40px w100p',
true,
'',
$is_management_allowed
$management_is_not_allowed || $recovery_disabled
);
}
}
@ -515,7 +769,7 @@ if (is_ajax()) {
'style="'.$style.'" class="fields min-height-40px w100p"',
true,
'',
$is_management_allowed
$management_is_not_allowed
);
$rfield = html_print_textarea(
'field'.$i.'_recovery_value',
@ -525,7 +779,7 @@ if (is_ajax()) {
'style="'.$style.'" class="fields_recovery min-height-40px w100p"',
true,
'',
$is_management_allowed
$management_is_not_allowed || $recovery_disabled
);
}
@ -684,9 +938,7 @@ if ($delete_command) {
$result = alerts_delete_alert_command($id);
$auditMessage = ((bool) $result === true)
? sprintf('Delete alert command #%s', $id)
: sprintf('Fail try to delete alert command #%s', $id);
$auditMessage = ((bool) $result === true) ? sprintf('Delete alert command #%s', $id) : sprintf('Fail try to delete alert command #%s', $id);
db_pandora_audit(
AUDIT_LOG_ALERT_MANAGEMENT,
@ -775,6 +1027,12 @@ $commands = array_slice($commands, $offset, $limit);
foreach ($commands as $command) {
$data = [];
if ((isset($config['ITSM_enabled']) === false || (bool) $config['ITSM_enabled'] === false)
&& $command['name'] === 'Pandora&#x20;ITSM&#x20;Ticket'
) {
continue;
}
$data['name'] = '<span>';
// (IMPORTANT, DO NOT CHANGE!) only users with permissions over "All" group have access to edition of commands belonging to "All" group.

View File

@ -105,8 +105,8 @@ $groups_user = users_get_groups($config['id_user']);
if (!empty($groups_user)) {
$groups = implode(',', array_keys($groups_user));
if ($config['integria_enabled'] == 0) {
$integria_command = 'Integria&#x20;IMS&#x20;Ticket';
if ($config['ITSM_enabled'] == 0) {
$integria_command = 'Pandora&#x20;ITSM&#x20;Ticket';
$sql = sprintf('SELECT taa.id, taa.name FROM talert_actions taa INNER JOIN talert_commands tac ON taa.id_alert_command = tac.id WHERE tac.name <> "%s" AND taa.id_group IN (%s)', $integria_command, $groups);
} else {
$sql = "SELECT id, name FROM talert_actions WHERE id_group IN ($groups)";
@ -206,9 +206,10 @@ $table->data[2][0] = html_print_label_input_block(
if (isset($step) === false) {
echo '<form id="form_alerts" class="add_alert_form max_floating_element_size" method="post">';
html_print_table($table);
}
html_print_table($table);
if (isset($step) === false) {
$output = '';

View File

@ -620,7 +620,21 @@ foreach ($simple_alerts as $alert) {
$main_tab = 'module';
}
$data[0] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab='.$main_tab.'&id_agente='.$id_agent.'">';
if ((int) agents_get_os($id_agent) === CLUSTER_OS_ID) {
$cluster = PandoraFMS\Cluster::loadFromAgentId($id_agent);
$agentAlertUrl = sprintf(
'index.php?sec=estado&sec2=operation/cluster/cluster&op=update&id=%s&page=6',
$cluster->id()
);
} else {
$agentAlertUrl = sprintf(
'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=%s&id_agente=%s',
$main_tab,
$id_agent
);
}
$data[0] = '<a href="'.$agentAlertUrl.'">';
if ($alert['disabled']) {
$data[0] .= '<span class="italic_a">';

View File

@ -650,6 +650,11 @@ if ($id_agente) {
echo $messageAction;
include_once 'godmode/alerts/alert_list.list.php';
if (isset($step) === true && $step === true) {
return;
}
$all_groups = agents_get_all_groups_agent($id_agente, $agent['id_grupo']);
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'LW') || check_acl_one_of_groups($config['id_user'], $all_groups, 'LM')) {
include_once 'godmode/alerts/alert_list.builder.php';

View File

@ -11,12 +11,12 @@
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
use PandoraFMS\ITSM\ITSM;
// Load global vars.
global $config;
require_once $config['homedir'].'/include/functions_alerts.php';
require_once $config['homedir'].'/include/functions_users.php';
require_once $config['homedir'].'/include/functions_integriaims.php';
enterprise_include_once('meta/include/functions_alerts_meta.php');
check_login();
@ -39,11 +39,19 @@ if (is_ajax()) {
$get_integria_ticket_custom_types = (bool) get_parameter('get_integria_ticket_custom_types');
if ($get_integria_ticket_custom_types) {
$ticket_type_id = get_parameter('ticket_type_id');
$ticket_type_id = (int) get_parameter('ticket_type_id', 0);
if (empty($ticket_type_id) === false) {
$error = '';
try {
$ITSM = new ITSM();
$fields = $ITSM->getObjecTypesFields($ticket_type_id);
} catch (\Throwable $th) {
$error = $th->getMessage();
}
$api_call = integria_api_call(null, null, null, null, 'get_incident_fields', $ticket_type_id, false, 'json');
echo json_encode($fields);
}
echo $api_call;
return;
}
}
@ -150,6 +158,22 @@ if ($id) {
$action = alerts_get_alert_action($id);
$name = $action['name'];
$id_command = $action['id_alert_command'];
$command = alerts_get_alert_command($id_command);
if (empty($command) === false && $command['name'] === io_safe_input('Pandora ITSM Ticket')) {
$action['field1'] = io_safe_output(($action['field1'] ?? $config['incident_title']));
$action['field2'] = io_safe_output(($action['field2'] ?? $config['default_group']));
$action['field3'] = io_safe_output(($action['field3'] ?? $config['default_criticity']));
$action['field4'] = io_safe_output(($action['field4'] ?? $config['default_owner']));
$action['field5'] = io_safe_output(($action['field5'] ?? $config['incident_type']));
$action['field6'] = io_safe_output(($action['field6'] ?? $config['incident_status']));
$action['field7'] = io_safe_output(($action['field7'] ?? $config['incident_content']));
$action['field2_recovery'] = io_safe_output(($action['field2'] ?? $config['default_group']));
$action['field3_recovery'] = io_safe_output(($action['field3'] ?? $config['default_criticity']));
$action['field4_recovery'] = io_safe_output(($action['field4'] ?? $config['default_owner']));
$action['field5_recovery'] = io_safe_output(($action['field5'] ?? $config['incident_type']));
$action['field6_recovery'] = io_safe_output(($action['field6_recovery'] ?? $config['incident_status']));
$action['field7_recovery'] = io_safe_output(($action['field7_recovery'] ?? $config['incident_content']));
}
$group = $action['id_group'];
$action_threshold = $action['action_threshold'];
@ -235,11 +259,11 @@ $table->data[0][1] = html_print_label_input_block(
)
);
$create_ticket_command_id = db_get_value('id', 'talert_commands', 'name', io_safe_input('Integria IMS Ticket'));
$create_ticket_command_id = db_get_value('id', 'talert_commands', 'name', io_safe_input('Pandora ITSM Ticket'));
$sql_exclude_command_id = '';
if (!is_metaconsole() && $config['integria_enabled'] == 0 && $create_ticket_command_id !== false) {
if (!is_metaconsole() && $config['ITSM_enabled'] == 0 && $create_ticket_command_id !== false) {
$sql_exclude_command_id = ' AND id <> '.$create_ticket_command_id;
}
@ -355,24 +379,26 @@ $table_macros->data[1][2] = html_print_label_input_block(
)
);
// Selector will work only with Integria activated.
$integriaIdName = 'integria_wu';
$table_macros->colspan[$integriaIdName][0] = 3;
$table_macros->data[$integriaIdName][0] = html_print_label_input_block(
__('Create workunit on recovery').ui_print_help_tip(
__('If closed status is set on recovery, a workunit will be added to the ticket in Integria IMS rather that closing the ticket.'),
true
),
html_print_checkbox_switch_extended(
'create_wu_integria',
1,
$create_wu_integria,
false,
'',
$disabled_attr,
true
)
);
if (empty($command) === false && $command['name'] === io_safe_input('Pandora ITSM Ticket')) {
// Selector will work only with Integria activated.
$integriaIdName = 'integria_wu';
$table_macros->colspan[$integriaIdName][0] = 3;
$table_macros->data[$integriaIdName][0] = html_print_label_input_block(
__('Create workunit on recovery').ui_print_help_tip(
__('If closed status is set on recovery, a workunit will be added to the ticket in Pandora ITSM rather that closing the ticket.'),
true
),
html_print_checkbox_switch_extended(
'create_wu_integria',
1,
$create_wu_integria,
false,
'',
$disabled_attr,
true
)
);
}
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
$table_macros->data['field'.$i][0] = html_print_image(
@ -504,7 +530,6 @@ $(document).ready (function () {
},
function(data) {
var max_macro_fields = <?php echo $config['max_macro_fields']; ?>;
data.forEach(function(custom_field, key) {
var custom_field_key = key+8; // Custom fields start from field 8.
@ -523,9 +548,9 @@ $(document).ready (function () {
custom_field_row.html(new_html_content);
switch (custom_field.type) {
case 'checkbox':
var checkbox_selector = $('input:not(.datepicker)[name=field'+custom_field_key+'_value\\[\\]]');
var checkbox_recovery_selector = $('input:not(.datepicker)[name=field'+custom_field_key+'_recovery_value\\[\\]]');
case 'CHECKBOX':
var checkbox_selector = $('input[type="checkbox"][name=field'+custom_field_key+'_value\\[\\]]');
var checkbox_recovery_selector = $('input[type="checkbox"][name=field'+custom_field_key+'_recovery_value\\[\\]]');
checkbox_selector.on('change', function() {
if (checkbox_selector.prop('checked')) {
@ -565,17 +590,17 @@ $(document).ready (function () {
$('[name=field'+custom_field_key+'_value_container]').show();
$('[name=field'+custom_field_key+'_recovery_value_container]').show();
$('input:not(.datepicker)[name=field'+custom_field_key+'_value\\[\\]]').show();
$('input:not(.datepicker)[name=field'+custom_field_key+'_recovery_value\\[\\]]').show();
$('input[type="checkbox"][name=field'+custom_field_key+'_value\\[\\]]').show();
$('input[type="checkbox"][name=field'+custom_field_key+'_recovery_value\\[\\]]').show();
break;
case 'combo':
case 'COMBO':
var combo_input = $('select[name=field'+custom_field_key+'_value\\[\\]]');
var combo_input_recovery = $('select[name=field'+custom_field_key+'_recovery_value\\[\\]]');
combo_input.find('option').remove();
combo_input_recovery.find('option').remove();
var combo_values_array = custom_field.combo_value.split(',');
var combo_values_array = custom_field.comboValue.split(',');
combo_values_array.forEach(function(value) {
combo_input.append($('<option>', {
@ -600,16 +625,15 @@ $(document).ready (function () {
combo_input.show();
combo_input_recovery.show();
break;
case 'date':
case 'DATE':
$('input.datepicker[type="text"][name=field'+custom_field_key+'_value\\[\\]]').removeClass("hasDatepicker");
$('input.datepicker[type="text"][name=field'+custom_field_key+'_recovery_value\\[\\]]').removeClass("hasDatepicker");
$('input.datepicker[type="text"][name=field'+custom_field_key+'_value\\[\\]]').datepicker("destroy");
$('input.datepicker[type="text"][name=field'+custom_field_key+'_recovery_value\\[\\]]').datepicker("destroy");
$('input.datepicker[type="text"][name=field'+custom_field_key+'_value\\[\\]]').show();
$('input.datepicker[type="text"][name=field'+custom_field_key+'_recovery_value\\[\\]]').show();
$('input.datepicker[type="text"][name=field'+custom_field_key+'_value\\[\\]]').datepicker({dateFormat: "<?php echo DATE_FORMAT_JS; ?>"});
$('input.datepicker[type="text"][name=field'+custom_field_key+'_recovery_value\\[\\]]').datepicker({dateFormat: "<?php echo DATE_FORMAT_JS; ?>"});
$('input.datepicker[type="text"][name=field'+custom_field_key+'_value\\[\\]]').datepicker({dateFormat: "<?php echo 'yy-mm-dd 00:00:00'; ?>"});
$('input.datepicker[type="text"][name=field'+custom_field_key+'_recovery_value\\[\\]]').datepicker({dateFormat: "<?php echo 'yy-mm-dd 00:00:00'; ?>"});
$.datepicker.setDefaults($.datepicker.regional[ "<?php echo get_user_language(); ?>"]);
if (typeof values[key] !== "undefined") {
@ -620,9 +644,32 @@ $(document).ready (function () {
$('input.datepicker[type="text"][name=field'+custom_field_key+'_recovery_value\\[\\]]').val(recovery_values[key]);
}
break;
case 'text':
case 'textarea':
case 'numeric':
case 'NUMERIC':
if (typeof values[key] !== "undefined") {
$('input[type="number"][name=field'+custom_field_key+'_value\\[\\]]').val(values[key]);
}
if (typeof recovery_values[key] !== "undefined") {
$('input[type="number"][name=field'+custom_field_key+'_recovery_value\\[\\]]').val(recovery_values[key]);
}
$('input[type="number"][name=field'+custom_field_key+'_value\\[\\]]').show();
$('input[type="number"][name=field'+custom_field_key+'_recovery_value\\[\\]]').show();
break;
case 'TEXT':
if (typeof values[key] !== "undefined") {
$('input.normal[type="text"][name=field'+custom_field_key+'_value\\[\\]]').val(values[key]);
}
if (typeof recovery_values[key] !== "undefined") {
$('input.normal[type="text"][name=field'+custom_field_key+'_recovery_value\\[\\]]').val(recovery_values[key]);
}
$('input.normal[type="text"][name=field'+custom_field_key+'_value\\[\\]]').show();
$('input.normal[type="text"][name=field'+custom_field_key+'_recovery_value\\[\\]]').show();
break;
case 'TEXTAREA':
default:
if (typeof values[key] !== "undefined") {
$('textarea[name=field'+custom_field_key+'_value\\[\\]]').val(values[key]);
}
@ -646,13 +693,20 @@ $(document).ready (function () {
// No se envia el valor del commando.
values.push({
name: "page",
value: "godmode/alerts/alert_commands"});
value: "godmode/alerts/alert_commands"
});
values.push({
name: "get_alert_command",
value: "1"});
value: "1"
});
values.push({
name: "id",
value: this.value});
value: this.value
});
values.push({
name: "id_action",
value: "<?php echo (int) $id; ?>"
});
jQuery.post (<?php echo "'".ui_get_full_url('ajax.php', false, false, false)."'"; ?>,
values,
@ -664,14 +718,6 @@ $(document).ready (function () {
render_command_description(command_description);
} else {
render_command_description('');
}
// Allow create workunit if Integria IMS Ticket is selected.
if (data['id'] == '14') {
$("#table_macros-"+integriaWorkUnitName).css('display', 'table-row');
} else {
$("#table_macros-"+integriaWorkUnitName).css('display', 'none');
}
var max_fields = parseInt('<?php echo $config['max_macro_fields']; ?>');
@ -699,12 +745,73 @@ $(document).ready (function () {
old_value = '';
old_recovery_value = '';
// Only keep the value if is provided from hidden (first time)
if (($("[name=field" + i + "_value]").attr('id'))
== ("hidden-field" + i + "_value")) {
if (($("[name=field" + i + "_value]").attr('id')) == ("hidden-field" + i + "_value")) {
old_value = $("[name=field" + i + "_value]").val();
disabled = $("[name=field" + i + "_value]").attr('disabled');
}
if ($("#id_command option:selected").text() === "Pandora ITSM Ticket" && (!old_value || !old_recovery_value) ) {
if (i === 1) {
if(!old_value) {
old_value = '<?php echo io_safe_output($config['incident_title']); ?>';
}
if(!old_recovery_value) {
old_recovery_value = '<?php echo io_safe_output($config['incident_title']); ?>';
}
} else if (i === 2) {
if(!old_value || old_value == 0) {
old_value = '<?php echo io_safe_output($config['default_group']); ?>';
}
if(!old_recovery_value) {
old_recovery_value = '<?php echo io_safe_output($config['default_group']); ?>';
}
} else if (i === 3) {
if(!old_value) {
old_value = '<?php echo io_safe_output($config['default_criticity']); ?>';
}
if(!old_recovery_value) {
old_recovery_value = '<?php echo io_safe_output($config['default_criticity']); ?>';
}
} else if (i === 4) {
if(!old_value) {
old_value = '<?php echo io_safe_output($config['default_owner']); ?>';
}
if(!old_recovery_value) {
old_recovery_value = '<?php echo io_safe_output($config['default_owner']); ?>';
}
} else if (i === 5) {
if(!old_value) {
old_value = '<?php echo io_safe_output($config['incident_type']); ?>';
}
if(!old_recovery_value) {
old_recovery_value = '<?php echo io_safe_output($config['incident_type']); ?>';
}
} else if (i === 6) {
if(!old_value) {
old_value = '<?php echo io_safe_output($config['incident_status']); ?>';
}
if(!old_recovery_value) {
old_recovery_value = '<?php echo io_safe_output($config['incident_status']); ?>';
}
} else if (i === 7) {
var text = '<?php echo $config['incident_content']; ?>';
if(!old_value) {
old_value = text;
}
if(!old_recovery_value) {
old_recovery_value = text;
}
}
}
if (($("[name=field" + i + "_recovery_value]").attr('id'))
== ("hidden-field" + i + "_recovery_value")) {
@ -742,17 +849,20 @@ $(document).ready (function () {
}
else {
var is_element_select = $("[name=field" + i + "_value]").is("select");
var is_element_autocomplete_users_itsm = $("[name=field" + i + "_value]").hasClass("ITSM_users");
$("[name=field" + i + "_value]").val(old_value);
if (is_element_select === true) {
$("[name=field" + i + "_value]").trigger('change');
} else if (is_element_autocomplete_users_itsm === true) {
$("[name=field" + i + "_value_hidden]").val(old_value);
}
$("[name=field" + i + "_recovery_value]").val(old_recovery_value);
if (is_element_select === true) {
$("[name=field" + i + "_recovery_value]").trigger('change');
} else if (is_element_autocomplete_users_itsm === true) {
$("[name=field" + i + "_recovery_value_hidden]").val(old_recovery_value);
}
}
}
@ -767,7 +877,7 @@ $(document).ready (function () {
}
}
if ($("#id_command option:selected").text() === "Integria IMS Ticket" && i > 7) {
if ($("#id_command option:selected").text() === "Pandora ITSM Ticket" && i > 7) {
integria_custom_fields_values.push(old_value);
integria_custom_fields_rvalues.push(old_recovery_value);
}
@ -789,9 +899,9 @@ $(document).ready (function () {
$table_macros_field.show();
}
// Ad-hoc solution for Integria IMS command: get Integia IMS Ticket custom fields only when this command is selected and we selected a ticket type to retrieve fields from.
// Ad-hoc solution for Pandora ITSM command: get Integia IMS Ticket custom fields only when this command is selected and we selected a ticket type to retrieve fields from.
// Check command by name since it is unvariable in any case, unlike its ID.
if ($("#id_command option:selected").text() === "Integria IMS Ticket") {
if ($("#id_command option:selected").text() === "Pandora ITSM Ticket") {
var max_macro_fields = <?php echo $config['max_macro_fields']; ?>;
// At start hide all rows and inputs corresponding to custom fields, regardless of what its type is.

View File

@ -374,6 +374,9 @@ function update_template($step)
$max = (float) get_parameter('max');
$min = (float) get_parameter('min');
$matches = (bool) get_parameter('matches_value');
$math_function = (string) get_parameter('math_function');
$condition = (string) get_parameter('condition');
$time_window = (string) get_parameter('time_window');
$default_action = (int) get_parameter('default_action');
if (empty($default_action) === true) {
@ -394,6 +397,9 @@ function update_template($step)
'min_value' => $min,
'matches_value' => $matches,
'disable_event' => $disable_event,
'math_function' => $math_function,
'condition' => $condition,
'time_window' => $time_window,
];
$result = alerts_update_alert_template($id, $values);
@ -607,6 +613,9 @@ if ($id && ! $create_template) {
$max = $template['max_value'];
$min = $template['min_value'];
$matches = $template['matches_value'];
$math_function = $template['math_function'];
$condition = $template['condition'];
$time_window = $template['time_window'];
$schedule = json_encode(
$default_events_calendar
@ -856,6 +865,58 @@ if ($step == 2) {
).'</span>'
);
$table->data['math_function'][0] = html_print_label_input_block(
__('Math function'),
html_print_select(
alerts_get_alert_templates_functions(),
'math_function',
$math_function,
'',
__('None'),
0,
true,
false,
false,
'w100p',
(!$is_management_allowed | $disabled)
)
);
$table->data['time_window'][0] = html_print_label_input_block(
__('Time window').ui_print_help_tip(__('Limits to data in the following time window.'), true),
html_print_select(
alerts_get_alert_templates_windows(),
'time_window',
$time_window,
'',
__('None'),
0,
true,
false,
false,
'w100p',
(!$is_management_allowed | $disabled)
)
);
$table->data['condition'][0] = html_print_label_input_block(
__('Alert condition'),
html_print_select(
alerts_get_alert_templates_conditions(),
'condition',
$condition,
'',
__('None'),
0,
true,
false,
false,
'w100p',
(!$is_management_allowed | $disabled)
)
);
$table->data['value'][1] = html_print_label_input_block(
__('Value'),
html_print_input_text(
@ -1088,6 +1149,12 @@ if ($step == 2) {
$table->rowstyle['min'] = '';
break;
case 'complex':
$table->rowstyle['math_function'] = '';
$table->rowstyle['condition'] = '';
$table->rowstyle['time_window'] = '';
break;
case 'onchange':
$show_matches = true;
break;
@ -1299,6 +1366,7 @@ var onchange_not = <?php echo '"'.__('The alert would fire when the module value
var unknown = <?php echo "'".__('The alert would fire when the module is in unknown status')."'"; ?>;
var error_message_min_max_zero = <?php echo "'".__('The alert template cannot have the same value for min and max thresholds.')."'"; ?>;
var not_normal = <?php echo "'".__('The alert would fire when the module is in not normal status')."'"; ?>;
var complex = <?php echo "'".__('Alert would fire when the <span id="math_function"></span> within <span id="time_window"></span> <span id="condition"></span> <span id="value"></span>')."'"; ?>;
function check_fields_step2() {
var correct = true;
@ -1361,6 +1429,68 @@ function render_example () {
else {
$("span#value").empty ().append (vvalue);
}
/* Set math function */
var vfunction = $("select#math_function").val();
var functionMessage = "";
if (vfunction == "0") {
functionMessage = "<em><?php echo __('[function]'); ?></em>";
} else {
if (vfunction == "avg"){
$("span#value").empty ();
}
functionMessage = vfunction;
}
$("span#math_function").empty ().append (functionMessage);
/* Set complex value */
if($("select#type").val() == "complex"){
var valueMessage = "";
if(vfunction == "avg"){
valueMessage = "";
}else if (vvalue == "") {
valueMessage = "<em><?php echo __('[value]'); ?></em>" ;
} else {
valueMessage = vvalue;
}
$("span#value").empty ().append (valueMessage);
}
/* Set condition */
var vCondition = $("select#condition").val();
var conditionMessage = "<em><?php echo __('[condition]'); ?></em>" ;
switch (vCondition){
case "greater":
conditionMessage = (vfunction == "avg") ? "increases" : "is more than";
break
case "lower":
conditionMessage = (vfunction == "avg") ? "decreases" : "is less than";
break
case "equal":
conditionMessage = (vfunction == "avg") ? "remains the same" : "is equal to";
break
}
$("span#condition").empty ().append (conditionMessage);
var vWindow = $("select#time_window").val();
/* Set time window */
var timeWindowMessages = {
"thirty_days": "the last 30 days",
"month": "the last month",
"seven_days": "the last 7 days",
"week": "the last week",
"one_day": "the last 24 hours",
"today": "today"
};
var windowMessage = timeWindowMessages[vWindow] || "<em><?php echo __(' the last [window]'); ?></em>";
$("span#time_window").empty().append(windowMessage);
}
// Fix for metaconsole toggle
@ -1388,6 +1518,18 @@ if ($step == 2) {
$("input#text-value").keyup (render_example);
$("input#text-max").keyup (render_example);
$("input#text-min").keyup (render_example);
$("#condition").change (render_example);
$("#time_window").change (render_example);
$("#math_function").change (function () {
if (["0", 'avg'].includes(this.value)) {
$("#template-value").hide();
} else {
$("#template-value").show ();
}
render_example ();
})
$("#type").change (function () {
switch (this.value) {
@ -1395,6 +1537,7 @@ if ($step == 2) {
case "not_equal":
$("img#regex_good, img#regex_bad, span#matches_value").hide ();
$("#template-max, #template-min").hide ();
$("#template-math_function, #template-condition, #template-time_window").hide ();
$("#template-value, #template-example").show ();
/* Show example */
@ -1405,6 +1548,7 @@ if ($step == 2) {
break;
case "regex":
$("#template-max, #template-min").hide ();
$("#template-math_function, #template-condition, #template-time_window").hide ();
$("#template-value, #template-example, span#matches_value").show ();
check_regex ();
@ -1416,6 +1560,7 @@ if ($step == 2) {
break;
case "max_min":
$("#template-value").hide ();
$("#template-math_function, #template-condition, #template-time_window").hide ();
$("#template-max, #template-min, #template-example, span#matches_value").show ();
/* Show example */
@ -1424,9 +1569,25 @@ if ($step == 2) {
else
$("span#example").empty ().append (between_not);
break;
case "complex":
$("pan#matches_value, #template-example, #template-value, #template-max, #template-min").hide ();
$("#template-math_function, #template-condition, #template-time_window").show ();
$("#template-example").show ();
if (["0", 'avg'].includes($("#math_function").val())) {
$("#template-value").hide();
}else {
$("#template-value").show();
}
/* Show example */
$("span#example").empty ().append (complex);
break;
case "max":
$("#template-value, #template-min, span#matches_value").hide ();
$("#template-math_function, #template-condition, #template-time_window").hide ();
$("#template-max, #template-example").show ();
/* Show example */
@ -1434,6 +1595,7 @@ if ($step == 2) {
break;
case "min":
$("#template-value, #template-max, span#matches_value").hide ();
$("#template-math_function, #template-condition, #template-time_window").hide ();
$("#template-min, #template-example").show ();
/* Show example */
@ -1441,6 +1603,7 @@ if ($step == 2) {
break;
case "warning":
$("#template-value, #template-max, span#matches_value, #template-min").hide ();
$("#template-math_function, #template-condition, #template-time_window").hide ();
$("#template-example").show ();
/* Show example */
@ -1448,6 +1611,7 @@ if ($step == 2) {
break;
case "critical":
$("#template-value, #template-max, span#matches_value, #template-min").hide ();
$("#template-math_function, #template-condition, #template-time_window").hide ();
$("#template-example").show ();
/* Show example */
@ -1455,6 +1619,7 @@ if ($step == 2) {
break;
case "not_normal":
$("#template-value, #template-max, span#matches_value, #template-min").hide ();
$("#template-math_function, #template-condition, #template-time_window").hide ();
$("#template-example").show ();
/* Show example */
@ -1462,6 +1627,7 @@ if ($step == 2) {
break;
case "onchange":
$("#template-value, #template-max, #template-min").hide ();
$("#template-math_function, #template-condition, #template-time_window").hide ();
$("#template-example, span#matches_value").show ();
/* Show example */
@ -1472,6 +1638,7 @@ if ($step == 2) {
break;
case "unknown":
$("#template-value, #template-max, span#matches_value, #template-min").hide ();
$("#template-math_function, #template-condition, #template-time_window").hide ();
$("#template-example").show ();
if ($("#text-min_alerts").val() > 0 ) {
@ -1483,6 +1650,7 @@ if ($step == 2) {
break;
default:
$("#template-value, #template-max, #template-min, #template-example, span#matches_value").hide ();
$("#template-math_function, #template-condition, #template-time_window").hide ();
break;
}

View File

@ -75,6 +75,12 @@ foreach ($event_responses as $response) {
continue;
}
if ((isset($config['ITSM_enabled']) === false || (bool) $config['ITSM_enabled'] === false)
&& $response['name'] === 'Create&#x20;ticket&#x20;in&#x20;Pandora&#x20;ITSM&#x20;from&#x20;event'
) {
continue;
}
$data = [];
$data[0] = '<a href="index.php?sec=geventos&sec2=godmode/events/events&section=responses&mode=editor&id_response='.$response['id'].'&amp;pure='.$config['pure'].'">'.$response['name'].'</a>';
$data[1] = $response['description'];

View File

@ -477,8 +477,8 @@ if ($access_console_node === true) {
$sub2['godmode/setup/setup&section=ehorus']['text'] = __('eHorus');
$sub2['godmode/setup/setup&section=ehorus']['refr'] = 0;
$sub2['godmode/setup/setup&section=integria']['text'] = __('Integria IMS');
$sub2['godmode/setup/setup&section=integria']['refr'] = 0;
$sub2['godmode/setup/setup&section=ITSM']['text'] = __('ITSM');
$sub2['godmode/setup/setup&section=ITSM']['refr'] = 0;
enterprise_hook('module_library_submenu');

View File

@ -200,6 +200,16 @@ $text_agent_module = '';
$only_data = false;
if (enterprise_installed() === true) {
$categories_security_hardening = categories_of_cis();
foreach ($categories_security_hardening as $key => $cat) {
$categories_security_hardening[$key] = implode(' ', $cat);
}
} else {
$categories_security_hardening = [];
}
// Users.
$id_users = [];
$users_groups = [];
@ -1019,6 +1029,51 @@ switch ($action) {
$idAgent = $item['id_agent'];
break;
case 'top_n_agents_sh':
$group = $item['id_group'];
$recursion = $item['recursion'];
$top_n_value = (empty($item['top_n_value']) === true) ? 10 : $item['top_n_value'];
break;
case 'top_n_checks_failed':
$group = $item['id_group'];
$recursion = $item['recursion'];
$top_n_value = (empty($item['top_n_value']) === true) ? 10 : $item['top_n_value'];
break;
case 'top_n_categories_checks':
$group = $item['id_group'];
$recursion = $item['recursion'];
$top_n_value = (empty($item['top_n_value']) === true) ? 10 : $item['top_n_value'];
break;
case 'vul_by_cat':
$group = $item['id_group'];
$recursion = $item['recursion'];
$cat_selected = $item['cat_security_hardening'];
$ignore_skipped = $item['ignore_skipped'];
break;
case 'list_checks':
$group = $item['id_group'];
$recursion = $item['recursion'];
$cat_selected = $item['cat_security_hardening'];
$status_of_check = $item['status_of_check'];
$idAgent = $item['id_agent'];
break;
case 'scoring':
$group = $item['id_group'];
$recursion = $item['recursion'];
$period = $item['period'];
break;
case 'evolution':
$group = $item['id_group'];
$recursion = $item['recursion'];
$period = $item['period'];
break;
default:
// It's not possible.
break;
@ -3757,6 +3812,64 @@ if (is_metaconsole() === true) {
?>
</td>
</tr>
<tr id="row_ignore_skipped" class="datos">
<td class="bolder">
<?php
echo __('Ignore skipped');
?>
</td>
<td>
<?php
html_print_checkbox_switch(
'ignore_skipped',
1,
($ignore_skipped !== null) ? $ignore_skipped : true,
);
?>
</td>
</tr>
<?php if (enterprise_installed() === true) : ?>
<tr id="row_cat_security_hardening" class="datos">
<td class="bolder">
<?php
echo __('Category');
?>
</td>
<td>
<?php
html_print_select(
$categories_security_hardening,
'cat_security_hardening',
$cat_selected,
);
?>
</td>
</tr>
<?php endif; ?>
<tr id="row_status_check" class="datos">
<td class="bolder">
<?php
echo __('Status of check');
?>
</td>
<td>
<?php
html_print_select(
[
'all' => __('All'),
'PASS' => __('Passed'),
'FAIL' => __('Failed'),
'INVALID' => __('Skipped'),
],
'status_of_check',
$status_of_check,
);
?>
</td>
</tr>
<?php
if ($is_enterprise) {
?>
@ -5085,6 +5198,10 @@ echo "<div id='message_no_group' title='".__('Item Editor Information')."' clas
echo "<p class='center bolder'>".__('Please select a group.').'</p>';
echo '</div>';
echo "<div id='message_no_max_item' title='".__('Max items')."' class='invisible'>";
echo "<p class='center bolder'>".__('Please insert max item number.').'</p>';
echo '</div>';
ui_require_javascript_file(
'pandora_inventory',
ENTERPRISE_DIR.'/include/javascript/'
@ -5418,7 +5535,7 @@ $(document).ready (function () {
return false;
}
break;
case 'permissions_report':
case 'permissions_report':
if ($("#checkbox-select_by_group").prop("checked") && $("select#users_groups>option:selected").val() == undefined) {
dialog_message('#message_no_group');
return false;
@ -5428,6 +5545,30 @@ $(document).ready (function () {
return false;
}
break;
case 'list_checks':
if ($("#text-agent").val() == '') {
dialog_message('#message_no_agent');
return false;
}
break;
case 'top_n_agents_sh':
if ($("#text-max_items").val() == '') {
dialog_message('#message_no_max_item');
return false;
}
break;
case 'top_n_checks_failed':
if ($("#text-max_items").val() == '') {
dialog_message('#message_no_max_item');
return false;
}
break;
case 'top_n_categories_checks':
if ($("#text-max_items").val() == '') {
dialog_message('#message_no_max_item');
return false;
}
break;
default:
break;
}
@ -5498,13 +5639,14 @@ $(document).ready (function () {
});
$("#submit-edit_item").click(function () {
$("#button-edit_item").click(function () {
var type = $('#type').val();
if($('#text-name').val() == ''){
dialog_message('#message_no_name');
return false;
}
switch (type){
case 'agent_module':
case 'agent_module_status':
@ -5557,6 +5699,30 @@ $(document).ready (function () {
return false;
}
break;
case 'list_checks':
if ($("#text-agent").val() == '') {
dialog_message('#message_no_agent');
return false;
}
break;
case 'top_n_agents_sh':
if ($("#text-max_items").val() == '') {
dialog_message('#message_no_max_item');
return false;
}
break;
case 'top_n_checks_failed':
if ($("#text-max_items").val() == '') {
dialog_message('#message_no_max_item');
return false;
}
break;
case 'top_n_categories_checks':
if ($("#text-max_items").val() == '') {
dialog_message('#message_no_max_item');
return false;
}
break;
default:
break;
@ -6630,6 +6796,9 @@ function chooseType() {
$("#row_group_by").hide();
$("#row_type_show").hide();
$("#row_use_prefix_notation").hide();
$("#row_cat_security_hardening").hide();
$("#row_ignore_skipped").hide();
$("#row_status_check").hide();
// SLA list default state.
$("#sla_list").hide();
@ -7484,7 +7653,44 @@ function chooseType() {
case 'ncm':
$("#row_agent").show();
break;
case 'top_n_agents_sh':
$("#row_group").show();
$("#row_max_items").show();
break;
case 'top_n_checks_failed':
$("#row_group").show();
$("#row_max_items").show();
break;
case 'top_n_categories_checks':
$("#row_group").show();
$("#row_max_items").show();
break;
case 'vul_by_cat':
$("#row_group").show();
$("#row_cat_security_hardening").show();
$("#row_ignore_skipped").show();
break;
case 'list_checks':
$("#row_group").show();
$("#row_agent").show();
$("#row_cat_security_hardening").show();
$("#row_status_check").show();
break;
case 'scoring':
$("#row_group").show();
$('#row_period').show();
break;
case 'evolution':
$("#row_group").show();
$('#row_period').show();
break;
}
switch (type) {

View File

@ -1990,6 +1990,50 @@ switch ($action) {
$good_format = true;
break;
case 'top_n_agents_sh':
$values['id_group'] = get_parameter('combo_group');
$values['top_n_value'] = get_parameter('max_items');
$good_format = true;
break;
case 'top_n_checks_failed':
$values['id_group'] = get_parameter('combo_group');
$values['top_n_value'] = get_parameter('max_items');
$good_format = true;
break;
case 'top_n_categories_checks':
$values['id_group'] = get_parameter('combo_group');
$values['top_n_value'] = get_parameter('max_items');
$good_format = true;
break;
case 'vul_by_cat':
$values['id_group'] = get_parameter('combo_group');
$values['cat_security_hardening'] = get_parameter('cat_security_hardening');
$values['ignore_skipped'] = get_parameter('ignore_skipped');
$good_format = true;
break;
case 'list_checks':
$values['id_group'] = get_parameter('combo_group');
$values['cat_security_hardening'] = get_parameter('cat_security_hardening');
$values['status_of_check'] = get_parameter('status_of_check');
$good_format = true;
break;
case 'scoring':
$values['id_group'] = get_parameter('combo_group');
$values['period'] = get_parameter('period');
$good_format = true;
break;
case 'evolution':
$values['id_group'] = get_parameter('combo_group');
$values['period'] = get_parameter('period');
$good_format = true;
break;
default:
$values['period'] = get_parameter('period');
$values['top_n'] = get_parameter(
@ -2019,6 +2063,7 @@ switch ($action) {
|| ($values['type'] == 'event_report_agent')
|| ($values['type'] == 'agent_configuration')
|| ($values['type'] == 'group_configuration')
|| ($values['type'] == 'list_checks')
) {
$values['id_agent_module'] = '';
} else {
@ -2866,6 +2911,50 @@ switch ($action) {
$good_format = true;
break;
case 'top_n_agents_sh':
$values['id_group'] = get_parameter('combo_group');
$values['top_n_value'] = get_parameter('max_items');
$good_format = true;
break;
case 'top_n_checks_failed':
$values['id_group'] = get_parameter('combo_group');
$values['top_n_value'] = get_parameter('max_items');
$good_format = true;
break;
case 'top_n_categories_checks':
$values['id_group'] = get_parameter('combo_group');
$values['top_n_value'] = get_parameter('max_items');
$good_format = true;
break;
case 'vul_by_cat':
$values['id_group'] = get_parameter('combo_group');
$values['cat_security_hardening'] = get_parameter('cat_security_hardening');
$values['ignore_skipped'] = get_parameter('ignore_skipped');
$good_format = true;
break;
case 'list_checks':
$values['id_group'] = get_parameter('combo_group');
$values['cat_security_hardening'] = get_parameter('cat_security_hardening');
$values['status_of_check'] = get_parameter('status_of_check');
$good_format = true;
break;
case 'scoring':
$values['id_group'] = get_parameter('combo_group');
$values['period'] = get_parameter('period');
$good_format = true;
break;
case 'evolution':
$values['id_group'] = get_parameter('combo_group');
$values['period'] = get_parameter('period');
$good_format = true;
break;
default:
$values['period'] = get_parameter('period');
$values['top_n'] = get_parameter(

View File

@ -170,13 +170,13 @@ if (check_acl($config['id_user'], 0, 'AW')) {
}
}
$buttons['integria'] = [
$buttons['ITSM'] = [
'active' => false,
'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&section=integria').'">'.html_print_image(
'images/integria.png',
'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&section=ITSM').'">'.html_print_image(
'images/itsm.png',
true,
[
'title' => __('Integria IMS'),
'title' => __('ITSM'),
'class' => 'invert_filter',
]
).'</a>',
@ -185,7 +185,7 @@ $buttons['integria'] = [
$buttons['ehorus'] = [
'active' => false,
'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&section=ehorus').'">'.html_print_image(
'images/ehorus/ehorus.png',
'images/RC.png',
true,
[
'title' => __('eHorus'),
@ -303,10 +303,10 @@ switch ($section) {
$help_header = 'setup_ehorus_tab';
break;
case 'integria':
$buttons['integria']['active'] = true;
$subpage = __('Integria IMS');
$help_header = 'setup_integria_tab';
case 'ITSM':
$buttons['ITSM']['active'] = true;
$subpage = __('Pandora ITSM');
$help_header = 'setup_ITSM_tab';
break;
case 'module_library':
@ -442,8 +442,8 @@ switch ($section) {
include_once $config['homedir'].'/godmode/setup/setup_ehorus.php';
break;
case 'integria':
include_once $config['homedir'].'/godmode/setup/setup_integria.php';
case 'ITSM':
include_once $config['homedir'].'/godmode/setup/setup_ITSM.php';
break;
case 'gis':

View File

@ -0,0 +1,716 @@
<?php
/**
* ITSM setup.
*
* @category Setup
* @package Pandora FMS
* @subpackage Opensource
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2023 Pandora FMS
* Please see https://pandorafms.com/community/ for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
use PandoraFMS\ITSM\ITSM;
// Load globals.
global $config;
check_login();
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Setup Management'
);
include 'general/noaccess.php';
return;
}
$error = '';
$group_values = [];
$priority_values = [];
$object_types_values = [];
$status_values = [];
$node = [];
try {
$ITSM = new ITSM();
$has_connection = $ITSM->ping();
$group_values = $ITSM->getGroups();
$priority_values = $ITSM->getPriorities();
$status_values = $ITSM->getStatus();
$object_types_values = $ITSM->getObjectypes();
if ((bool) get_parameter('update_config', 0) === true) {
$set_config_inventories = $ITSM->createNode(
[
'serverAuth' => $config['server_unique_identifier'],
'apiPass' => $config['api_password'],
'agentsForExecution' => $config['ITSM_agents_sync'],
'path' => $config['ITSM_public_url'],
'label' => array_keys(servers_get_names())[0],
'nodeId' => $config['metaconsole_node_id'],
]
);
}
try {
$node = $ITSM->getNode($config['server_unique_identifier']);
} catch (\Throwable $th) {
$node = [];
}
} catch (\Throwable $th) {
$error = $th->getMessage();
$has_connection = false;
}
if ($has_connection === false && $config['ITSM_enabled']) {
ui_print_error_message(__('ITSM API is not reachable, %s', $error));
}
$table_enable = new StdClass();
$table_enable->data = [];
$table_enable->width = '100%';
$table_enable->id = 'itsm-enable-setup';
$table_enable->class = 'databox filters';
$table_enable->size['name'] = '30%';
$table_enable->style['name'] = 'font-weight: bold';
// Enable Pandora ITSM.
$row = [];
$row['name'] = __('Enable Pandora ITSM');
$row['control'] = html_print_checkbox_switch('ITSM_enabled', 1, $config['ITSM_enabled'], true);
$table_enable->data['ITSM_enabled'] = $row;
// Remote config table.
$table_remote = new StdClass();
$table_remote->data = [];
$table_remote->width = '100%';
$table_remote->styleTable = 'margin-bottom: 10px;';
$table_remote->id = 'ITSM-remote-setup';
$table_remote->class = 'databox filters filter-table-adv';
$table_remote->size['hostname'] = '50%';
$table_remote->size['api_pass'] = '50%';
// Enable ITSM user configuration.
$row = [];
$row['user_level'] = html_print_label_input_block(
__('Pandora ITSM configuration at user level'),
html_print_checkbox_switch(
'ITSM_user_level_conf',
1,
$config['ITSM_user_level_conf'],
true
)
);
$table_remote->data['ITSM_user_level_conf'] = $row;
// ITSM hostname.
$row = [];
$row['hostname'] = html_print_label_input_block(
__('URL to Pandora ITSM setup').ui_print_help_tip(
__('Full URL to your Pandora ITSM setup (e.g., http://192.168.1.20/integria/api/v1).'),
true
),
html_print_input_text(
'ITSM_hostname',
$config['ITSM_hostname'],
'',
30,
100,
true
),
['div_class' => 'ITSM-remote-setup-ITSM_hostname']
);
// ITSM token.
$row['password'] = html_print_label_input_block(
__('Token'),
html_print_input_password(
'ITSM_token',
io_output_password($config['ITSM_token']),
'',
30,
100,
true
),
['div_class' => 'ITSM-remote-setup-ITSM_token']
);
$table_remote->data['ITSM_token'] = $row;
// Test.
$row = [];
$button_test = html_print_button(
__('Test'),
'ITSM',
false,
'',
[
'icon' => 'cog',
'mode' => 'secondary mini',
],
true
);
$button_test .= '<span id="ITSM-spinner" class="invisible">&nbsp;';
$button_test .= html_print_image(
'images/spinner.gif',
true
);
$button_test .= '</span>';
$button_test .= '<span id="ITSM-success" class="invisible">&nbsp;';
$button_test .= html_print_image(
'images/status_sets/default/severity_normal.png',
true
);
$button_test .= '&nbsp;'.__('Connection its OK').'</span>';
$button_test .= '<span id="ITSM-failure" class="invisible">&nbsp;';
$button_test .= html_print_image(
'images/status_sets/default/severity_critical.png',
true
);
$button_test .= '&nbsp;'.__('Connection failed').'</span>';
$button_test .= '&nbsp;<span id="ITSM-message" class="invisible"></span>';
$row['control'] = html_print_label_input_block(
__('Test connection pandora to ITSM'),
$button_test
);
$table_remote->data['ITSM_test'] = $row;
$row = [];
$itsm_public_url = $config['ITSM_public_url'];
if (empty($itsm_public_url) === true) {
$itsm_public_url = $config['homeurl'];
if (isset($config['public_url']) === true && empty($config['public_url']) === false) {
$itsm_public_url = $config['public_url'];
}
}
$row['publicUrl'] = html_print_label_input_block(
__('URL conect to API %s', get_product_name()).ui_print_help_tip(
__('Full URL to your Pandora (e.g., http://192.168.1.20).'),
true
),
html_print_input_text(
'ITSM_public_url',
$itsm_public_url,
'',
30,
100,
true
)
);
$row['agentsSync'] = html_print_label_input_block(
__('Number Agents to synchronize').ui_print_help_tip(
__('Number of agents that will synchronize at the same time, minimum 10 max 1000'),
true
),
html_print_input_number(
[
'name' => 'ITSM_agents_sync',
'min' => 10,
'max' => 1000,
'value' => ($config['ITSM_agents_sync'] ?? 20),
]
)
);
$table_remote->data['ITSM_sync_inventory'] = $row;
// Test.
$row = [];
$button_test_pandora = html_print_button(
__('Test'),
'ITSM-pandora',
false,
'',
[
'icon' => 'cog',
'mode' => 'secondary mini',
],
true
);
$button_test_pandora .= '<span id="ITSM-spinner-pandora" class="invisible">&nbsp;';
$button_test_pandora .= html_print_image(
'images/spinner.gif',
true
);
$button_test_pandora .= '</span>';
$button_test_pandora .= '<span id="ITSM-success-pandora" class="invisible">&nbsp;';
$button_test_pandora .= html_print_image(
'images/status_sets/default/severity_normal.png',
true
);
$button_test_pandora .= '&nbsp;'.__('Connection its OK').'</span>';
$button_test_pandora .= '<span id="ITSM-failure-pandora" class="invisible">&nbsp;';
$button_test_pandora .= html_print_image(
'images/status_sets/default/severity_critical.png',
true
);
$button_test_pandora .= '&nbsp;'.__('Connection failed').'</span>';
$button_test_pandora .= '&nbsp;<span id="ITSM-message-pandora" class="invisible"></span>';
$row['control-test'] = html_print_label_input_block(
__('Test conection ITSM to pandora'),
$button_test_pandora
);
if (empty($node) === false) {
$progressbar = '';
$progress = 0;
if (empty($node['total']) === false) {
if (empty($node['accumulate']) === true) {
$node['accumulate'] = 0;
}
$progress = round(($node['accumulate'] * 100 / $node['total']));
}
if (empty($node['error']) === false) {
$progressbar = $node['error'];
} else if (empty($node['total']) === false) {
$progressbar = '<div class="flex mrgn_5px">';
$progressbar .= ui_progress($progress, '150px', '1.3', '#14524f', true, '', false, 'margin-right:5px; color:#c0ccdc');
$progressbar .= ' ( '.$node['accumulate'].' / '.$node['total'].' ) '.__('Agents');
$progressbar .= '</div>';
} else {
$progressbar = '--';
}
// $progressbar .= (empty($node['dateStart']) === false) ? human_time_comparation($node['dateStart']) : __('Never');
$row['control-test-pandora'] = html_print_label_input_block(
__('Progress agents to synch'),
$progressbar
);
}
$table_remote->data['ITSM_test_pandora'] = $row;
// Alert settings.
$table_alert_settings = new StdClass();
$table_alert_settings->data = [];
$table_alert_settings->rowspan = [];
$table_alert_settings->width = '100%';
$table_alert_settings->styleTable = 'margin-bottom: 10px;';
$table_alert_settings->id = 'ITSM-settings-setup';
$table_alert_settings->class = 'databox filters filter-table-adv';
$table_alert_settings->size[0] = '50%';
$table_alert_settings->size[1] = '50%';
// Alert incident title.
$table_alert_settings->data[0][0] = html_print_label_input_block(
__('Title'),
html_print_input_text(
'incident_title',
$config['incident_title'],
__('Name'),
50,
100,
true,
false,
false
)
);
// Alert incident description.
$table_alert_settings->rowspan[0][1] = 3;
$table_alert_settings->data[0][1] = html_print_label_input_block(
__('Ticket body'),
html_print_textarea(
'incident_content',
9,
25,
$config['incident_content'],
'',
true
)
);
// Alert default group.
$table_alert_settings->data[1][0] = html_print_label_input_block(
__('Group'),
html_print_select(
$group_values,
'default_group',
$config['default_group'],
'',
'',
0,
true,
false,
true,
'',
false
)
);
// Alert default owner.
$table_alert_settings->data[2][0] = html_print_label_input_block(
__('Owner'),
html_print_autocomplete_users_from_pandora_itsm(
'default_owner',
$config['default_owner'],
true,
'30',
false,
false,
'w100p'
),
['div_class' => 'inline']
);
// Alert default incident status.
$table_alert_settings->data[3][0] = html_print_label_input_block(
__('Status'),
html_print_select(
$status_values,
'incident_status',
$config['incident_status'],
'',
__('Select'),
0,
true,
false,
true,
'',
false
)
);
// Alert default criticity.
$table_alert_settings->data[3][1] = html_print_label_input_block(
__('Priority'),
html_print_select(
$priority_values,
'default_criticity',
$config['default_criticity'],
'',
__('Select'),
0,
true,
false,
true,
'',
false
)
);
// Alert default incident type.
$table_alert_settings->data[4][0] = html_print_label_input_block(
__('Type'),
html_print_select(
$object_types_values,
'incident_type',
$config['incident_type'],
'',
__('Select'),
0,
true,
false,
true,
'',
false
)
);
// Custom response settings.
$table_cr_settings = new StdClass();
$table_cr_settings->data = [];
$table_cr_settings->width = '100%';
$table_cr_settings->styleTable = 'margin-bottom: 10px;';
$table_cr_settings->id = 'ITSM-cr-settings-setup';
$table_cr_settings->class = 'databox filters filter-table-adv';
$table_cr_settings->size[0] = '50%';
$table_cr_settings->size[1] = '50%';
// Custom response incident title.
$table_cr_settings->data[0][0] = html_print_label_input_block(
__('Title'),
html_print_input_text(
'cr_incident_title',
$config['cr_incident_title'],
__('Name'),
50,
100,
true,
false,
false
)
);
// Custom response incident description.
$table_cr_settings->rowspan[0][1] = 3;
$table_cr_settings->data[0][1] = html_print_label_input_block(
__('Ticket body'),
html_print_textarea(
'cr_incident_content',
9,
25,
$config['cr_incident_content'],
'',
true
)
);
// Custom response default group.
$table_cr_settings->data[1][0] = html_print_label_input_block(
__('Group'),
html_print_select(
$group_values,
'cr_default_group',
$config['cr_default_group'],
'',
__('Select'),
0,
true,
false,
true,
'',
false
)
);
// Custom response default owner.
$table_cr_settings->data[2][0] = html_print_label_input_block(
__('Owner'),
html_print_autocomplete_users_from_pandora_itsm(
'cr_default_owner',
$config['cr_default_owner'],
true,
'30',
false,
false,
'w100p'
),
['div_class' => 'inline']
);
// Custom response default incident status.
$row = [];
$table_cr_settings->data[3][0] = html_print_label_input_block(
__('Status'),
html_print_select(
$status_values,
'cr_incident_status',
$config['cr_incident_status'],
'',
__('Select'),
0,
true,
false,
true,
'',
false
)
);
// Custom response default criticity.
$table_cr_settings->data[3][1] = html_print_label_input_block(
__('Priority'),
html_print_select(
$priority_values,
'cr_default_criticity',
$config['cr_default_criticity'],
'',
__('Select'),
0,
true,
false,
true,
'',
false
)
);
// Custom response default incident type.
$table_cr_settings->data[4][0] = html_print_label_input_block(
__('Type'),
html_print_select(
$object_types_values,
'cr_incident_type',
$config['cr_incident_type'],
'',
__('Select'),
0,
true,
false,
true,
'',
false
)
);
// Print.
echo '<div class="center pdd_b_10px mrgn_btn_20px white_box max_floating_element_size">';
echo '<a target="_blank" rel="noopener noreferrer" href="https://pandorafms.com/es/itsm/">';
html_print_image(
'images/pandoraITSM_logo.png',
false,
['class' => 'w600px mrgn_top_15px']
);
echo '</a>';
echo '<br />';
echo '<div class="ITSM_title">';
echo __('Pandora ITSM');
echo '</div>';
echo '<a target="_blank" rel="noopener noreferrer" href="https://pandorafms.com/es/itsm/">';
echo 'https://pandorafms.com/es/itsm/';
echo '</a>';
echo '</div>';
echo "<form method='post' class='max_floating_element_size'>";
html_print_input_hidden('update_config', 1);
// Form enable.
echo '<div id="form_enable">';
html_print_table($table_enable);
echo '</div>';
// Form remote.
echo '<div id="form_remote">';
echo '<fieldset>';
echo '<legend>'.__('Pandora ITSM API settings').'</legend>';
html_print_table($table_remote);
echo '</fieldset>';
echo '</div>';
if ($has_connection !== false) {
// Form alert default settings.
echo '<div id="form_alert_settings">';
echo '<fieldset class="mrgn_top_15px">';
echo '<legend>'.__('Alert default values').'&nbsp'.ui_print_help_icon('alert_macros', true).'</legend>';
html_print_table($table_alert_settings);
echo '</fieldset>';
echo '</div>';
// Form custom response default settings.
echo '<div id="form_custom_response_settings">';
echo '<fieldset class="mrgn_top_15px">';
echo '<legend>'.__('Event custom response default values').'&nbsp'.ui_print_help_icon('alert_macros', true).'</legend>';
html_print_table($table_cr_settings);
echo '</fieldset>';
echo '</div>';
$update_button = html_print_submit_button(
__('Update'),
'update_button',
false,
['icon' => 'update'],
true
);
} else {
$update_button = html_print_submit_button(
__('Update and continue'),
'update_button',
false,
['icon' => 'update'],
true
);
}
html_print_action_buttons($update_button);
echo '</form>';
ui_require_javascript_file('ITSM');
?>
<script type="text/javascript">
if($('input:checkbox[name="ITSM_user_level_conf"]').is(':checked'))
{
$('.ITSM-remote-setup-ITSM_token').hide()
}
var handleUserLevel = function(event) {
var is_checked = $('input:checkbox[name="ITSM_enabled"]').is(':checked');
var is_checked_userlevel = $('input:checkbox[name="ITSM_user_level_conf"]').is(':checked');
if (event.target.value == '1' && is_checked && !is_checked_userlevel) {
showUserPass();
$('input:checkbox[name="ITSM_user_level_conf"]').attr('checked', true);
}
else {
hideUserPass();
$('input:checkbox[name="ITSM_user_level_conf"]').attr('checked', false);
};
}
$('input:checkbox[name="ITSM_enabled"]').change(handleEnable);
$('input:checkbox[name="ITSM_user_level_conf"]').change(handleUserLevel);
if(!$('input:checkbox[name="ITSM_enabled"]').is(':checked')) {
$('#form_remote').hide();
$('#form_custom_response_settings').hide();
} else {
$('#form_remote').show();
$('#form_custom_response_settings').show();
}
$('#form_enable').css('margin-bottom','20px');
var showFields = function () {
$('#form_remote').show();
$('#form_custom_response_settings').show();
}
var hideFields = function () {
$('#form_remote').hide();
$('#form_custom_response_settings').hide();
}
var hideUserPass = function () {
$('.ITSM-remote-setup-ITSM_token').hide();
}
var showUserPass = function () {
$('.ITSM-remote-setup-ITSM_token').show();
}
var handleEnable = function (event) {
var is_checked = $('input:checkbox[name="ITSM_enabled"]').is(':checked');
if (event.target.value == '1' && is_checked) {
showFields();
$('input:checkbox[name="ITSM_enabled"]').attr('checked', true);
}
else {
hideFields();
$('input:checkbox[name="ITSM_enabled"]').attr('checked', false);
};
}
$('input:checkbox[name="ITSM_enabled"]').change(handleEnable);
$('#button-ITSM').click(function() {
var pass = $('input#password-ITSM_token').val();
var host = $('input#text-ITSM_hostname').val();
testConectionApi(pass, host);
});
$('#button-ITSM-pandora').click(function() {
var path = $('input#text-ITSM_public_url').val();
testConectionApiItsmToPandora(path);
});
</script>

View File

@ -371,7 +371,7 @@ if (is_ajax() === true) {
case 'pandora':
case 'ad':
case 'saml':
case 'integria':
case 'ITSM':
// Add enterprise authentication options.
if (enterprise_installed() === true) {
add_enterprise_auth_options($table, $type_auth);

View File

@ -1,997 +0,0 @@
<?php
/**
* Integria setup.
*
* @category Setup
* @package Pandora FMS
* @subpackage Opensource
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2023 Pandora FMS
* Please see https://pandorafms.com/community/ for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Load globals.
global $config;
check_login();
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Setup Management'
);
include 'general/noaccess.php';
return;
}
require_once $config['homedir'].'/include/functions_integriaims.php';
if (is_ajax() === true) {
$operation = (string) get_parameter('operation', '');
$integria_user = get_parameter('integria_user', '');
$integria_pass = get_parameter('integria_pass', '');
$integria_api_hostname = get_parameter('api_hostname', '');
$integria_api_pass = get_parameter('api_pass', '');
$user_level_conf = get_parameter('user_level_conf', 0);
$user_level_conf_bool = ((bool) $user_level_conf === true);
$login_result = integria_api_call($integria_api_hostname, $integria_user, $integria_pass, $integria_api_pass, 'get_login', [], false, '', '', $user_level_conf_bool);
echo json_encode(['login' => ($login_result !== false) ? 1 : 0]);
return;
}
$has_connection = integria_api_call(null, null, null, null, 'get_login', []);
if ($has_connection === false && $config['integria_enabled']) {
ui_print_error_message(__('Integria IMS API is not reachable'));
}
if (get_parameter('update_config', 0) == 1) {
// Try to retrieve event response 'Create incident in IntegriaIMS from event' to check if it exists.
$event_response_exists = db_get_row_filter('tevent_response', ['name' => io_safe_input('Create ticket in IntegriaIMS from event')]);
// Try to retrieve command 'Integia IMS Ticket' to check if it exists.
$command_exists = db_get_row_filter('talert_commands', ['name' => io_safe_input('Integria IMS Ticket')]);
if ($config['integria_enabled'] == 1) {
if ($event_response_exists === false) {
// Create 'Create incident in IntegriaIMS from event' event response only when user enables IntegriaIMS integration and it does not exist in database.
db_process_sql_insert(
'tevent_response',
[
'name' => io_safe_input('Create ticket in IntegriaIMS from event'),
'description' => io_safe_input('Create a ticket in Integria IMS from an event'),
'target' => io_safe_input('index.php?sec=incident&sec2=operation/incidents/configure_integriaims_incident&from_event=_event_id_'),
'type' => 'url',
'id_group' => '0',
'modal_width' => '0',
'modal_height' => '0',
'new_window' => '1',
'params' => '',
'server_to_exec' => '0',
]
);
}
$ticket_types = integria_api_call(null, null, null, null, 'get_types', '', false, 'json');
$types_string = '';
if ($ticket_types !== '') {
foreach (json_decode($ticket_types, true) as $key => $value) {
$types_string .= $value['id'].','.$value['name'].';';
}
}
if ($command_exists === false) {
// Create 'Integria IMS Ticket' command only when user enables IntegriaIMS integration and it does not exist in database.
$id_command_inserted = db_process_sql_insert(
'talert_commands',
[
'name' => io_safe_input('Integria IMS Ticket'),
'command' => io_safe_input('Internal type'),
'internal' => 1,
'description' => io_safe_input('Create a ticket in Integria IMS'),
'fields_descriptions' => '["'.io_safe_input('Ticket title').'","'.io_safe_input('Ticket group ID').'","'.io_safe_input('Ticket priority').'","'.io_safe_input('Ticket owner').'","'.io_safe_input('Ticket type').'","'.io_safe_input('Ticket status').'","'.io_safe_input('Ticket description').'","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_"]',
'fields_values' => '["", "", "","","'.$types_string.'","","","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_"]',
]
);
// Create 'Create Integria IMS Ticket' action only when user enables IntegriaIMS integration and command exists in database.
$action_values = [
'field1' => io_safe_input($config['incident_title']),
'field1_recovery' => io_safe_input($config['incident_title']),
'field2' => io_safe_input($config['default_group']),
'field2_recovery' => io_safe_input($config['default_group']),
'field3' => io_safe_input($config['default_criticity']),
'field3_recovery' => io_safe_input($config['default_criticity']),
'field4' => io_safe_input($config['default_owner']),
'field4_recovery' => io_safe_input($config['default_owner']),
'field5' => io_safe_input($config['incident_type']),
'field5_recovery' => io_safe_input($config['incident_type']),
'field6' => io_safe_input($config['incident_status']),
'field6_recovery' => io_safe_input($config['incident_status']),
'field7' => io_safe_input($config['incident_content']),
'field7_recovery' => io_safe_input($config['incident_content']),
'id_group' => 0,
'action_threshold' => 0,
];
alerts_create_alert_action(io_safe_input('Create Integria IMS ticket'), $id_command_inserted, $action_values);
} else {
// Update 'Integria IMS Ticket' command with ticket types retrieved from Integria IMS.
$sql_update_command_values = sprintf(
'
UPDATE talert_commands
SET fields_values = \'["","","","","%s","","","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_"]\'
WHERE name="%s"',
$types_string,
io_safe_input('Integria IMS Ticket')
);
db_process_sql($sql_update_command_values);
// Update those actions that make use of 'Integria IMS Ticket' command when setup default fields are updated. Empty fields in actions will be filled in with default values.
$update_action_values = [
$config['incident_title'],
$config['default_group'],
$config['default_criticity'],
$config['default_owner'],
$config['incident_type'],
$config['incident_status'],
$config['incident_content'],
];
foreach ($update_action_values as $key => $value) {
$field_key = ($key + 1);
$sql_update_action_field = sprintf(
'
UPDATE talert_actions taa
INNER JOIN talert_commands tac
ON taa.id_alert_command=tac.id
SET field%s= "%s"
WHERE tac.name="Integria&#x20;IMS&#x20;Ticket"
AND (
taa.field%s IS NULL OR taa.field%s=""
)',
$field_key,
$value,
$field_key,
$field_key,
$field_key
);
db_process_sql($sql_update_action_field);
}
foreach ($update_action_values as $key => $value) {
$field_key = ($key + 1);
$sql_update_action_recovery_field = sprintf(
'
UPDATE talert_actions taa
INNER JOIN talert_commands tac
ON taa.id_alert_command=tac.id
SET field%s_recovery = "%s"
WHERE tac.name="Integria&#x20;IMS&#x20;Ticket"
AND (
taa.field%s_recovery IS NULL OR taa.field%s_recovery=""
)',
$field_key,
$value,
$field_key,
$field_key,
$field_key
);
db_process_sql($sql_update_action_recovery_field);
}
}
} else {
if ($event_response_exists !== false) {
// Delete 'Create incident in IntegriaIMS from event' event response if it does exist and IntegriaIMS integration is disabled.
db_process_sql_delete('tevent_response', ['name' => io_safe_input('Create ticket in IntegriaIMS from event')]);
}
}
}
// Get parameters from Integria IMS API.
$integria_group_values = [];
$integria_criticity_values = [];
$integria_users_values = [];
$integria_types_values = [];
$integria_status_values = [];
$integria_groups_csv = integria_api_call(null, null, null, null, 'get_groups', []);
get_array_from_csv_data_pair($integria_groups_csv, $integria_group_values);
$integria_status_csv = integria_api_call(null, null, null, null, 'get_incidents_status', []);
get_array_from_csv_data_pair($integria_status_csv, $integria_status_values);
$integria_criticity_levels_csv = integria_api_call(null, null, null, null, 'get_incident_priorities', []);
get_array_from_csv_data_pair($integria_criticity_levels_csv, $integria_criticity_values);
$integria_users_csv = integria_api_call(null, null, null, null, 'get_users', []);
$csv_array = explode("\n", $integria_users_csv);
foreach ($csv_array as $csv_line) {
if (empty($csv_line) === false) {
$integria_users_values[$csv_line] = $csv_line;
}
}
$integria_types_csv = integria_api_call(null, null, null, null, 'get_types', []);
get_array_from_csv_data_pair($integria_types_csv, $integria_types_values);
// Enable table.
$table_enable = new StdClass();
$table_enable->data = [];
$table_enable->width = '100%';
$table_enable->id = 'integria-enable-setup';
$table_enable->class = 'databox filters';
$table_enable->size['name'] = '30%';
$table_enable->style['name'] = 'font-weight: bold';
// Enable Integria.
$row = [];
$row['name'] = __('Enable Integria IMS');
$row['control'] = html_print_checkbox_switch('integria_enabled', 1, $config['integria_enabled'], true);
$table_enable->data['integria_enabled'] = $row;
// Remote config table.
$table_remote = new StdClass();
$table_remote->data = [];
$table_remote->width = '100%';
$table_remote->styleTable = 'margin-bottom: 10px;';
$table_remote->id = 'integria-remote-setup';
$table_remote->class = 'databox filters filter-table-adv';
$table_remote->size['hostname'] = '50%';
$table_remote->size['api_pass'] = '50%';
// Enable Integria user configuration.
$row = [];
$row['user_level'] = html_print_label_input_block(
__('Integria configuration at user level'),
html_print_checkbox_switch(
'integria_user_level_conf',
1,
$config['integria_user_level_conf'],
true
)
);
$table_remote->data['integria_user_level_conf'] = $row;
// Integria user.
$row = [];
$row['user'] = html_print_label_input_block(
__('User'),
html_print_input_text(
'integria_user',
$config['integria_user'],
'',
30,
100,
true
),
['div_class' => 'integria-remote-setup-integria_user']
);
// Integria password.
$row['password'] = html_print_label_input_block(
__('Password'),
html_print_input_password(
'integria_pass',
io_output_password($config['integria_pass']),
'',
30,
100,
true
),
['div_class' => 'integria-remote-setup-integria_pass']
);
$table_remote->data['integria_pass'] = $row;
// Integria hostname.
$row = [];
$row['hostname'] = html_print_label_input_block(
__('URL to Integria IMS setup').ui_print_help_tip(__('Full URL to your Integria IMS setup (e.g., http://192.168.1.20/integria, https://support.mycompany.com).'), true),
html_print_input_text(
'integria_hostname',
$config['integria_hostname'],
'',
30,
100,
true
),
['div_class' => 'integria-remote-setup-integria_hostname']
);
// API password.
$row['api_pass'] = html_print_label_input_block(
__('API Password'),
html_print_input_password(
'integria_api_pass',
io_output_password($config['integria_api_pass']),
'',
30,
100,
true
),
['div_class' => 'integria-remote-setup-integria_api_pass']
);
$table_remote->data['integria_api_pass'] = $row;
// Request timeout.
$row = [];
$row['req_timeout'] = html_print_label_input_block(
__('Request timeout'),
html_print_input_text(
'integria_req_timeout',
$config['integria_req_timeout'],
'',
3,
10,
true
),
['div_class' => 'integria-remote-setup-integria_req_timeout']
);
$table_remote->data['integria_req_timeout'] = $row;
$row = [];
$row['control'] = __('Inventory');
$row['control'] .= html_print_button(
__('Sync inventory'),
'sync-inventory',
false,
'',
[
'icon' => 'cog',
'mode' => 'secondary mini',
],
true
);
$row['control'] .= '<span id="test-integria-spinner-sync" style="display:none;">&nbsp;'.html_print_image('images/spinner.gif', true).'</span>';
$row['control'] .= '<span id="test-integria-success-sync" style="display:none;">&nbsp;'.html_print_image('images/status_sets/default/severity_normal.png', true).'</span>';
$row['control'] .= '<span id="test-integria-failure-sync" style="display:none;">&nbsp;'.html_print_image('images/status_sets/default/severity_critical.png', true).'</span>';
$table_remote->data['integria_sync_inventory'] = $row;
// Alert settings.
$table_alert_settings = new StdClass();
$table_alert_settings->data = [];
$table_alert_settings->width = '100%';
$table_alert_settings->styleTable = 'margin-bottom: 10px;';
$table_alert_settings->id = 'integria-cr-settings-setup';
$table_alert_settings->class = 'databox filters filter-table-adv';
$table_alert_settings->size[0] = '50%';
$table_alert_settings->size[1] = '50%';
// Alert incident title.
$row = [];
$row[0] = html_print_label_input_block(
__('Title'),
html_print_input_text(
'incident_title',
$config['incident_title'],
__('Name'),
50,
100,
true,
false,
false
)
);
// Alert incident description.
$row[1] = html_print_label_input_block(
__('Ticket body'),
html_print_textarea(
'incident_content',
3,
25,
$config['incident_content'],
'',
true
)
);
$table_alert_settings->data[0] = $row;
// Alert default group.
$row = [];
$row[0] = html_print_label_input_block(
__('Group'),
html_print_select(
$integria_group_values,
'default_group',
$config['default_group'],
'',
__('Select'),
0,
true,
false,
true,
'',
false
)
);
// Alert default criticity.
$row[1] = html_print_label_input_block(
__('Priority'),
html_print_select(
$integria_criticity_values,
'default_criticity',
$config['default_criticity'],
'',
__('Select'),
0,
true,
false,
true,
'',
false
)
);
$table_alert_settings->data[1] = $row;
// Alert default owner.
$row = [];
$row[0] = html_print_label_input_block(
__('Owner'),
html_print_autocomplete_users_from_integria(
'default_owner',
$config['default_owner'],
true,
'30',
false,
false,
'w100p'
),
['div_class' => 'inline']
);
// Alert default incident type.
$row[1] = html_print_label_input_block(
__('Type'),
html_print_select(
$integria_types_values,
'incident_type',
$config['incident_type'],
'',
__('Select'),
0,
true,
false,
true,
'',
false
)
);
$table_alert_settings->data[2] = $row;
// Alert default incident status.
$row = [];
$row[0] = html_print_label_input_block(
__('Status'),
html_print_select(
$integria_status_values,
'incident_status',
$config['incident_status'],
'',
__('Select'),
0,
true,
false,
true,
'',
false
)
);
$table_alert_settings->data[3] = $row;
// Custom response settings.
$table_cr_settings = new StdClass();
$table_cr_settings->data = [];
$table_cr_settings->width = '100%';
$table_cr_settings->styleTable = 'margin-bottom: 10px;';
$table_cr_settings->id = 'integria-cr-settings-setup';
$table_cr_settings->class = 'databox filters filter-table-adv';
$table_cr_settings->size[0] = '50%';
$table_cr_settings->size[1] = '50%';
// Custom response incident title.
$row = [];
$row[0] = html_print_label_input_block(
__('Title'),
html_print_input_text(
'cr_incident_title',
$config['cr_incident_title'],
__('Name'),
50,
100,
true,
false,
false
)
);
// Custom response incident description.
$row[1] = html_print_label_input_block(
__('Ticket body'),
html_print_textarea(
'cr_incident_content',
3,
25,
$config['cr_incident_content'],
'',
true
)
);
$table_cr_settings->data[0] = $row;
// Custom response default group.
$row = [];
$row[0] = html_print_label_input_block(
__('Group'),
html_print_select(
$integria_group_values,
'cr_default_group',
$config['cr_default_group'],
'',
__('Select'),
0,
true,
false,
true,
'',
false
)
);
// Custom response default criticity.
$row[1] = html_print_label_input_block(
__('Priority'),
html_print_select(
$integria_criticity_values,
'cr_default_criticity',
$config['cr_default_criticity'],
'',
__('Select'),
0,
true,
false,
true,
'',
false
)
);
$table_cr_settings->data[1] = $row;
// Custom response default owner.
$row = [];
$row[0] = html_print_label_input_block(
__('Owner'),
html_print_autocomplete_users_from_integria(
'cr_default_owner',
$config['cr_default_owner'],
true,
'30',
false,
false,
'w100p'
),
['div_class' => 'inline']
);
// Custom response default incident type.
$row[1] = html_print_label_input_block(
__('Type'),
html_print_select(
$integria_types_values,
'cr_incident_type',
$config['cr_incident_type'],
'',
__('Select'),
0,
true,
false,
true,
'',
false
)
);
$table_cr_settings->data[2] = $row;
// Custom response default incident status.
$row = [];
$row[0] = html_print_label_input_block(
__('Status'),
html_print_select(
$integria_status_values,
'cr_incident_status',
$config['cr_incident_status'],
'',
__('Select'),
0,
true,
false,
true,
'',
false
)
);
$table_cr_settings->data[3] = $row;
// Test.
$row = [];
$row['control'] = __('Test connection');
$row['control'] .= html_print_button(
__('Test'),
'test-integria',
false,
'',
[
'icon' => 'cog',
'mode' => 'secondary mini',
],
true
);
$row['control'] .= '<span id="test-integria-spinner" class="invisible">&nbsp;'.html_print_image('images/spinner.gif', true).'</span>';
$row['control'] .= '<span id="test-integria-success" class="invisible">&nbsp;'.html_print_image('images/status_sets/default/severity_normal.png', true).'&nbsp;'.__('Connection its OK').'</span>';
$row['control'] .= '<span id="test-integria-failure" class="invisible">&nbsp;'.html_print_image('images/status_sets/default/severity_critical.png', true).'&nbsp;'.__('Connection failed').'</span>';
$row['control'] .= '&nbsp;<span id="test-integria-message" class="invisible"></span>';
$table_remote->data['integria_test'] = $row;
// Print.
echo '<div class="center pdd_b_10px mrgn_btn_20px white_box max_floating_element_size">';
echo '<a target="_blank" rel="noopener noreferrer" href="http://integriaims.com">';
html_print_image(
'images/integria_logo.svg',
false,
['class' => 'w400px mrgn_top_15px']
);
echo '</a>';
echo '<br />';
echo '<div clsas="integria_title">';
echo __('Integria IMS');
echo '</div>';
echo '<a target="_blank" rel="noopener noreferrer" href="https://integriaims.com">';
echo 'https://integriaims.com';
echo '</a>';
echo '</div>';
echo "<form method='post' class='max_floating_element_size'>";
html_print_input_hidden('update_config', 1);
// Form enable.
echo '<div id="form_enable">';
html_print_table($table_enable);
echo '</div>';
// Form remote.
echo '<div id="form_remote">';
echo '<fieldset>';
echo '<legend>'.__('Integria API settings').'</legend>';
html_print_table($table_remote);
echo '</fieldset>';
echo '</div>';
if ($has_connection != false) {
// Form alert default settings.
echo '<div id="form_alert_settings">';
echo '<fieldset class="mrgn_top_15px">';
echo '<legend>'.__('Alert default values').'&nbsp'.ui_print_help_icon('alert_macros', true).'</legend>';
html_print_table($table_alert_settings);
echo '</fieldset>';
echo '</div>';
// Form custom response default settings.
echo '<div id="form_custom_response_settings">';
echo '<fieldset class="mrgn_top_15px">';
echo '<legend>'.__('Event custom response default values').'&nbsp'.ui_print_help_icon('alert_macros', true).'</legend>';
html_print_table($table_cr_settings);
echo '</fieldset>';
echo '</div>';
$update_button = html_print_submit_button(
__('Update'),
'update_button',
false,
['icon' => 'update'],
true
);
} else {
$update_button = html_print_submit_button(
__('Update and continue'),
'update_button',
false,
['icon' => 'update'],
true
);
}
html_print_action_buttons($update_button);
echo '</form>';
?>
<script type="text/javascript">
if($('input:checkbox[name="integria_user_level_conf"]').is(':checked'))
{
$('.integria-remote-setup-integria_user').hide();
$('.integria-remote-setup-integria_pass').hide()
}
var handleUserLevel = function(event) {
var is_checked = $('input:checkbox[name="integria_enabled"]').is(':checked');
var is_checked_userlevel = $('input:checkbox[name="integria_user_level_conf"]').is(':checked');
if (event.target.value == '1' && is_checked && !is_checked_userlevel) {
showUserPass();
$('input:checkbox[name="integria_user_level_conf"]').attr('checked', true);
}
else {
hideUserPass();
$('input:checkbox[name="integria_user_level_conf"]').attr('checked', false);
};
}
$('input:checkbox[name="integria_enabled"]').change(handleEnable);
$('input:checkbox[name="integria_user_level_conf"]').change(handleUserLevel);
if(!$('input:checkbox[name="integria_enabled"]').is(':checked')) {
$('#form_remote').hide();
$('#form_custom_response_settings').hide();
} else {
$('#form_remote').show();
$('#form_custom_response_settings').show();
}
$('#form_enable').css('margin-bottom','20px');
var showFields = function () {
$('#form_remote').show();
$('#form_custom_response_settings').show();
}
var hideFields = function () {
$('#form_remote').hide();
$('#form_custom_response_settings').hide();
}
var hideUserPass = function () {
$('.integria-remote-setup-integria_user').hide();
$('.integria-remote-setup-integria_pass').hide();
}
var showUserPass = function () {
$('.integria-remote-setup-integria_user').show();
$('.integria-remote-setup-integria_pass').show();
}
var handleEnable = function (event) {
var is_checked = $('input:checkbox[name="integria_enabled"]').is(':checked');
if (event.target.value == '1' && is_checked) {
showFields();
$('input:checkbox[name="integria_enabled"]').attr('checked', true);
}
else {
hideFields();
$('input:checkbox[name="integria_enabled"]').attr('checked', false);
};
}
$('input:checkbox[name="integria_enabled"]').change(handleEnable);
var handleTest = function (event) {
var user = $('input#text-integria_user').val();
var pass = $('input#password-integria_pass').val();
var host = $('input#text-integria_hostname').val();
var timeout = Number.parseInt($('input#text-integria_req_timeout').val(), 10);
var timeoutMessage = '<?php echo __('Connection timeout'); ?>';
var badRequestMessage = '<?php echo __('Empty user or password'); ?>';
var notFoundMessage = '<?php echo __('User not found'); ?>';
var invalidPassMessage = '<?php echo __('Invalid password'); ?>';
var hideLoadingImage = function () {
$('span#test-integria-spinner').hide();
}
var showLoadingImage = function () {
$('span#test-integria-spinner').show();
}
var hideSuccessImage = function () {
$('span#test-integria-success').hide();
}
var showSuccessImage = function () {
$('span#test-integria-success').show();
}
var hideFailureImage = function () {
$('span#test-integria-failure').hide();
}
var showFailureImage = function () {
$('span#test-integria-failure').show();
}
var hideMessage = function () {
$('span#test-integria-message').hide();
}
var showMessage = function () {
$('span#test-integria-message').show();
}
var changeTestMessage = function (message) {
$('span#test-integria-message').text(message);
}
hideSuccessImage();
hideFailureImage();
hideMessage();
showLoadingImage();
var integria_user = $('input[name=integria_user]').val();
var integria_pass = $('input[name=integria_pass]').val();
var api_hostname = $('input[name=integria_hostname]').val();
var api_pass = $('input[name=integria_api_pass]').val();
var user_level_conf = $('input:checkbox[name="integria_user_level_conf"]').is(':checked');
var data = {
page: 'godmode/setup/setup_integria',
operation: 'check_api_access',
integria_user: integria_user,
integria_pass: integria_pass,
api_hostname: api_hostname,
api_pass: api_pass,
user_level_conf: user_level_conf,
}
// AJAX call to check API connection.
$.ajax({
type: "POST",
url: "ajax.php",
dataType: "json",
timeout: timeout ? timeout * 1000 : 0,
data: data
})
.done(function(data, textStatus, xhr) {
if (data.login == '1') {
showSuccessImage();
} else {
showFailureImage();
showMessage();
}
})
.fail(function(xhr, textStatus, errorThrown) {
showFailureImage();
showMessage();
})
.always(function(xhr, textStatus) {
hideLoadingImage();
});
}
var handleInventorySync = function (event) {
var badRequestMessage = '<?php echo __('Empty user or password'); ?>';
var notFoundMessage = '<?php echo __('User not found'); ?>';
var invalidPassMessage = '<?php echo __('Invalid password'); ?>';
var hideLoadingImage = function () {
$('span#test-integria-spinner-sync').hide();
}
var showLoadingImage = function () {
$('span#test-integria-spinner-sync').show();
}
var hideSuccessImage = function () {
$('span#test-integria-success-sync').hide();
}
var showSuccessImage = function () {
$('span#test-integria-success-sync').show();
}
var hideFailureImage = function () {
$('span#test-integria-failure-sync').hide();
}
var showFailureImage = function () {
$('span#test-integria-failure-sync').show();
}
hideSuccessImage();
hideFailureImage();
showLoadingImage();
var integria_user = $('input[name=integria_user]').val();
var integria_pass = $('input[name=integria_pass]').val();
var api_hostname = $('input[name=integria_hostname]').val();
var api_pass = $('input[name=integria_api_pass]').val();
if (!api_hostname.match(/^[a-zA-Z]+:\/\//))
{
api_hostname = 'http://' + api_hostname;
}
var url = api_hostname + '/integria/include/api.php';
<?php
// Retrieve all agents and codify string in the format that will be sent over in Ajax call.
$agent_fields = [
'nombre',
'alias',
'id_os',
'direccion',
'id_agente',
'id_grupo',
];
$agents = agents_get_agents(false, $agent_fields);
$agents_query_string_array = [];
foreach ($agents as $agent_data) {
$agents_query_string_array[] = implode('|;|', $agent_data);
}
?>
var agents_query_string_array = <?php echo json_encode($agents_query_string_array); ?>;
var data = {
op: 'sync_pandora_agents_inventory',
user: integria_user,
user_pass: integria_pass,
pass: api_pass,
params: agents_query_string_array,
token: '|;|'
}
// AJAX call to check API connection.
$.ajax({
type: "POST",
url: url,
dataType: "json",
data: data
})
.done(function(data, textStatus, xhr) {
showSuccessImage();
})
.fail(function(xhr, textStatus, errorThrown) {
showFailureImage();
})
.always(function(xhr, textStatus) {
hideLoadingImage();
});
}
$('#button-test-integria').click(handleTest);
$('#button-sync-inventory').click(handleInventorySync);
</script>

View File

@ -333,6 +333,7 @@ if ($create_user === true) {
$values['default_custom_view'] = (int) get_parameter('default_custom_view');
$values['time_autorefresh'] = (int) get_parameter('time_autorefresh', 0);
$values['show_tips_startup'] = (int) get_parameter_switch('show_tips_startup');
$values['integria_user_level_pass'] = (string) get_parameter('integria_user_level_pass');
$dashboard = get_parameter('dashboard', '');
$visual_console = get_parameter('visual_console', '');
@ -624,6 +625,7 @@ if ($update_user) {
$values['ehorus_user_level_enabled'] = (bool) get_parameter('ehorus_user_level_enabled', false);
$values['ehorus_user_level_user'] = (string) get_parameter('ehorus_user_level_user');
$values['ehorus_user_level_pass'] = (string) get_parameter('ehorus_user_level_pass');
$values['integria_user_level_pass'] = (string) get_parameter('integria_user_level_pass');
$values['middlename'] = get_parameter('middlename', 0);

View File

@ -789,6 +789,62 @@ $userManagementTable->data['fields_addSettings'][1] .= html_print_div(
true
);
if ($config['ITSM_enabled'] && $config['ITSM_user_level_conf']) {
// Pandora ITSM user remote login.
$table_ITSM = new StdClass();
$table_ITSM->data = [];
$table_ITSM->width = '100%';
$table_ITSM->id = 'ITSM-remote-setup';
$table_ITSM->class = 'white_box';
$table_ITSM->size['name'] = '30%';
$table_ITSM->style['name'] = 'font-weight: bold';
// Pandora ITSM user level authentication.
// Title.
$row = [];
$row['control'] = '<p class="edit_user_labels">'.__('Pandora ITSM user configuration').': </p>';
$table_ITSM->data['ITSM_user_level_conf'] = $row;
// Pandora ITSM pass.
$row = [];
$row['name'] = __('Token');
$row['control'] = html_print_input_password(
'integria_user_level_pass',
io_output_password($user_info['integria_user_level_pass']),
'',
100,
100,
true
);
$table_ITSM->data['integria_user_level_pass'] = $row;
// Test.
$ITSM_host = db_get_value('value', 'tconfig', 'token', 'ITSM_hostname');
$row = [];
$row['name'] = __('Test');
$row['control'] = html_print_button(
__('Start'),
'ITSM',
false,
'',
[
'icon' => 'cog',
'mode' => 'secondary mini',
],
true
);
$row['control'] .= '&nbsp;<span id="ITSM-spinner" class="invisible">&nbsp;'.html_print_image('images/spinner.gif', true).'</span>';
$row['control'] .= '&nbsp;<span id="ITSM-success" class="invisible">&nbsp;'.html_print_image('images/status_sets/default/severity_normal.png', true).'</span>';
$row['control'] .= '&nbsp;<span id="ITSM-failure" class="invisible">&nbsp;'.html_print_image('images/status_sets/default/severity_critical.png', true).'</span>';
$row['control'] .= '<span id="ITSM-message" class="invisible"></span>';
$table_ITSM->data['ITSM_test'] = $row;
$userManagementTable->colspan['pandoraitsm'] = 2;
$userManagementTable->data['pandoraitsm'] = html_print_table($table_ITSM, true);
}
if (isset($CodeQRTable) === true || isset($apiTokenContent) === true) {
// QR Code and API Token advice.
$titleQr = '<span class="font-title-font">'.__('Contact details (QR)').'</span>';
@ -814,16 +870,24 @@ $vcard_data['organization'] = io_safe_output(get_product_name());
$vcard_data['url'] = ui_get_full_url('index.php');
$vcard_json = json_encode($vcard_data);
ui_require_javascript_file('ITSM');
?>
<script type="text/javascript">
$(document).ready(function () {
paint_vcard(
<?php echo $vcard_json; ?>,
"#qr_code_agent_view",
128,
128
);
<?php echo $vcard_json; ?>,
"#qr_code_agent_view",
128,
128
);
$('#button-ITSM').click(function() {
var pass = $('input#password-integria_user_level_pass').val();
var host = '<?php echo $ITSM_host; ?>';
testConectionApi(pass, host);
});
//Hint to change theme.
$('#skin1').on("change", () => {

Binary file not shown.

After

Width:  |  Height:  |  Size: 845 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 892 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 895 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

View File

@ -1,39 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="748px" height="142px" viewBox="0 0 748 142" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 61.2 (89653) - https://sketch.com -->
<title>Integria IMS</title>
<desc>Created with Sketch.</desc>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Integria-IMS" fill-rule="nonzero">
<path d="M71.81,-2.81979301e-15 C43.0949491,-0.325771451 17.0111429,16.6781107 5.72147618,43.0827259 C-5.56819051,69.4873411 0.159601761,100.092722 20.23398,120.627561 C40.3083582,141.1624 70.7759943,147.582689 97.4298109,136.894643 C124.083628,126.206596 141.674581,100.515055 142,71.8 C142.444347,32.5906412 111.019353,0.444829018 71.81,-2.81979301e-15 Z" id="Path" fill="#F65803"></path>
<circle id="Oval" fill="#FFFFFF" cx="43.51" cy="49.89" r="13.76"></circle>
<path d="M43.51,71.66 L43.26,71.66 C41.5736669,71.6393594 39.8955597,71.4212055 38.26,71.01 L38,98.36 C37.9839995,99.6878244 38.4968596,100.967474 39.4254669,101.916717 C40.3540742,102.86596 41.6221446,103.406817 42.95,103.42 L43,103.42 C44.3260824,103.42 45.597852,102.893216 46.5355339,101.955534 C47.4732158,101.017852 48,99.7460824 48,98.42 L48.31,71.06 C46.7379912,71.4417108 45.1275989,71.6430099 43.51,71.66 L43.51,71.66 Z" id="Path" fill="#FFFFFF"></path>
<path d="M94.41,48.12 C88.3631135,41.9016532 80.0832535,38.3557132 71.41,38.27 C68.4333361,38.2395201 65.4662912,38.6129237 62.59,39.38 C64.2200628,42.3331841 65.1313519,45.6288987 65.25,49 C67.208565,48.4885287 69.2257979,48.2363746 71.25,48.25 C77.2810939,48.3159047 83.0384799,50.7772152 87.2533639,55.0915157 C91.468248,59.4058163 93.7946914,65.2190086 93.72,71.25 L93.42,99 C93.4039912,100.326111 93.9154828,101.604257 94.841933,102.553212 C95.7683831,103.502167 97.0338871,104.044182 98.36,104.06 L98.42,104.06 C101.181424,104.06 103.42,101.821424 103.42,99.06 L103.74,71.33 C103.850133,62.6586006 100.491174,54.3026057 94.41,48.12 Z" id="Path" fill="#FFFFFF"></path>
<path d="M171.72,67.81 L171.84,21.08 C171.8139,20.1443474 172.175822,19.2395415 172.84,18.58 C173.507689,17.9157505 174.418525,17.5543075 175.36,17.58 L182.36,17.58 C183.315282,17.5557708 184.239991,17.9176872 184.925039,18.583915 C185.610086,19.2501428 185.997615,20.1644142 186,21.12 L185.88,67.77 C185.889979,68.7136623 185.501469,69.6177631 184.81,70.26 C184.132306,70.9151221 183.222463,71.2747439 182.28,71.26 L175.28,71.26 C174.343006,71.2771853 173.438469,70.9168123 172.77,70.26 C172.079224,69.6357031 171.69568,68.7407667 171.72,67.81 L171.72,67.81 Z" id="Path" fill="#282828"></path>
<path d="M196.6,67.79 L196.72,21.15 C196.703942,20.2132116 197.064148,19.3090953 197.72,18.64 C198.367817,17.9706027 199.269041,17.6072059 200.2,17.64 L211.2,17.64 C212.220464,17.6786713 213.201721,18.0431383 214,18.68 C214.954333,19.3581671 215.769164,20.2137401 216.4,21.2 L238.94,56.06 L239,21.18 C238.972558,20.2529263 239.335335,19.3568684 240,18.71 C240.660878,18.0478442 241.564774,17.6862858 242.5,17.71 L249,17.71 C249.930306,17.697074 250.827049,18.0572118 251.49,18.71 C252.168239,19.3808021 252.531442,20.3069699 252.49,21.26 L252.37,67.91 C252.393322,68.8422107 252.031614,69.7428638 251.37,70.4 C250.707806,71.0601595 249.804802,71.4213611 248.87,71.4 L236.43,71.4 C235.352189,71.3759533 234.306677,71.0274494 233.43,70.4 C232.448952,69.7519451 231.61994,68.8990519 231,67.9 L210.36,35.7 L210.28,67.85 C210.302135,68.7819962 209.940608,69.6821976 209.28,70.34 C208.624212,71.0036445 207.722642,71.3657208 206.79,71.34 L200.2,71.34 C199.262799,71.3583203 198.357839,70.9977785 197.69,70.34 C196.973178,69.6889199 196.575278,68.758054 196.6,67.79 Z" id="Path" fill="#282828"></path>
<path d="M258.64,24.83 L258.64,21.31 C258.611761,20.3566005 258.979489,19.4340518 259.655831,18.7614981 C260.332174,18.0889444 261.256774,17.7264056 262.21,17.76 L309.75,17.88 C310.703399,17.8517613 311.625948,18.2194887 312.298502,18.8958315 C312.971056,19.5721742 313.333594,20.4967742 313.3,21.45 L313.3,25 C313.332066,25.9455402 312.969867,26.8619037 312.3,27.53 C311.623087,28.1989008 310.701164,28.5604392 309.75,28.53 L293.04,28.53 L292.93,68.21 C292.958015,69.1313139 292.594703,70.0214284 291.93,70.66 C291.264603,71.3152777 290.363755,71.675617 289.43,71.6604873 L282.35,71.6604873 C281.420522,71.668505 280.52541,71.3090224 279.86,70.66 C279.197933,70.0155113 278.835379,69.1236302 278.86,68.2 L278.96,28.52 L262.25,28.52 C261.299851,28.544612 260.38013,28.1839373 259.7,27.52 C258.965201,26.8249172 258.576895,25.8394983 258.64,24.83 L258.64,24.83 Z" id="Path" fill="#282828"></path>
<path d="M319.3,68 L319.42,21.35 C319.400371,20.4122847 319.78681,19.5118088 320.48,18.88 C321.149716,18.2251023 322.053417,17.8650622 322.99,17.8795531 L366.19,17.99 C367.130438,17.9859488 368.031045,18.3693397 368.68,19.05 C369.337779,19.717839 369.69832,20.6227989 369.68,21.56 L369.68,25.09 C369.677352,26.0235632 369.303953,26.9178376 368.641949,27.5760911 C367.979945,28.2343446 367.083563,28.6026559 366.15,28.6 L333.52,28.51 L333.52,39.42 L361.62,39.49 C362.553563,39.4926484 363.447838,39.8660468 364.106091,40.528051 C364.764345,41.1900553 365.132656,42.0864368 365.13,43.02 L365.13,46.54 C365.156933,47.4728584 364.79467,48.3748937 364.13,49.03 C363.469788,49.6931635 362.565439,50.054903 361.63,50.03 L333.47,50 L333.47,61.06 L366.03,61.14 C366.94651,61.1221856 367.829599,61.4841076 368.47,62.14 C369.129526,62.7903112 369.491355,63.6840288 369.47,64.61 L369.47,68.21 C369.482675,69.150132 369.102026,70.0528141 368.42,70.7 C367.748458,71.3583482 366.840234,71.7187547 365.9,71.7 L322.9,71.59 C321.962384,71.6106136 321.056564,71.2497292 320.39,70.59 C319.672391,69.9226941 319.2755,68.9796223 319.3,68 L319.3,68 Z" id="Path" fill="#282828"></path>
<path d="M380.06,65.38 C375.64,60.9 373.44,54.0566667 373.459865,44.85 C373.48,35.6433333 375.813333,28.83 380.46,24.41 C385.126667,19.99 392.08,17.7933333 401.32,17.82 L409.68,17.82 C414.926078,17.759622 420.087688,19.1434315 424.6,21.82 C429.026667,24.4866667 431.233333,27.7833333 431.22,31.71 C431.335739,32.9177383 430.840442,34.1034513 429.9,34.87 C429.175254,35.4543658 428.280429,35.7877321 427.35,35.82 L422.9,35.82 C420.76,35.82 419.053333,34.59 417.78,32.13 C416.506667,29.67 413.363333,28.44 408.35,28.44 L401.68,28.44 C396.206667,28.44 392.493333,29.6033333 390.54,31.93 C388.54,34.28 387.6,38.59 387.54,44.93 C387.48,51.27 388.38,55.58 390.13,57.99 C391.88,60.4 394.99,61.62 399.48,61.63 L407.17,61.63 C411.17,61.63 414.043333,60.87 415.79,59.35 C417.596876,57.6376908 418.574219,55.2271554 418.47,52.74 L410,52.74 C409.064789,52.7427064 408.167392,52.3710205 407.507977,51.7078475 C406.848561,51.0446746 406.48198,50.1451807 406.49,49.21 L406.49,46.23 C406.472533,45.2988546 406.833351,44.400416 407.49,43.74 C408.146465,43.0773742 409.047574,42.7154829 409.98,42.74 L428.79,42.79 C429.722858,42.763067 430.624894,43.1253302 431.28,43.79 C431.943164,44.4502124 432.304903,45.354561 432.28,46.29 L432.28,50.44 C432.28,57.44 430.17,62.8133333 425.95,66.56 C421.73,70.3066667 415.566667,72.17 407.46,72.1501593 L399.03,72.1501593 C390.803333,72.1233333 384.48,69.8666667 380.06,65.38 Z" id="Path" fill="#282828"></path>
<path d="M495.8,70.48 C495.8,71.55 495.16,72.09 493.89,72.0801364 L484.89,72.0801364 C483.778533,72.0359158 482.700008,71.6902348 481.77,71.08 C480.713597,70.4696085 479.821334,69.6116631 479.17,68.58 L472.83,58.58 C470.223333,54.48 467.056667,52.4233333 463.33,52.41 L454.18,52.41 L454.18,68.52 C454.203322,69.4522107 453.841614,70.3528638 453.18,71.01 C452.517806,71.6701595 451.614802,72.0313611 450.68,72.01 L443.68,72.01 C442.743006,72.0271853 441.838469,71.6668123 441.17,71.01 C440.503774,70.351816 440.141481,69.446082 440.17,68.51 L440.29,21.86 C440.269803,20.9254087 440.630829,20.0228444 441.29,19.36 C441.927395,18.6758743 442.825092,18.2942622 443.76,18.3095318 L474.67,18.39 C480.39,18.39 485.076667,19.94 488.73,23.04 C492.383333,26.14 494.203333,30.29 494.19,35.49 C494.063333,42.7033333 489.3,47.2066667 479.9,49 C481.484067,49.6135252 482.904514,50.5855906 484.05,51.84 C485.674847,53.654962 487.137133,55.6091383 488.42,57.68 L495.21,68.52 C495.577221,69.1093518 495.780866,69.7858671 495.8,70.48 L495.8,70.48 Z M454.21,41.74 L470.21,41.74 C472.559199,41.8094724 474.88989,41.3048899 477,40.27 C478.881403,39.380915 480.044647,37.4487472 479.95,35.37 C480.055656,33.2834473 478.890265,31.3398116 477,30.45 C474.897868,29.3847581 472.566149,28.8524806 470.21,28.9 L454.21,28.9 L454.21,41.74 Z" id="Shape" fill="#282828"></path>
<path d="M502,68.66 L502.12,21.93 C502.106969,20.9868821 502.48745,20.0809738 503.17,19.43 C503.826139,18.7489431 504.734359,18.3690106 505.68,18.3797664 L512.68,18.3797664 C513.640691,18.3689866 514.564824,18.7478276 515.241347,19.4300041 C515.91787,20.1121806 516.289008,21.039434 516.27,22 L516.15,68.65 C516.159979,69.5936623 515.771469,70.4977631 515.08,71.14 C514.402306,71.7951221 513.492463,72.1547439 512.55,72.14 L505.55,72.14 C504.613006,72.1571853 503.708469,71.7968123 503.04,71.14 C502.344797,70.5069922 501.964251,69.5995358 502,68.66 Z" id="Path" fill="#282828"></path>
<path d="M522.48,68.71 L532,33.06 C534.566667,23.3466667 542.87,18.5 556.91,18.5199384 L577.11,18.57 C577.996001,18.5541891 578.841559,18.9402048 579.41,19.62 C580.006346,20.2917863 580.330809,21.1617749 580.320262,22.06 L580.2,68.86 C580.23056,69.7817714 579.866841,70.6728823 579.2,71.31 C578.525984,71.9645342 577.619419,72.3242822 576.68,72.31 L569.68,72.31 C568.735914,72.3337643 567.822711,71.9728143 567.15,71.31 C566.480133,70.6419037 566.117934,69.7255402 566.15,68.78 L566.15,59.33 L539.51,59.27 L536.98,68.7 C536.727496,69.7139708 536.129991,70.6084614 535.29,71.23 C534.499985,71.8626048 533.521963,72.214411 532.51,72.23 L525.13,72.23 C524.459988,72.2878818 523.794912,72.0733836 523.284971,71.6349475 C522.775031,71.1965113 522.463235,70.571116 522.42,69.9 C522.400467,69.5023251 522.420566,69.1036934 522.48,68.71 Z M542.24,48.64 L566.11,48.7 L566.11,29.14 L555.43,29.14 C550.779549,29.0158892 546.663838,32.130706 545.52,36.64 L542.24,48.64 Z" id="Shape" fill="#282828"></path>
<path d="M590.9,68.88 L591,22.16 C590.986969,21.2168821 591.36745,20.3109738 592.05,19.66 C592.709218,18.9774003 593.621131,18.5974368 594.57,18.6096981 L601.57,18.6096981 C602.520183,18.6019547 603.433929,18.9751711 604.106773,19.6461353 C604.779617,20.3170996 605.155387,21.2297986 605.150057,22.18 L605,68.85 C605.028154,69.7830757 604.665702,70.6855811 604,71.34 C603.323524,71.9970099 602.412865,72.3569544 601.47,72.34 L594.47,72.34 C593.533006,72.3571853 592.628469,71.9968123 591.96,71.34 C591.263951,70.7144482 590.876621,69.8155493 590.9,68.88 Z" id="Path" fill="#F65803"></path>
<path d="M615.78,68.8 L615.9,22.3 C615.875203,21.340928 616.235317,20.4118317 616.9,19.72 C617.547817,19.0506027 618.449041,18.6872059 619.38,18.72 L634.63,18.72 C635.64758,18.7359883 636.627509,19.1074416 637.4,19.77 C638.233003,20.4058524 638.845164,21.2873645 639.15,22.29 L650.15,54.29 L661.29,22.29 C661.608719,21.2943995 662.226826,20.4213666 663.06,19.79 C663.836411,19.140258 664.817595,18.7860398 665.83,18.79 L681.08,18.79 C682.009485,18.7723021 682.901791,19.1547191 683.53,19.84 C684.192419,20.5373141 684.551934,21.4684571 684.53,22.43 L684.38,69 C684.412024,69.9543928 684.050454,70.8800124 683.38,71.56 C682.723535,72.2226258 681.822426,72.5845171 680.89,72.56 L674.1,72.56 C673.168855,72.5774675 672.270416,72.2166488 671.61,71.56 C670.941001,70.8749956 670.579921,69.9470191 670.61,68.99 L670.7,32.39 L657.36,69.13 C656.988416,70.0838348 656.349536,70.9102123 655.52,71.51 C654.734577,72.1438986 653.759218,72.4960135 652.75,72.51 L647.39,72.51 C646.387527,72.4923334 645.419667,72.140384 644.64,71.51 C643.818452,70.8953887 643.179069,70.0693751 642.79,69.12 L629.7,32.23 L629.6,68.83 C629.634802,69.787823 629.273023,70.7175951 628.6,71.4 C627.944212,72.0636445 627.042642,72.4257208 626.11,72.4 L619.37,72.4 C618.432799,72.4183203 617.527839,72.0577785 616.86,71.4 C616.143427,70.7285743 615.750037,69.7815254 615.78,68.8 L615.78,68.8 Z" id="Path" fill="#F65803"></path>
<path d="M692.08,58.84 C691.973218,57.6336327 692.466829,56.4519567 693.4,55.68 C694.12014,55.0807712 695.014494,54.7300443 695.95,54.68 L700.41,54.68 C702.663333,54.68 704.373333,55.91 705.54,58.37 C706.7,60.82 709.34,62.05 713.43,62.06 L726.55,62.35 C730.943333,62.35 733.143333,60.92 733.15,58.06 C733.15,55.8933333 730.483333,54.1766667 725.15,52.91 C722.75,52.33 720.15,51.75 717.21,51.18 C714.27,50.61 711.44,49.9 708.58,49.05 C705.87988,48.2547647 703.245348,47.2517704 700.7,46.05 C698.399488,44.9682289 696.403219,43.3327311 694.89,41.29 C693.392835,39.2306421 692.616105,36.7352654 692.68,34.19 C692.68,29.17 694.473333,25.3066667 698.06,22.6 C701.646667,19.8933333 707.796667,18.56 716.51,18.6 L726.02,18.85 C730.924684,18.8052317 735.735418,20.1956173 739.86,22.85 C743.96,25.5166667 746.003333,28.8133333 745.99,32.74 C746.104216,33.9511338 745.614157,35.1407428 744.68,35.92 C743.972856,36.5214361 743.087125,36.8729163 742.16,36.92 L737.7,36.92 C735.46,36.92 733.75,35.68 732.58,33.22 C731.41,30.76 728.78,29.52 724.68,29.51 L713.41,29.25 C709.01,29.25 706.806667,30.68 706.8,33.54 C706.8,35.12 708.19,36.41 710.97,37.41 C714.24125,38.5440576 717.594334,39.426624 721,40.05 C725,40.8233333 729,41.7533333 733,42.84 C736.752403,43.796252 740.228609,45.6182636 743.15,48.16 C745.84998,50.4490644 747.377502,53.8309112 747.31,57.37 C747.31,62.39 745.506667,66.2533333 741.9,68.96 C738.293333,71.6666667 732.153333,73 723.48,72.96 L712.12,72.71 C707.211841,72.7573081 702.397191,71.3667955 698.27,68.71 C694.143333,66.0833333 692.08,62.7933333 692.08,58.84 Z" id="Path" fill="#F65803"></path>
<path d="M176,111.05 L176,123.81 L171.69,123.81 L171.69,92.61 L183.04,92.61 C188.81,92.61 192.68,96.61 192.68,101.85 C192.68,107.09 188.81,111.05 183.04,111.05 L176,111.05 Z M182.25,107.17 C185.99,107.17 188.25,105.1 188.25,101.89 C188.25,98.68 185.96,96.48 182.25,96.48 L176,96.48 L176,107.17 L182.25,107.17 Z" id="Shape" fill="#888888"></path>
<path d="M203.53,111.71 L209.25,110.87 C210.53,110.69 210.88,110.03 210.88,109.28 C210.88,107.22 209.51,105.5 206.3,105.5 C205.094424,105.418003 203.906525,105.824303 203.003696,106.627445 C202.100867,107.430587 201.558975,108.563079 201.5,109.77 L197.5,108.84 C197.94,104.84 201.6,101.98 206.17,101.98 C212.51,101.98 214.98,105.59 214.98,109.72 L214.98,120.33 C214.964645,121.495374 215.051646,122.659846 215.24,123.81 L211.19,123.81 C211.04052,122.881154 210.976918,121.940514 211,121 C209.510823,123.298723 206.916404,124.637778 204.18,124.52 C199.87,124.52 197.09,121.52 197.09,118.18 C197.1,114.35 199.88,112.23 203.53,111.71 Z M210.88,114.71 L210.88,113.71 L204.41,114.71 C202.65,114.98 201.33,115.99 201.33,117.88 C201.363095,118.748086 201.746619,119.565693 202.392987,120.146105 C203.039355,120.726517 203.893369,121.020169 204.76,120.96 C208.15,121 210.88,119.36 210.88,114.74 L210.88,114.71 Z" id="Shape" fill="#888888"></path>
<path d="M227.77,123.81 L223.64,123.81 L223.64,102.64 L227.64,102.64 L227.64,105.64 C228.983384,103.304982 231.507823,101.904226 234.2,102 C239.26,102 241.77,105.66 241.77,110.37 L241.77,123.79 L237.63,123.79 L237.63,111.09 C237.63,108.09 236.4,105.76 232.7,105.76 C229.44,105.76 227.77,108.36 227.77,111.57 L227.77,123.81 Z" id="Path" fill="#888888"></path>
<path d="M265.39,120.59 C264.123446,123.01383 261.57259,124.489821 258.84,124.38 C252.63,124.38 248.84,119.45 248.84,113.16 C248.84,107.16 252.84,102.07 258.84,102.07 C262.58,102.07 264.6,103.92 265.31,105.63 L265.31,92 L269.4,92 L269.4,119.94 C269.393999,121.249913 269.467467,122.558984 269.62,123.86 L265.62,123.86 C265.474248,122.913625 265.400702,121.957533 265.4,121 L265.39,120.59 Z M259.23,120.73 C263.02,120.73 265.35,117.43 265.35,113.07 C265.35,108.71 263.06,105.72 259.28,105.72 C255.5,105.72 253,108.8 253,113.16 C253,117.52 255.27,120.73 259.23,120.73 L259.23,120.73 Z" id="Shape" fill="#888888"></path>
<path d="M298.53,113.2 C298.53,119.67 294.04,124.47 287.7,124.47 C281.36,124.47 276.88,119.67 276.88,113.2 C276.88,106.73 281.36,102 287.7,102 C294.04,102 298.53,106.78 298.53,113.2 Z M294.3,113.2 C294.3,108.32 291.22,105.68 287.7,105.68 C284.18,105.68 281.1,108.32 281.1,113.2 C281.1,118.08 284.18,120.77 287.7,120.77 C291.22,120.77 294.3,118.13 294.3,113.2 L294.3,113.2 Z" id="Shape" fill="#888888"></path>
<path d="M317.75,106.82 C317.153912,106.733389 316.552347,106.689942 315.95,106.69 C312.47,106.69 310.14,108.54 310.14,113.2 L310.14,123.81 L306,123.81 L306,102.64 L310.05,102.64 L310.05,106.34 C311.132122,103.823292 313.652596,102.233087 316.39,102.34 C316.846155,102.34552 317.301059,102.389004 317.75,102.47 L317.75,106.82 Z" id="Path" fill="#888888"></path>
<path d="M329.46,111.71 L335.18,110.87 C336.45,110.69 336.81,110.03 336.81,109.28 C336.81,107.22 335.44,105.5 332.23,105.5 C331.023761,105.415203 329.834309,105.820526 328.930841,106.624236 C328.027373,107.427945 327.486272,108.562094 327.43,109.77 L323.43,108.84 C323.87,104.84 327.52,101.98 332.1,101.98 C338.44,101.98 340.9,105.59 340.9,109.72 L340.9,120.33 C340.886006,121.495732 340.976367,122.660377 341.17,123.81 L337.17,123.81 C337.007383,122.865645 336.933727,121.908116 336.95,120.95 C335.459417,123.247172 332.865953,124.585734 330.13,124.47 C325.81,124.47 323.04,121.47 323.04,118.13 C323,114.35 325.8,112.23 329.46,111.71 Z M336.81,114.71 L336.81,113.71 L330.34,114.71 C328.58,114.98 327.26,115.99 327.26,117.88 C327.293095,118.748086 327.676619,119.565693 328.322987,120.146105 C328.969355,120.726517 329.823369,121.020169 330.69,120.96 C334.08,121 336.81,119.36 336.81,114.74 L336.81,114.71 Z" id="Shape" fill="#888888"></path>
<polygon id="Path" fill="#888888" points="363.2 123.81 363.2 92.61 382.2 92.61 382.2 96.61 367.52 96.61 367.52 106.61 380.81 106.61 380.81 110.61 367.52 110.61 367.52 123.73"></polygon>
<polygon id="Path" fill="#888888" points="419.09 123.81 419.09 99.52 408.44 123.81 404.44 123.81 393.92 99.52 393.92 123.81 389.65 123.81 389.65 92.61 395.5 92.61 406.5 118 417.59 92.61 423.36 92.61 423.36 123.81"></polygon>
<path d="M449.49,101.06 C448.982092,97.8538566 446.131216,95.5515584 442.89,95.73 C439.37,95.73 436.89,98.02 436.89,100.92 C436.89,103.17 438.25,104.92 440.89,105.46 L445.56,106.46 C450.75,107.6 453.66,110.86 453.66,115.22 C453.66,120.06 449.52,124.46 442.87,124.46 C435.35,124.46 431.78,119.62 431.21,115.17 L435.35,113.85 C435.453196,115.729635 436.299659,117.49107 437.702796,118.746015 C439.105932,120.000959 440.950542,120.64638 442.83,120.54 C447.14,120.54 449.26,118.3 449.26,115.54 C449.26,113.29 447.71,111.36 444.59,110.7 L440.15,109.7 C435.7,108.7 432.53,105.83 432.53,101.16 C432.53,96.28 437.07,91.88 442.83,91.88 C449.83,91.88 452.69,96.23 453.39,99.62 L449.49,101.06 Z" id="Path" fill="#888888"></path>
<polygon id="Path" fill="#888888" points="475 123.81 475 92.61 479.4 92.61 479.4 123.81"></polygon>
<polygon id="Path" fill="#888888" points="500.7 96.61 500.7 123.81 496.39 123.81 496.39 96.61 486 96.61 486 92.61 511.17 92.61 511.17 96.61"></polygon>
<path d="M533.75,101.06 C533.242092,97.8538566 530.391216,95.5515584 527.15,95.73 C523.63,95.73 521.15,98.02 521.15,100.92 C521.15,103.17 522.51,104.92 525.15,105.46 L529.82,106.46 C535.01,107.6 537.91,110.86 537.91,115.22 C537.91,120.06 533.78,124.46 527.13,124.46 C519.61,124.46 516.04,119.62 515.47,115.17 L519.61,113.85 C519.713196,115.729635 520.559659,117.49107 521.962796,118.746015 C523.365932,120.000959 525.210542,120.64638 527.09,120.54 C531.4,120.54 533.51,118.3 533.51,115.54 C533.51,113.29 531.97,111.36 528.85,110.7 L524.4,109.7 C519.96,108.7 516.79,105.83 516.79,101.16 C516.79,96.28 521.32,91.88 527.09,91.88 C534.09,91.88 536.95,96.23 537.65,99.62 L533.75,101.06 Z" id="Path" fill="#888888"></path>
<polygon id="Path" fill="#888888" points="575.46 123.81 575.46 99.52 564.81 123.81 560.81 123.81 550.29 99.52 550.29 123.81 546 123.81 546 92.61 551.85 92.61 562.85 118 574 92.61 579.77 92.61 579.77 123.81"></polygon>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 852 B

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>ITSM icon</title>
<g id="ITSM-icon" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M13,0 C13.5522847,-1.01453063e-16 14,0.44771525 14,1 L14,6 L9.73239368,5.99992752 C9.90258972,6.29411727 10,6.63568294 10,7 C10,8.1045695 9.1045695,9 8,9 C6.8954305,9 6,8.1045695 6,7 C6,6.63568294 6.09741028,6.29411727 6.26760632,5.99992752 L2,6 L2,3 L2.64668367,2.35331633 C2.7130102,2.2869898 2.78443878,2.21556122 2.86096939,2.13903061 L4.78954082,0.210459184 C4.85841837,0.141581633 4.92857143,0.0714285714 5,0 L13,0 Z M14,10 L14,14 C14,15.1045695 13.1045695,16 12,16 L4,16 C2.8954305,16 2,15.1045695 2,14 L2,10 L6.26790938,9.99940385 C6.09752593,10.2937119 6,10.6354668 6,11 C6,12.1045695 6.8954305,13 8,13 C9.1045695,13 10,12.1045695 10,11 C10,10.6354668 9.90247407,10.2937119 9.73209062,9.99940385 L14,10 Z" id="Path-30" fill="#95A3BF"></path>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Hardening@svg</title>
<g id="Hardening" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M11.0387503,1.15463195e-14 C11.6463177,1.01024435e-14 12.2209436,0.276179438 12.6004879,0.750609905 L15.5617376,4.45217202 C15.8454385,4.80679812 16,5.24741913 16,5.70156212 L16,6.23960136 C16,6.72942968 15.8202429,7.20222678 15.4948186,7.56832903 L8.74740932,15.1591645 C8.72137833,15.1884494 8.6936487,15.216179 8.66436384,15.24221 C8.25158107,15.609128 7.6195087,15.5719473 7.25259068,15.1591645 L0.505181363,7.56832903 C0.179757138,7.20222678 -8.28191751e-16,6.72942968 0,6.23960136 L0,5.70156212 C8.32561944e-16,5.24741913 0.154561504,4.80679812 0.438262381,4.45217202 L3.39951208,0.750609905 C3.77905645,0.276179438 4.35368225,1.0991794e-14 4.96124969,1.15463195e-14 Z M8.00018082,3 C7.09496946,3 6.30261511,3.60799488 6.06832917,4.48236191 C5.83404323,5.35672894 6.21624479,6.27944513 7.00018082,6.73205081 L7.00018082,9.00205081 C7.00018082,9.55433556 7.44789607,10.0020508 8.00018082,10.0020508 C8.55246557,10.0020508 9.00018082,9.55433556 9.00018082,9.00205081 L9.00018082,6.73205081 C9.78411685,6.27944513 10.1663184,5.35672894 9.93203247,4.48236191 C9.69774653,3.60799488 8.90539218,3 8.00018082,3 Z" id="Path-32" fill="#A7ADAF"></path>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 329 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

@ -1,10 +1,10 @@
<?php
/**
* Integria incidents management.
* Ajax script for Inventory
*
* @category Ajax library.
* @category Inventory
* @package Pandora FMS
* @subpackage Modules.
* @subpackage Enterprises
* @version 1.0.0
* @license See below
*
@ -26,35 +26,20 @@
* ============================================================================
*/
if (check_login()) {
global $config;
check_login();
include_once $config['homedir'].'/include/functions_integriaims.php';
$get_users = get_parameter('get_users');
$search_term = get_parameter('search_term', '');
if ($get_users) {
$integria_users_csv = integria_api_call(null, null, null, null, 'get_users', []);
$csv_array = explode("\n", $integria_users_csv);
foreach ($csv_array as $csv_line) {
if (!empty($csv_line)) {
$integria_users_values[$csv_line] = $csv_line;
}
if (is_ajax() === true) {
$id_agent = get_parameter('id_agent', '0');
$id_server = get_parameter('id_server', '0');
if (is_metaconsole() === true) {
$agent_modules = [];
$server_name = metaconsole_get_names(['id' => $id_server]);
if (is_array($server_name) === true && count($server_name) > 0) {
$agent_modules = inventory_get_agent_modules($id_agent, 'all', $id_server, reset($server_name));
}
$integria_users_filtered_values = array_filter(
$integria_users_values,
function ($item) use ($search_term) {
if (strpos($item, $search_term) !== false) {
return true;
}
}
);
echo json_encode($integria_users_filtered_values);
return;
} else {
$agent_modules = inventory_get_agent_modules($id_agent);
}
echo json_encode($agent_modules);
}

View File

@ -80,6 +80,7 @@ if (check_login()) {
$save_monitor_filter = get_parameter('save_monitor_filter', 0);
$update_monitor_filter = get_parameter('update_monitor_filter', 0);
$delete_monitor_filter = get_parameter('delete_monitor_filter', 0);
$get_cluster_module_detail = (bool) get_parameter('get_cluster_module_detail', 0);
if ($get_agent_modules_json_by_name === true) {
$agent_name = get_parameter('agent_name');
@ -742,13 +743,6 @@ if (check_login()) {
include_once $config['homedir'].'/include/functions_tags.php';
include_once $config['homedir'].'/include/functions_clippy.php';
// Disable module edition in cluster module list.
$cluster_view = (bool) preg_match(
'/operation\/cluster\/cluster/',
$_SERVER['HTTP_REFERER']
);
$agent_a = (bool) check_acl($config['id_user'], 0, 'AR');
$agent_w = (bool) check_acl($config['id_user'], 0, 'AW');
$access = ($agent_a === true) ? 'AR' : (($agent_w === true) ? 'AW' : 'AR');
@ -758,7 +752,19 @@ if (check_login()) {
$cluster_list = (int) get_parameter('cluster_list');
$sortField = (string) get_parameter('sort_field');
$sort = (string) get_parameter('sort', 'none');
// Disable module edition in cluster module list.
$cluster_view = false;
$url = 'index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agent;
if ((int) agents_get_os($id_agent) === CLUSTER_OS_ID) {
$cluster = PandoraFMS\Cluster::loadFromAgentId($id_agent);
$url = sprintf(
'index.php?sec=estado&sec2=operation/cluster/cluster&op=view&id=%s',
$cluster->id()
);
$cluster_view = true;
}
$selectTypeUp = false;
$selectTypeDown = false;
$selectNameUp = false;
@ -1248,7 +1254,6 @@ if (check_login()) {
$graph_type = return_graphtype($module['id_tipo_modulo']);
$nombre_tipo_modulo = modules_get_moduletype_name($module['id_tipo_modulo']);
$handle = 'stat'.$nombre_tipo_modulo.'_'.$module['id_agente_modulo'];
$url = 'include/procesos.php?agente='.$module['id_agente_modulo'];
$win_handle = dechex(crc32($module['id_agente_modulo'].$module['nombre']));
// Show events for boolean modules by default.
$draw_events = ($graph_type === 'boolean') ? 1 : 0;
@ -1314,6 +1319,23 @@ if (check_login()) {
true
);
if ($cluster_view === true) {
$graphButtons[] = html_print_anchor(
[
'href' => 'javascript: show_cluster_module_detail('.$cluster->id().', \''.$modules_get_agentmodule_name.'\')',
'content' => html_print_image(
'images/plus@svg.svg',
true,
[
'title' => __('Module cluster detail'),
'class' => 'main_menu_icon forced_title',
]
),
],
true
);
}
$data[8] = html_print_div(
[
'class' => 'table_action_buttons',
@ -1340,7 +1362,7 @@ if (check_login()) {
$moduleActionButtons[] = html_print_anchor(
[
'href' => 'index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agente.'&amp;id_agente_modulo='.$module['id_agente_modulo'].'&amp;refr=60'.$additionalLinkAction.'"',
'href' => $url.'&amp;id_agente_modulo='.$module['id_agente_modulo'].'&amp;refr=60'.$additionalLinkAction.'"',
'content' => html_print_image(
$imgaction,
true,
@ -1756,14 +1778,75 @@ if (check_login()) {
return;
}
if ($get_cluster_module_detail === true) {
global $config;
$data = [];
$cluster_id = get_parameter('cluster_id', 0);
$cluster = new PandoraFMS\Cluster($cluster_id);
$modules_ids = $cluster->getIdsModulesInvolved();
$module_name = get_parameter('module_name', '');
try {
$column_names = [
__('Module name'),
__('Agent'),
__('Last status change'),
__('Status'),
];
$columns = [
'nombre',
'alias',
'last_status_change',
'estado',
];
$tableId = 'ModuleByStatus';
// Load datatables user interface.
ui_print_datatable(
[
'id' => $tableId,
'class' => 'info_table align-left-important',
'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $column_names,
'ajax_url' => 'include/ajax/module',
'ajax_data' => [
'get_data_ModulesByStatus' => 1,
'table_id' => $tableId,
'module_name' => $module_name,
'modules_ids' => $modules_ids,
'search' => '',
],
'default_pagination' => 5,
'order' => [
'field' => 'last_status_change',
'direction' => 'desc',
],
'csv' => 0,
'dom_elements' => 'frtip',
'no_move_elements_to_action' => true,
'mini_pagination' => true,
]
);
} catch (\Exception $e) {
echo $e->getMessage();
}
return;
}
if ($get_data_ModulesByStatus === true) {
global $config;
$data = [];
$table_id = get_parameter('table_id', '');
$search = get_parameter('search', '');
$module_name = get_parameter('module_name', '');
$status = get_parameter('status', '');
$start = get_parameter('start', 0);
$modules_ids = get_parameter('modules_ids', []);
$length = get_parameter('length', $config['block_size']);
// There is a limit of (2^32)^2 (18446744073709551615) rows in a MyISAM table, show for show all use max nrows.
$length = ($length != '-1') ? $length : '18446744073709551615';
@ -1771,12 +1854,11 @@ if (check_login()) {
$nodes = get_parameter('nodes', 0);
$disabled_modules = (bool) get_parameter('disabled_modules', false);
$where = '';
$where = '1=1';
$recordsTotal = 0;
if (empty($search) === false) {
$where = 'tagente_modulo.nombre LIKE "%%'.$search.'%%" AND ';
$where .= ' AND tagente_modulo.nombre LIKE "%%'.$search.'%%"';
}
if (str_contains($status, '6') === true) {
@ -1791,16 +1873,32 @@ if (check_login()) {
$status = implode(',', $expl);
}
$where .= sprintf(
'tagente_estado.estado IN (%s)
AND tagente_modulo.delete_pending = 0',
$status,
);
if (empty($status) === false) {
$where .= sprintf(
' AND tagente_estado.estado IN (%s)
AND tagente_modulo.delete_pending = 0',
$status,
);
}
if ($disabled_modules === false) {
$where .= ' AND tagente_modulo.disabled = 0';
}
if (empty($modules_ids) === false && is_array($modules_ids) === true) {
$where .= sprintf(
' AND tagente_modulo.id_agente_modulo IN (%s)',
implode(',', $modules_ids)
);
}
if (empty($module_name) === false) {
$where .= sprintf(
' AND tagente_modulo.nombre = "%s"',
$module_name
);
}
if (is_metaconsole() === false) {
$order_by = '';
switch ($order['field']) {

View File

@ -256,14 +256,6 @@ function process_user_login_remote($login, $pass, $api=false)
}
break;
// Remote Integria.
case 'integria':
if (enterprise_hook('remote_integria_process_user_login', [$login, $pass]) === false) {
$config['auth_error'] = 'User not found in database or incorrect password';
return false;
}
break;
// Unknown authentication method.
default:
$config['auth_error'] = 'User not found in database or incorrect password';

View File

@ -252,6 +252,18 @@ $hack_metaconsole = (is_metaconsole() === true) ? '../../' : '';
echo $chart->render(true);
break;
case 'line_graph':
$params['pdf'] = true;
$params['options']['width'] = '100%';
$params['options']['height'] = 200;
$chart = get_build_setup_charts(
'LINE',
$params['options'],
$params['chart_data']
);
echo $chart->render(true);
break;
case 'slicebar':
// TO-DO Cambiar esto para que se pase por POST, NO SE PUEDE PASAR POR GET.
$params['graph_data'] = json_decode(io_safe_output($config[$params['tokem_config']]), true);

View File

@ -335,66 +335,66 @@ class Diagnostics extends Wizard
$result = '';
if ($agentIdMasterServer !== 0) {
$agentMonitoring = [
'chartAgentsUnknown' => [
'chartAgentsUnknown' => [
'title' => __(
'Graph of the Agents Unknown module.'
),
'nameModule' => 'Agents_Unknown',
'idAgent' => $agentIdMasterServer,
],
'chartDatabaseMain' => [
'chartDatabaseMain' => [
'title' => __(
'Graph of the Database Maintenance module.'
),
'nameModule' => 'Database&#x20;Maintenance',
'idAgent' => $agentIdMasterServer,
],
'chartFreeDiskSpoolDir' => [
'chartFreeDiskSpoolDir' => [
'title' => __(
'Graph of the Free Disk Spool Dir module.'
),
'nameModule' => 'FreeDisk_SpoolDir',
'idAgent' => $agentIdMasterServer,
],
'chartFreeRAM' => [
'chartFreeRAM' => [
'title' => __('Graph of the Free RAM module.'),
'nameModule' => 'Free_RAM',
'idAgent' => $agentIdMasterServer,
],
'chartQueuedModules' => [
'chartQueuedModules' => [
'title' => __(
'Graph of the Queued Modules module.'
),
'nameModule' => 'Queued_Modules',
'idAgent' => $agentIdMasterServer,
],
'chartQueuedAlerts' => [
'chartQueuedAlerts' => [
'title' => __(
'Graph of the Queued Alerts total.'
),
'nameModule' => 'Queued_Alerts',
'idAgent' => $agentIdMasterServer,
],
'chartAlertServerStatus' => [
'chartAlertServerStatus' => [
'title' => __(
'Graph of the Alert Server Status.'
),
'nameModule' => 'Alert_Server_Status',
'idAgent' => $agentIdMasterServer,
],
'chartStatus' => [
'chartStatus' => [
'title' => __('Graph of the Status module.'),
'nameModule' => 'Status',
'idAgent' => $agentIdMasterServer,
],
'chartSystemLoadAVG' => [
'chartSystemLoadAVG' => [
'title' => __(
'Graph of the System Load AVG module.'
),
'nameModule' => 'System_Load_AVG',
'idAgent' => $agentIdMasterServer,
],
'chartExecutionTime' => [
'chartExecutionTime' => [
'title' => __(
'Graph of the Execution Time module.'
),

View File

@ -1261,4 +1261,51 @@ var simTree_'.$target.';
}
/**
* Build Steps.
*
* @param array $steps Steps.
* @param null|boolean $return Output mode.
*
* @return string.
*/
public static function printSteps(array $steps, ?bool $return=false)
{
$i = 1;
$count = count($steps);
$output = '<ol class="steps">';
foreach ($steps as $step) {
$class = '';
if ((int) $step['selected'] === 1) {
$class = 'current';
}
if ($i === 1) {
$class .= ' first';
}
if ($i === $count) {
$class .= ' last';
}
$output .= '<li class="'.$class.'">';
$output .= '<a href="'.$step['link'].'">';
$output .= __('Step').' '.$i.' &raquo; ';
$output .= '<span>'.$step['label'].'</span>';
$output .= '</a>';
$output .= '</li>';
$i++;
}
$output .= '</ol>';
if ($return === true) {
return $output;
}
echo $output;
}
}

View File

@ -960,11 +960,6 @@ class Tree
$agent['counters']['not_init'] = 0;
}
// Quiet image
if (isset($agent['quiet']) && $agent['quiet']) {
$agent['statusImageHTML'] = ui_print_status_sets('agent_no_monitors_ball.png', __('Quiet'), 1, ['is_tree_view' => 'yes', 'class' => 'status_balls', 'style' => 'background: '.COL_QUIET.';'], '', false);
}
// Children
if (empty($agent['children'])) {
$agent['children'] = [];

View File

@ -20,7 +20,7 @@
/**
* Pandora build version and version
*/
$build_version = 'PC230919';
$build_version = 'PC230928';
$pandora_version = 'v7.0NG.773.3';
// Do not overwrite default timezone set if defined.

View File

@ -5834,7 +5834,7 @@ function get_help_info($section_name)
}
break;
case 'setup_integria_tab':
case 'setup_ITSM_tab':
if ($es) {
$result .= '04_using/14_incidence_management';
} else {
@ -5842,7 +5842,7 @@ function get_help_info($section_name)
}
break;
case 'integria_tab':
case 'ITSM_tab':
if ($es) {
$result .= '04_using/14_incidence_management#visualizacion_de_tickets';
} else {

View File

@ -2817,28 +2817,6 @@ function agents_get_agent_group($id_agent, $force_meta=false)
}
/**
* This function gets the count of incidents attached to the agent
*
* @param int The agent id
*
* @return mixed The incidents attached or false
*/
function agents_get_count_incidents($id_agent)
{
if (empty($id_agent)) {
return false;
}
return db_get_value(
'count(*)',
'tincidencia',
'id_agent',
$id_agent
);
}
/**
* Get critical monitors by using the status code in modules.
*
@ -3179,6 +3157,38 @@ function agents_detail_view_status_img($critical, $warning, $unknown, $total, $n
}
// Returns the status div to display agent detail view
function agents_detail_view_status_div($critical, $warning, $unknown, $total, $notinit)
{
if ($total == 0 || $total == $notinit) {
return ui_print_status_agent_div(
AGENT_STATUS_NOT_INIT,
__('No Monitors')
);
} else if ($critical > 0) {
return ui_print_status_agent_div(
AGENT_STATUS_CRITICAL,
__('At least one module in CRITICAL status')
);
} else if ($warning > 0) {
return ui_print_status_agent_div(
AGENT_STATUS_WARNING,
__('At least one module in WARNING status')
);
} else if ($unknown > 0) {
return ui_print_status_agent_div(
AGENT_STATUS_UNKNOWN,
__('At least one module is in UKNOWN status')
);
} else {
return ui_print_status_agent_div(
AGENT_STATUS_NORMAL,
__('All Monitors OK')
);
}
}
function agents_update_gis(
$idAgente,
$latitude,
@ -4386,23 +4396,26 @@ function agents_get_offspring(int $id_agent)
}
function agents_get_starmap(int $id_agent, float $width=0, float $height=0)
{
function agents_get_starmap(
int $id_agent,
float $width=0,
float $height=0,
?array $all_modules=null
) {
ui_require_css_file('heatmap');
$all_modules = agents_get_modules($id_agent, 'id_agente_modulo', ['disabled' => 0]);
if (empty($all_modules)) {
return null;
if (empty($all_modules) === true) {
$all_modules = agents_get_modules($id_agent, 'id_agente_modulo', ['disabled' => 0]);
if (empty($all_modules)) {
return null;
}
}
$total_modules = count($all_modules);
if ($width !== 0 && $height !== 0) {
$measuresProvided = false;
$width = 200;
$height = 50;
} else {
$measuresProvided = true;
}
// Best square.
@ -4421,7 +4434,6 @@ function agents_get_starmap(int $id_agent, float $width=0, float $height=0)
$square_length = min(($width / floor($width / $low)), ($height / floor($height / $low)));
// $measureSymbol = ($measuresProvided === true) ? '' : '%';
// Print starmap.
$html = sprintf(
'<svg id="svg_%s" style="width: %spx; height: %spx;">',
@ -4544,4 +4556,290 @@ function agents_get_starmap(int $id_agent, float $width=0, float $height=0)
function hash_agent_name(string $alias, string $nombre_agente)
{
return hash('sha256', $alias.'|'.$nombre_agente.'|'.time().'|'.sprintf('%04d', rand(0, 10000)));
}
function get_resume_agent_status_header($agent)
{
global $config;
$agentCaptionAddedMessage = [];
$agentCaption = '<span class="subsection_header_title">'.ucfirst(agents_get_alias($agent['id_agente'])).'</span>';
$in_planned_downtime = (bool) db_get_sql(
'SELECT executed FROM tplanned_downtime
INNER JOIN tplanned_downtime_agents
ON tplanned_downtime.id = tplanned_downtime_agents.id_downtime
WHERE tplanned_downtime_agents.id_agent = '.$agent['id_agente'].' AND tplanned_downtime.executed = 1'
);
if ((bool) $agent['disabled'] === true) {
$agentCaptionAddedMessage[] = __('Disabled');
} else if ((bool) $agent['quiet'] === true) {
$agentCaptionAddedMessage[] = __('Quiet');
}
if ($in_planned_downtime === true) {
$agentCaptionAddedMessage[] = __('In scheduled downtime');
}
if (empty($agentCaptionAddedMessage) === false) {
$agentCaption .= '&nbsp;<span class="result_info_text">('.implode(' - ', $agentCaptionAddedMessage).')</span>';
}
$agentIconGroup = ((bool) $config['show_group_name'] === false) ? ui_print_group_icon(
$agent['id_grupo'],
true,
'',
'padding-right: 6px;',
true,
false,
false,
'',
true
) : '';
$agentIconStatus = agents_detail_view_status_img(
$agent['critical_count'],
$agent['warning_count'],
$agent['unknown_count'],
$agent['total_count'],
$agent['notinit_count']
);
$agent_details_agent_caption = html_print_div(
[
'class' => 'agent_details_agent_caption',
'content' => $agentCaption,
],
true
);
$agent_details_agent_data = html_print_div(
[
'class' => 'agent_details_agent_data',
'content' => $agentIconGroup,
],
true
);
$agent_details_agent_status_image = html_print_div(
[
'class' => 'icono_right',
'content' => $agentIconStatus,
],
true
);
$agentStatusHeader = html_print_div(
[
'class' => 'agent_details_header',
'content' => $agent_details_agent_caption.$agent_details_agent_data.$agent_details_agent_status_image,
],
true
);
return $agentStatusHeader;
}
function get_status_agent_chart_pie($id_agente, $graph_width, $data=null)
{
// Fixed width non interactive charts.
$agentStatusGraph = html_print_div(
[
'id' => 'status_pie',
'style' => 'width: '.$graph_width.'px;',
'content' => graph_agent_status(
$id_agente,
$graph_width,
$graph_width,
true,
true,
(empty($data) === true) ? false : $data,
true
),
],
true
);
return $agentStatusGraph;
}
function get_resume_agent_concat($id_agente, $all_groups, $agent)
{
global $config;
$table_contact = new stdClass();
$table_contact->id = 'agent_contact_main';
$table_contact->width = '100%';
$table_contact->cellspacing = 0;
$table_contact->cellpadding = 0;
$table_contact->class = 'floating_form';
$table_contact->style[0] = 'height: 32px; width: 30%; padding-right: 5px; text-align: end; vertical-align: top';
$table_contact->style[1] = 'height: 32px; width: 70%; padding-left: 5px; font-weight: lighter; vertical-align: top';
$agentContactCaption = html_print_div(
[
'class' => 'agent_details_agent_caption',
'content' => '<span class="subsection_header_title">'.__('Agent contact').'</span>',
],
true
);
if ($agent['id_os'] == CLUSTER_OS_ID) {
$cluster = PandoraFMS\Cluster::loadFromAgentId(
$agent['id_agente']
);
$url = 'index.php?sec=reporting&sec2=';
$url .= 'operation/cluster/cluster';
$url .= '&op=view&id='.$cluster->id();
} else {
$url = 'index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$agent['id_agente'];
}
$buttonsRefreshAgent = html_print_button(
__('Refresh data'),
'refresh_data',
false,
'window.location.assign("'.$url.'&amp;refr=60")',
[ 'mode' => 'link' ],
true
);
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') === true) {
$buttonsRefreshAgent .= html_print_button(
__('Force checks'),
'force_checks',
false,
'window.location.assign("'.$url.'&amp;flag_agent=1")',
[ 'mode' => 'link' ],
true
);
}
$buttons_refresh_agent_view = html_print_div(
[
'class' => 'buttons_agent_view',
'content' => $buttonsRefreshAgent,
],
true
);
// Data for agent contact.
$intervalHumanTime = human_time_description_raw($agent['intervalo']);
$lastContactDate = ui_print_timestamp($agent['ultimo_contacto'], true);
$remoteContactDate = ($agent['ultimo_contacto_remoto'] === '01-01-1970 00:00:00') ? __('Never') : date_w_fixed_tz($agent['ultimo_contacto_remoto']);
$lastAndRemoteContact = sprintf('%s / %s', $lastContactDate, $remoteContactDate);
$progress = agents_get_next_contact($id_agente);
$tempTimeToShow = ($agent['intervalo'] - (strtotime('now') - strtotime($agent['ultimo_contacto'])));
$progressCaption = ($tempTimeToShow >= 0) ? sprintf('%d s', $tempTimeToShow) : __('Out of bounds');
$ajaxNextContactInterval = (empty($agent['intervalo']) === true) ? 0 : (100 / $agent['intervalo']);
$secondary_groups = enterprise_hook('agents_get_secondary_groups', [$id_agente]);
$secondaryLinks = [];
if (empty($secondary_groups['for_select']) === true) {
$secondaryLinks[] = '<em>'.__('N/A').'</em>';
} else {
foreach ($secondary_groups['for_select'] as $id => $name) {
$secondaryLinks[] = html_print_anchor(
[
'href' => 'index.php?sec=estado&amp;sec2=operation/agentes/estado_agente&amp;refr=60&amp;group_id='.$id,
'content' => $name,
],
true
);
}
}
$last_status_change_agent = agents_get_last_status_change($agent['id_agente']);
$time_elapsed = (empty($last_status_change_agent) === false) ? human_time_comparation($last_status_change_agent) : '<em>'.__('N/A').'</em>';
// Agent Interval.
$data = [];
$data[0] = __('Interval');
$data[1] = $intervalHumanTime;
$table_contact->data[] = $data;
// Last & Remote contact.
$data = [];
$data[0] = __('Last contact').' / '.__('Remote');
$data[1] = $lastAndRemoteContact;
$table_contact->data[] = $data;
// Next contact progress.
$data = [];
$data[0] = __('Next contact');
$data[1] = ui_progress(
$progress,
'80%',
'1.2',
'#ececec',
true,
$progressCaption,
[
'page' => 'operation/agentes/ver_agente',
'interval' => $ajaxNextContactInterval,
'data' => [
'id_agente' => $id_agente,
'refresh_contact' => 1,
],
]
);
$table_contact->data[] = $data;
// Group line.
$data = [];
$data[0] = '<b>'.__('Group').'</b>';
$data[1] = html_print_anchor(
[
'href' => 'index.php?sec=gagente&sec2=godmode/groups/tactical&id_group='.$agent['id_grupo'],
'content' => groups_get_name($agent['id_grupo']),
],
true
);
$table_contact->data[] = $data;
// Secondary groups.
$data = [];
$data[0] = '<b>'.__('Secondary groups').'</b>';
$data[1] = implode(', ', $secondaryLinks);
$table_contact->data[] = $data;
// Parent agent line.
if (enterprise_installed() === true) {
$data = [];
$data[0] = '<b>'.__('Parent').'</b>';
if ((int) $agent['id_parent'] === 0) {
$data[1] = '<em>'.__('N/A').'</em>';
} else {
$data[1] = html_print_anchor(
[
'href' => 'index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$agent['id_parent'],
'content' => agents_get_alias($agent['id_parent']),
],
true
);
}
$table_contact->data[] = $data;
}
// Last status change line.
$data = [];
$data[0] = '<b>'.__('Last status change').'</b>';
$data[1] = $time_elapsed;
$table_contact->data[] = $data;
$agent_contact = html_print_div(
[
'class' => 'agent_details_header',
'content' => $agentContactCaption.$buttons_refresh_agent_view,
],
true
);
$agent_contact .= html_print_table($table_contact, true);
return $agent_contact;
}

View File

@ -688,11 +688,67 @@ function alerts_get_alert_templates_types()
$types['onchange'] = __('On Change');
$types['always'] = __('Always');
$types['not_normal'] = __('Not normal status');
$types['complex'] = __('Complex alert');
return $types;
}
/**
* Get matemathical functions for complex alert templates.
*
* @return array Mathematical function for complex templates.
*/
function alerts_get_alert_templates_functions()
{
$functions = [];
$functions['avg'] = __('Avg.');
$functions['sum'] = __('Sum.');
$functions['max'] = __('Max.');
$functions['min'] = __('Min.');
return $functions;
}
/**
* Get conditions for complex alert templates.
*
* @return array Conditions for complex templates.
*/
function alerts_get_alert_templates_conditions()
{
$conditions = [];
$conditions['lower'] = __('&lt;');
$conditions['greater'] = __('&gt;');
$conditions['equal'] = __('=');
return $conditions;
}
/**
* Get time windows for complex alert templates.
*
* @return array Windows for complex templates.
*/
function alerts_get_alert_templates_windows()
{
$windows = [];
$windows['thirty_days'] = __('Last 30 days');
$windows['month'] = __('This month');
$windows['seven_days'] = __('Last 7 days');
$windows['week'] = __('This week');
$windows['one_day'] = __('Last 24 hours');
$windows['today'] = __('Today');
return $windows;
}
/**
* Get type name of an alert template.
*
@ -2683,6 +2739,11 @@ function alerts_ui_update_or_create_actions($update=true)
$values = [];
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
$field_value = get_parameter('field'.$i.'_value');
if (empty(get_parameter('field'.$i.'_value_hidden')) === false) {
$field_value = get_parameter('field'.$i.'_value_hidden');
} else {
$field_value = get_parameter('field'.$i.'_value');
}
if (is_array($field_value)) {
$field_value = reset(array_filter($field_value));
@ -2695,7 +2756,11 @@ function alerts_ui_update_or_create_actions($update=true)
$values['field'.$i] = (string) $field_value;
$info_fields .= ' Field'.$i.': '.$values['field'.$i];
$field_recovery_value = get_parameter('field'.$i.'_recovery_value');
if (empty(get_parameter('field'.$i.'_recovery_value_hidden')) === false) {
$field_recovery_value = get_parameter('field'.$i.'_recovery_value_hidden');
} else {
$field_recovery_value = get_parameter('field'.$i.'_recovery_value');
}
if (is_array($field_recovery_value)) {
$field_recovery_value = reset(array_filter($field_recovery_value));

View File

@ -17783,3 +17783,117 @@ function api_token_check(string $token)
return db_get_value('id_user', 'tusuario', 'api_token', $token);
}
}
/**
* Extract info Agents for inventories ITSM.
*
* @return string Json output.
*/
function api_get_itsm_agents($thrash1, $thrash2, $other)
{
$custom_fields = db_get_all_fields_in_table('tagent_custom_fields');
if ($custom_fields === false) {
$custom_fields = [];
}
$count_custom_fields = count($custom_fields);
$custom_field_sql = '';
$index_name_custom_fields = [];
foreach ($custom_fields as $key => $field) {
$index_name_custom_fields[$field['name']] = $field;
if ($key !== $count_custom_fields) {
$custom_field_sql .= ', ';
}
$custom_field_sql .= sprintf(
'MAX(CASE WHEN tagent_custom_fields.name = "%s" THEN tagent_custom_data.description END) AS "%s"',
$field['name'],
$field['name']
);
}
$where = '1=1';
$limit = '';
if (empty($other['data']) === false) {
// Current idAgent.
if (isset($other['data'][0]) === true && empty($other['data'][0]) === false) {
$where = sprintf(' tagente.id_agente > %d', $other['data'][0]);
}
// Offset
if (isset($other['data'][1]) === true && empty($other['data'][1]) === false) {
$limit = sprintf(' LIMIT %d OFFSET %d', $other['data'][1], 0);
}
}
$sql = sprintf(
'SELECT tagente.alias,
tagente.id_agente AS "ID Agent",
tagente.os_version AS "OS Version",
tagente.direccion AS "IP Address",
tagente.url_address AS "URL Address",
tgrupo.nombre AS "Group",
tconfig_os.name AS "OS"
%s
FROM tagente
LEFT JOIN tagent_custom_data
ON tagent_custom_data.id_agent = tagente.id_agente
LEFT JOIN tagent_custom_fields
ON tagent_custom_data.id_field = tagent_custom_fields.id_field
INNER JOIN tgrupo
ON tgrupo.id_grupo = tagente.id_grupo
INNER JOIN tconfig_os
ON tconfig_os.id_os = tagente.id_os
WHERE %s
GROUP BY tagente.id_agente
ORDER BY tagente.id_agente
%s',
$custom_field_sql,
$where,
$limit
);
$data = db_get_all_rows_sql($sql);
if ($data === false) {
$data = [];
}
$result = [];
foreach ($data as $key => $agent_fields) {
foreach ($agent_fields as $name_field => $value_field) {
$type = 'text';
if (isset($index_name_custom_fields[$name_field]) === true) {
if ($index_name_custom_fields[$name_field]['is_password_type']) {
$type = 'password';
} else if ($index_name_custom_fields[$name_field]['is_link_enabled']) {
$type = 'link';
}
}
$result[$agent_fields['ID Agent']][$name_field] = [
'data' => $value_field,
'type' => $type,
];
}
}
returnData('json', $result);
}
/**
* Extract info Agents for inventories ITSM.
*
* @return string Json output.
*/
function api_get_itsm_count_agents()
{
$sql = 'SELECT COUNT(tagente.id_agente) FROM tagente';
$result = db_get_value_sql($sql);
if ($result === false) {
$result = 0;
}
returnData('json', (int) $result);
}

View File

@ -34,6 +34,7 @@ enterprise_include_once('include/functions_config.php');
use PandoraFMS\Core\DBMaintainer;
use PandoraFMS\Core\Config;
use PandoraFMS\ITSM\ITSM;
/**
@ -244,18 +245,6 @@ function config_update_config()
$error_update[] = __('Enable GIS features');
}
if (config_update_value('integria_inventory', get_parameter('integria_inventory'), true) === false) {
$error_update[] = __('Integria inventory');
}
if (config_update_value('integria_api_password', io_input_password(get_parameter('integria_api_password')), true) === false) {
$error_update[] = __('Integria API password');
}
if (config_update_value('integria_url', get_parameter('integria_url'), true) === false) {
$error_update[] = __('Integria URL');
}
if (config_update_value('activate_netflow', (bool) get_parameter('activate_netflow'), true) === false) {
$error_update[] = __('Enable Netflow');
}
@ -783,26 +772,6 @@ function config_update_config()
$error_update[] = __('Password');
}
if (config_update_value('rintegria_server', get_parameter('rintegria_server'), true) === false) {
$error_update[] = __('Integria host');
}
if (config_update_value('rintegria_port', get_parameter('rintegria_port'), true) === false) {
$error_update[] = __('MySQL port');
}
if (config_update_value('rintegria_dbname', get_parameter('rintegria_dbname'), true) === false) {
$error_update[] = __('Database name');
}
if (config_update_value('rintegria_user', get_parameter('rintegria_user'), true) === false) {
$error_update[] = __('User');
}
if (config_update_value('rintegria_pass', io_input_password(get_parameter('rintegria_pass')), true) === false) {
$error_update[] = __('Password');
}
if (config_update_value('saml_path', get_parameter('saml_path'), true) === false) {
$error_update[] = __('Saml path');
}
@ -1486,7 +1455,7 @@ function config_update_config()
// --------------------------------------------------
// CUSTOM INTERVAL VALUES
// --------------------------------------------------
$interval_values = get_parameter('interval_values');
$interval_values = $config['interval_values'];
// Add new interval value if is provided.
$interval_value = (float) get_parameter('interval_value', 0);
@ -1528,6 +1497,7 @@ function config_update_config()
$interval_values = implode(',', $interval_values_array);
}
hd($interval_values, true);
if (config_update_value('interval_values', $interval_values, true) === false) {
$error_update[] = __('Delete interval');
}
@ -1920,103 +1890,137 @@ function config_update_config()
}
break;
case 'integria':
if (config_update_value('integria_user_level_conf', (int) get_parameter('integria_user_level_conf', 0), true) === false) {
$error_update[] = __('Integria user login');
case 'ITSM':
if (config_update_value('ITSM_user_level_conf', (int) get_parameter('ITSM_user_level_conf', 0), true) === false) {
$error_update[] = __('Pandora ITSM user login');
}
if (config_update_value('integria_enabled', (int) get_parameter('integria_enabled', 0), true) === false) {
$error_update[] = __('Enable Integria IMS');
if (config_update_value('ITSM_enabled', (int) get_parameter('ITSM_enabled', 0), true) === false) {
$error_update[] = __('Enable Pandora ITSM');
}
if (config_update_value('integria_user', (string) get_parameter('integria_user', $config['integria_user']), true) === false) {
$error_update[] = __('Integria user');
if (config_update_value('ITSM_token', io_input_password((string) get_parameter('ITSM_token', $config['ITSM_token'])), true) === false) {
$error_update[] = __('Pandora ITSM token');
}
if (config_update_value('integria_pass', io_input_password((string) get_parameter('integria_pass', $config['integria_pass'])), true) === false) {
$error_update[] = __('Integria password');
}
$ITSM_hostname = (string) get_parameter('ITSM_hostname', $config['ITSM_hostname']);
$integria_hostname = (string) get_parameter('integria_hostname', $config['integria_hostname']);
if (parse_url($integria_hostname, PHP_URL_SCHEME) === null) {
if (parse_url($ITSM_hostname, PHP_URL_SCHEME) === null) {
if (empty($_SERVER['HTTPS']) === false) {
$integria_hostname = 'https://'.$integria_hostname;
$ITSM_hostname = 'https://'.$ITSM_hostname;
} else {
$integria_hostname = 'http://'.$integria_hostname;
$ITSM_hostname = 'http://'.$ITSM_hostname;
}
}
if (config_update_value('integria_hostname', $integria_hostname, true) === false) {
$error_update[] = __('integria API hostname');
if (config_update_value('ITSM_hostname', $ITSM_hostname, true) === false) {
$error_update[] = __('Pandora ITSM API hostname');
}
if (config_update_value('integria_api_pass', io_input_password((string) get_parameter('integria_api_pass', $config['integria_api_pass'])), true) === false) {
$error_update[] = __('Integria API password');
$ITSM_public_url = (string) get_parameter('ITSM_public_url', $config['ITSM_public_url']);
if (config_update_value('ITSM_public_url', $ITSM_public_url, true) === false) {
$error_update[] = __('Pandora ITSM API public url');
}
if (config_update_value('integria_req_timeout', (int) get_parameter('integria_req_timeout', $config['integria_req_timeout']), true) === false) {
$error_update[] = __('Integria request timeout');
$ITSM_agents_sync = (int) get_parameter('ITSM_agents_sync', $config['ITSM_agents_sync']);
if (config_update_value('ITSM_agents_sync', $ITSM_agents_sync, true) === false) {
$error_update[] = __('Pandora ITSM API agents sync');
}
if (config_update_value('default_group', (int) get_parameter('default_group', $config['default_group']), true) === false) {
$error_update[] = __('Integria default group');
$incident_default_group = (int) get_parameter('default_group', $config['default_group']);
if (empty($incident_default_group) === true) {
try {
$ITSM = new ITSM();
$incident_default_group = array_keys($ITSM->getGroups())[0];
} catch (\Throwable $th) {
$error = $th->getMessage();
}
}
if (config_update_value('cr_default_group', (int) get_parameter('cr_default_group', $config['cr_default_group']), true) === false) {
$error_update[] = __('Integria custom response default group');
if (config_update_value('default_group', $incident_default_group, true) === false) {
$error_update[] = __('Pandora ITSM default group');
}
if (config_update_value('default_criticity', (int) get_parameter('default_criticity', $config['default_criticity']), true) === false) {
$error_update[] = __('Integria default priority');
$incident_cr_default_group = (int) get_parameter('cr_default_group', $config['cr_default_group']);
if (empty($incident_cr_default_group) === true) {
try {
$ITSM = new ITSM();
$incident_cr_default_group = array_keys($ITSM->getGroups())[0];
} catch (\Throwable $th) {
$error = $th->getMessage();
}
}
if (config_update_value('cr_default_criticity', (int) get_parameter('cr_default_criticity', $config['cr_default_criticity']), true) === false) {
$error_update[] = __('Integria custom response default priority');
if (config_update_value('cr_default_group', $incident_cr_default_group, true) === false) {
$error_update[] = __('Pandora ITSM custom response default group');
}
if (config_update_value('default_criticity', (string) get_parameter('default_criticity', $config['default_criticity']), true) === false) {
$error_update[] = __('Pandora ITSM default priority');
}
if (config_update_value('cr_default_criticity', (string) get_parameter('cr_default_criticity', $config['cr_default_criticity']), true) === false) {
$error_update[] = __('Pandora ITSM custom response default priority');
}
if (config_update_value('default_creator', (string) get_parameter('default_creator', $config['default_creator']), true) === false) {
$error_update[] = __('Integria default creator');
$error_update[] = __('Pandora ITSM default creator');
}
if (config_update_value('default_owner', (string) get_parameter('default_owner', $config['default_owner']), true) === false) {
$error_update[] = __('Integria default owner');
if (config_update_value('default_owner', (string) get_parameter('default_owner_hidden', $config['default_owner']), true) === false) {
$error_update[] = __('Pandora ITSM default owner');
}
if (config_update_value('cr_default_owner', (string) get_parameter('cr_default_owner', $config['cr_default_owner']), true) === false) {
$error_update[] = __('Integria custom response default owner');
if (config_update_value('cr_default_owner', (string) get_parameter('cr_default_owner_hidden', $config['cr_default_owner']), true) === false) {
$error_update[] = __('Pandora ITSM custom response default owner');
}
if (config_update_value('incident_type', (int) get_parameter('incident_type', $config['incident_type']), true) === false) {
$error_update[] = __('Integria default ticket type');
$error_update[] = __('Pandora ITSM default ticket type');
}
if (config_update_value('cr_incident_type', (int) get_parameter('cr_incident_type', $config['cr_incident_type']), true) === false) {
$error_update[] = __('Integria custom response default ticket type');
$error_update[] = __('Pandora ITSM custom response default ticket type');
}
if (config_update_value('incident_status', (int) get_parameter('incident_status', $config['incident_status']), true) === false) {
$error_update[] = __('Integria default ticket status');
if (config_update_value('incident_status', (string) get_parameter('incident_status', $config['incident_status']), true) === false) {
$error_update[] = __('Pandora ITSM default ticket status');
}
if (config_update_value('cr_incident_status', (int) get_parameter('cr_incident_status', $config['cr_incident_status']), true) === false) {
$error_update[] = __('Integria custom response default ticket status');
if (config_update_value('cr_incident_status', (string) get_parameter('cr_incident_status', $config['cr_incident_status']), true) === false) {
$error_update[] = __('Pandora ITSM custom response default ticket status');
}
if (config_update_value('incident_title', (string) get_parameter('incident_title', $config['incident_title']), true) === false) {
$error_update[] = __('Integria default ticket title');
$error_update[] = __('Pandora ITSM default ticket title');
}
if (config_update_value('cr_incident_title', (string) get_parameter('cr_incident_title', $config['cr_incident_title']), true) === false) {
$error_update[] = __('Integria custom response default ticket title');
$error_update[] = __('Pandora ITSM custom response default ticket title');
}
if (config_update_value('incident_content', (string) get_parameter('incident_content', $config['incident_content']), true) === false) {
$error_update[] = __('Integria default ticket content');
$text_incident_content = (string) get_parameter('incident_content', $config['incident_content']);
if (empty($text_incident_content) === true) {
$text_incident_content = sprintf(
'Hello, %s %s A new ticket has been created due a problem in monitoring. %s %s Agent : _agent_ %s Module: _module_ %s %s Regards, %s Your %s server.',
PHP_EOL,
PHP_EOL,
PHP_EOL,
PHP_EOL,
PHP_EOL,
PHP_EOL,
PHP_EOL,
PHP_EOL,
get_product_name()
);
}
if (config_update_value('incident_content', $text_incident_content, true) === false) {
$error_update[] = __('Pandora ITSM default ticket content');
}
if (config_update_value('cr_incident_content', (string) get_parameter('cr_incident_content', $config['cr_incident_content']), true) === false) {
$error_update[] = __('Integria custom response default ticket content');
$error_update[] = __('Pandora ITSM custom response default ticket content');
}
break;
@ -3369,26 +3373,6 @@ function config_process_config()
config_update_value('rpandora_pass', '');
}
if (!isset($config['rintegria_server'])) {
config_update_value('rintegria_server', 'localhost');
}
if (!isset($config['rintegria_port'])) {
config_update_value('rintegria_port', 3306);
}
if (!isset($config['rintegria_dbname'])) {
config_update_value('rintegria_dbname', 'integria');
}
if (!isset($config['rintegria_user'])) {
config_update_value('rintegria_user', 'integria');
}
if (!isset($config['rintegria_pass'])) {
config_update_value('rintegria_pass', '');
}
if (!isset($config['saml_path'])) {
config_update_value('saml_path', '/opt/');
}
@ -3838,21 +3822,25 @@ function config_process_config()
config_update_value('ehorus_req_timeout', 5);
}
// Integria.
if (!isset($config['integria_user_level_conf'])) {
config_update_value('integria_user_level_conf', 0);
// ITSM.
if (!isset($config['ITSM_user_level_conf'])) {
config_update_value('ITSM_user_level_conf', 0);
}
if (!isset($config['integria_enabled'])) {
config_update_value('integria_enabled', 0);
if (!isset($config['ITSM_enabled'])) {
config_update_value('ITSM_enabled', 0);
}
if (!isset($config['integria_req_timeout'])) {
config_update_value('integria_req_timeout', 5);
if (!isset($config['ITSM_hostname'])) {
config_update_value('ITSM_hostname', '');
}
if (!isset($config['integria_hostname'])) {
config_update_value('integria_hostname', '');
if (!isset($config['ITSM_public_url'])) {
config_update_value('ITSM_public_url', '');
}
if (!isset($config['ITSM_agents_sync'])) {
config_update_value('ITSM_agents_sync', 20);
}
// Module Library.

View File

@ -2567,6 +2567,10 @@ function db_get_column_type(string $table, string $column='')
*/
function db_validate_sql(string $sql, $server=false)
{
if ($server == 0) {
$server = false;
}
if ($server !== false && is_metaconsole() === true) {
$setup = metaconsole_get_connection($server);
if (metaconsole_connect($setup) !== NOERR) {

View File

@ -3650,6 +3650,12 @@ function events_page_responses($event)
} else {
$responses = [];
foreach ($event_responses as $v) {
if ((isset($config['ITSM_enabled']) === false || (bool) $config['ITSM_enabled'] === false)
&& $v['name'] === 'Create&#x20;ticket&#x20;in&#x20;Pandora&#x20;ITSM&#x20;from&#x20;event'
) {
continue;
}
$responses[$v['id']] = $v['name'];
}
@ -5019,9 +5025,6 @@ function events_page_general($event)
}
$data[1] = $user_ack.'&nbsp;(&nbsp;';
// hd($config['date_format'], true);
// hd($event['ack_utimestamp_raw'], true);
// TODO: mirar en el manage y en la api que este ack de venir vacio lo herede del anterior que hubiera.
if ($event['ack_utimestamp_raw'] !== false
&& $event['ack_utimestamp_raw'] !== 'false'
&& empty($event['ack_utimestamp_raw']) === false

View File

@ -32,7 +32,6 @@ require_once $config['homedir'].'/include/functions_reporting.php';
require_once $config['homedir'].'/include/functions_agents.php';
require_once $config['homedir'].'/include/functions_modules.php';
require_once $config['homedir'].'/include/functions_users.php';
require_once $config['homedir'].'/include/functions_integriaims.php';
/**
@ -2917,223 +2916,6 @@ function graph_sla_slicebar(
}
/**
* Print a pie graph with priodity incident
*/
function grafico_incidente_prioridad()
{
global $config;
$integria_ticket_count_by_priority_json = integria_api_call(null, null, null, null, 'get_tickets_count', ['prioridad', 30], false, '', '|;|');
$integria_priorities_map_json = integria_api_call(null, null, null, null, 'get_incident_priorities', '', false, 'json');
$integria_ticket_count_by_priority = json_decode($integria_ticket_count_by_priority_json, true);
$integria_priorities_map = json_decode($integria_priorities_map_json, true);
$integria_priorities_map_ids = array_column($integria_priorities_map, 'id');
$integria_priorities_map_names = array_column($integria_priorities_map, 'name');
$integria_priorities_map_indexed_by_id = array_combine($integria_priorities_map_ids, $integria_priorities_map_names);
$data = [];
$labels = [];
foreach ($integria_ticket_count_by_priority as $item) {
$priority_name = $integria_priorities_map_indexed_by_id[$item['prioridad']];
$labels[] = io_safe_output($priority_name);
$data[] = $item['n_incidents'];
}
if ($config['fixed_graph'] == false) {
$water_mark = [
'file' => $config['homedir'].'/images/logo_vertical_water.png',
'url' => ui_get_full_url('images/logo_vertical_water.png', false, false, false),
];
}
$options = [
'width' => 320,
'height' => 200,
'waterMark' => $water_mark,
'legend' => [
'display' => true,
'position' => 'right',
'align' => 'center',
],
'labels' => $labels,
];
$output = '<div style="width:inherit;margin: 0 auto;">';
$output .= pie_graph(
$data,
$options
);
$output .= '</div>';
return $output;
}
/**
* Print a pie graph with incidents data
*/
function graph_incidents_status()
{
global $config;
$integria_ticket_count_by_status_json = integria_api_call(null, null, null, null, 'get_tickets_count', ['estado', 30], false, '', '|;|');
$integria_status_map_json = integria_api_call(null, null, null, null, 'get_incidents_status', '', false, 'json');
$integria_ticket_count_by_status = json_decode($integria_ticket_count_by_status_json, true);
$integria_status_map = json_decode($integria_status_map_json, true);
$integria_status_map_ids = array_column($integria_status_map, 'id');
$integria_status_map_names = array_column($integria_status_map, 'name');
$integria_status_map_indexed_by_id = array_combine($integria_status_map_ids, $integria_status_map_names);
$data = [];
$labels = [];
foreach ($integria_ticket_count_by_status as $item) {
$status_name = $integria_status_map_indexed_by_id[$item['estado']];
$labels[] = io_safe_output($status_name);
$data[] = $item['n_incidents'];
}
if ($config['fixed_graph'] == false) {
$water_mark = [
'file' => $config['homedir'].'/images/logo_vertical_water.png',
'url' => ui_get_full_url('images/logo_vertical_water.png', false, false, false),
];
}
$options = [
'width' => 320,
'height' => 200,
'waterMark' => $water_mark,
'legend' => [
'display' => true,
'position' => 'right',
'align' => 'center',
],
'labels' => $labels,
];
$output = '<div style="width:inherit;margin: 0 auto;">';
$output .= pie_graph(
$data,
$options
);
$output .= '</div>';
return $output;
}
/**
* Print a pie graph with incident data by group
*/
function graphic_incident_group()
{
global $config;
$integria_ticket_count_by_group_json = integria_api_call(null, null, null, null, 'get_tickets_count', ['id_grupo', 30], false, '', '|;|');
$integria_group_map_json = integria_api_call(null, null, null, null, 'get_groups', '', false, 'json');
$integria_ticket_count_by_group = json_decode($integria_ticket_count_by_group_json, true);
$integria_group_map = json_decode($integria_group_map_json, true);
$data = [];
$labels = [];
foreach ($integria_ticket_count_by_group as $item) {
$group_name = $integria_group_map[$item['id_grupo']];
$labels[] = io_safe_output($group_name);
$data[] = $item['n_incidents'];
}
if ($config['fixed_graph'] == false) {
$water_mark = [
'file' => $config['homedir'].'/images/logo_vertical_water.png',
'url' => ui_get_full_url('images/logo_vertical_water.png', false, false, false),
];
}
$options = [
'width' => 320,
'height' => 200,
'waterMark' => $water_mark,
'legend' => [
'display' => true,
'position' => 'right',
'align' => 'center',
],
'labels' => $labels,
];
$output = '<div style="width:inherit;margin: 0 auto;">';
$output .= pie_graph(
$data,
$options
);
$output .= '</div>';
return $output;
}
/**
* Print a graph with access data of agents
*
* @param integer id_agent Agent ID
* @param integer width pie graph width
* @param integer height pie graph height
* @param integer period time period
*/
function graphic_incident_user()
{
global $config;
$integria_ticket_count_by_user_json = integria_api_call(null, null, null, null, 'get_tickets_count', ['id_usuario', 30], false, '', '|;|');
$integria_ticket_count_by_user = json_decode($integria_ticket_count_by_user_json, true);
$data = [];
$labels = [];
foreach ($integria_ticket_count_by_user as $item) {
$labels[] = (empty($item['id_usuario']) === false) ? io_safe_output($item['id_usuario']) : '--';
$data[] = $item['n_incidents'];
}
if ($config['fixed_graph'] == false) {
$water_mark = [
'file' => $config['homedir'].'/images/logo_vertical_water.png',
'url' => ui_get_full_url('images/logo_vertical_water.png', false, false, false),
];
}
$options = [
'width' => 320,
'height' => 200,
'waterMark' => $water_mark,
'legend' => [
'display' => true,
'position' => 'right',
'align' => 'center',
],
'labels' => $labels,
];
$output = '<div style="width:inherit;margin: 0 auto;">';
$output .= pie_graph(
$data,
$options
);
$output .= '</div>';
return $output;
}
function series_suffix_leyend($series_name, $series_suffix, $id_agent, $data_module_graph, $array_data)
{
global $config;

View File

@ -6280,6 +6280,20 @@ function html_print_input($data, $wrapper='div', $input_only=false)
);
break;
case 'date_range':
$output .= html_print_select_date_range(
$data['name'],
true,
(isset($data['selected']) === true) ? $data['selected'] : SECONDS_1DAY,
(isset($data['date_init']) === true) ? $data['date_init'] : '',
(isset($data['time_init']) === true) ? $data['time_init'] : '',
(isset($data['date_end']) === true) ? $data['date_end'] : '',
(isset($data['time_end']) === true) ? $data['time_end'] : '',
(isset($data['date_text']) === true) ? $data['date_text'] : SECONDS_1DAY,
(isset($data['class']) === true) ? $data['class'] : 'w100p',
);
break;
default:
// Ignore.
break;
@ -6328,7 +6342,7 @@ function html_print_input_multicheck(array $data):string
/**
* Print an autocomplete input filled out with Integria IMS users.
* Print an autocomplete input filled out with Pandora ITSM users.
*
* @param string $name The name of ajax control, by default is "users".
* @param string $default The default value to show in the ajax control.
@ -6340,7 +6354,7 @@ function html_print_input_multicheck(array $data):string
*
* @return mixed If the $return is true, return the output as string.
*/
function html_print_autocomplete_users_from_integria(
function html_print_autocomplete_users_from_pandora_itsm(
$name='users',
$default='',
$return=false,
@ -6368,8 +6382,6 @@ function html_print_autocomplete_users_from_integria(
$attrs['class'] = $class;
}
ui_print_help_tip(__('Type at least two characters to search the user.'), false);
html_print_input_text_extended(
$name,
$default,
@ -6381,7 +6393,7 @@ function html_print_autocomplete_users_from_integria(
'',
$attrs
);
html_print_input_hidden($name.'_hidden', $id_agent_module);
html_print_input_hidden($name.'_hidden', $default);
$javascript_ajax_page = ui_get_full_url('ajax.php', false, false, false, false);
?>
@ -6395,52 +6407,72 @@ function html_print_autocomplete_users_from_integria(
}
$(document).ready (function () {
$("#text-<?php echo $name; ?>").autocomplete({
minLength: 2,
source: function( request, response ) {
var term = request.term; //Word to search
data_params = {
page: "include/ajax/integria_incidents.ajax",
search_term: term,
get_users: 1,
};
jQuery.ajax ({
data: data_params,
async: false,
type: "POST",
url: action="<?php echo $javascript_ajax_page; ?>",
timeout: 10000,
dataType: "json",
success: function (data) {
temp = [];
$.each(data, function (id, module) {
temp.push({
'value' : id,
'label' : module});
});
response(temp);
}
});
},
change: function( event, ui ) {
if (!ui.item)
$("input[name='<?php echo $name; ?>_hidden']")
.val(0);
return false;
},
select: function( event, ui ) {
$("input[name='<?php echo $name; ?>_hidden']")
.val(ui.item.value);
$("#text-<?php echo $name; ?>").val( ui.item.label );
return false;
$("#text-<?php echo $name; ?>").autocomplete({
minLength: 2,
source: function( request, response ) {
var term = request.term; //Word to search
var data_params = {
page: "operation/ITSM/itsm",
search_term: term,
method: "getUserSelect",
};
jQuery.ajax ({
data: data_params,
async: false,
type: "POST",
url: action="<?php echo $javascript_ajax_page; ?>",
timeout: 10000,
dataType: "json",
success: function (data) {
temp = [];
$.each(data, function (id, module) {
temp.push({
'value' : id,
'label' : module});
});
response(temp);
}
});
},
change: function( event, ui ) {
if (!ui.item) {
$("input[name='<?php echo $name; ?>_hidden']")
.val(0);
}
);
return false;
},
select: function( event, ui ) {
$("input[name='<?php echo $name; ?>_hidden']")
.val(ui.item.value);
$("#text-<?php echo $name; ?>").val( ui.item.label );
return false;
}
});
if($("input[name='<?php echo $name; ?>_hidden']").val() !== ''){
var data_params_initial = {
page: "operation/ITSM/itsm",
search_term: $("input[name='<?php echo $name; ?>_hidden']").val(),
method: "getUserSelect",
};
jQuery.ajax ({
data: data_params_initial,
async: false,
type: "POST",
url: action="<?php echo $javascript_ajax_page; ?>",
timeout: 10000,
dataType: "json",
success: function (data) {
$("#text-<?php echo $name; ?>").val(Object.entries(data)[0][1])
}
});
}
});
</script>
<?php
$output = ob_get_clean();
@ -7384,11 +7416,15 @@ function html_print_select_date_range(
$('#".$name."_default').hide();
$('#".$name."_extend').hide();
$('#hidden-custom_date').val('1');
$('.filter_label_position_before').addClass('filter_label_position_after');
} else if ($(this).val() === 'custom') {
$('#".$name."_range').hide();
$('#".$name."_default').hide();
$('#".$name."_extend').show();
$('#hidden-custom_date').val('2');
$('.filter_label_position_before').removeClass('filter_label_position_after');
} else {
$('.filter_label_position_before').removeClass('filter_label_position_after');
}
});
@ -7397,14 +7433,29 @@ function html_print_select_date_range(
});
// To get position must to be showed, hide elements return 0 on offset function.
var def_state_range = $('#".$name."_range').is(':visible');
var def_state_default = $('#".$name."_default').is(':visible');
var def_state_extend = $('#".$name."_extend').is(':visible');
$('#".$name."_range').show();
$('#".$name."_default').hide();
$('#".$name."_extend').hide();
position_top_init = $('#text-date_init').offset().top + $('#text-date_init').outerHeight();
position_top_end = $('#text-date_end').offset().top + $('#text-date_end').outerHeight();
$('#".$name."_range').hide();
$('#".$name."_extend').hide();
$('#".$name."_default').show();
if(def_state_range){
$('#".$name."_range').show();
} else {
$('#".$name."_range').hide();
}
if(def_state_default){
$('#".$name."_default').show();
} else {
$('#".$name."_default').hide();
}
if(def_state_extend){
$('#".$name."_extend').show();
} else {
$('#".$name."_extend').hide();
}
});
var position_top_init = 0;

View File

@ -1,477 +0,0 @@
<?php
// Pandora FMS - https://pandorafms.com
// ==================================================
// Copyright (c) 2005-2023 Pandora FMS
// Please see https://pandorafms.com/community/ for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
/**
* @package Include
* @subpackage Incidents
*/
/**
* Gets all the possible priorities for incidents in an array
*
* @return array The several priorities with their values
*/
function incidents_get_priorities($priority=false)
{
$fields = [];
$fields[0] = __('Informative');
$fields[1] = __('Low');
$fields[2] = __('Medium');
$fields[3] = __('Serious');
$fields[4] = __('Very serious');
$fields[10] = __('Maintenance');
if ($priority === false) {
return $fields;
} else {
return $fields[$priority];
}
}
/**
* Prints the image tag for passed status
*
* @param integer $id_status Which status to return the image to
*
* @return string The string with the image tag
*/
function incidents_print_priority_img($id_priority, $return=false)
{
switch ($id_priority) {
case 0:
$img = html_print_image('images/dot_green.png', true, ['title' => __('Informative')]).html_print_image('images/dot_green.png', true, ['title' => __('Informative')]).html_print_image('images/dot_yellow.png', true, ['title' => __('Informative')]);
break;
case 1:
$img = html_print_image('images/dot_green.png', true, ['title' => __('Low')]).html_print_image('images/dot_yellow.png', true, ['title' => __('Low')]).html_print_image('images/dot_yellow.png', true, ['title' => __('Low')]);
break;
case 2:
$img = html_print_image('images/dot_yellow.png', true, ['title' => __('Medium')]).html_print_image('images/dot_yellow.png', true, ['title' => __('Medium')]).html_print_image('images/dot_red.png', true, ['title' => __('Medium')]);
break;
case 3:
$img = html_print_image('images/dot_yellow.png', true, ['title' => __('Serious')]).html_print_image('images/dot_red.png', true, ['title' => __('Serious')]).html_print_image('images/dot_red.png', true, ['title' => __('Serious')]);
break;
case 4:
$img = html_print_image('images/dot_red.png', true, ['title' => __('Very serious')]).html_print_image('images/dot_red.png', true, ['title' => __('Very serious')]).html_print_image('images/dot_red.png', true, ['title' => __('Very serious')]);
break;
case 10:
$img = html_print_image('images/dot_green.png', true, ['title' => __('Maintenance')]).html_print_image('images/dot_green.png', true, ['title' => __('Maintenance')]).html_print_image('images/dot_green.png', true, ['title' => __('Maintenance')]);
break;
}
if ($return === false) {
echo $img;
}
return $img;
}
/**
* Gets all the possible status for incidents in an array
*
* @return array The several status with their values
*/
function incidents_get_status()
{
$fields = [];
$fields[0] = __('Active incidents');
$fields[1] = __('Active incidents, with comments');
$fields[2] = __('Rejected incidents');
$fields[3] = __('Expired incidents');
$fields[13] = __('Closed incidents');
return $fields;
}
/**
* Prints the image tag for passed status
*
* @param integer $id_status: Which status to return the image to
*
* @return string The string with the image tag
*/
function incidents_print_status_img($id_status, $return=false)
{
switch ($id_status) {
case 0:
$img = html_print_image('images/dot_red.png', true, ['title' => __('Active incidents')]);
break;
case 1:
$img = html_print_image('images/dot_yellow.png', true, ['title' => __('Active incidents, with comments')]);
break;
case 2:
$img = html_print_image('images/dot_blue.png', true, ['title' => __('Rejected incidents')]);
break;
case 3:
$img = html_print_image('images/dot_green.png', true, ['title' => __('Expired incidents')]);
break;
case 13:
$img = html_print_image('images/dot_white.png', true, ['title' => __('Closed incidents')]);
break;
}
if ($return === false) {
echo $img;
}
return $img;
}
/**
* Updates the last user (either by adding an attachment, note or the incident itself)
* Named after the UNIX touch utility
*
* @param integer $id_incident: A single incident or an array of incidents
*
* @return boolean True if it was done, false if it wasn't
*/
function incidents_process_touch($id_incident)
{
global $config;
$id_incident = (array) safe_int($id_incident, 1);
// Make sure we have all positive int's
if (empty($id_incident)) {
return false;
}
if (empty($id_incident)) {
return false;
}
return db_process_sql_update('tincidencia', ['id_lastupdate' => $config['id_user']], ['id_incidencia' => $id_incident]);
}
/**
* Updates the owner (named after the UNIX utility chown)
*
* @param integer $id_incident: A single incident or an array of incidents
*
* @return boolean True if it was done, false if it wasn't
*/
function incidents_process_chown($id_incident, $owner=false)
{
if ($owner === false) {
global $config;
$owner = $config['id_user'];
}
$id_incident = (array) safe_int($id_incident, 1);
// Make sure we have all positive int's
if (empty($id_incident)) {
return false;
}
$id_incident = implode(',', $id_incident);
$sql = sprintf("UPDATE tincidencia SET id_usuario = '%s' WHERE id_incidencia IN (%s)", $owner, $id_incident);
return db_process_sql($sql);
}
/**
* Get the author of an incident.
*
* @param integer $id_incident Incident id.
*
* @return string The author of an incident
*/
function incidents_get_author($id_incident)
{
if ($id_incident < 1) {
return '';
}
return (string) db_get_value('id_creator', 'tincidencia', 'id_incidencia', (int) $id_incident);
}
/**
* Get the owner of an incident.
*
* @param integer $id_incident Incident id.
*
* @return string The last updater of an incident
*/
function incidents_get_owner($id_incident)
{
if ($id_incident < 1) {
return '';
}
return (string) db_get_value('id_usuario', 'tincidencia', 'id_incidencia', (int) $id_incident);
}
/**
* Get the last updater of an incident.
*
* @param integer $id_incident Incident id.
*
* @return string The last updater of an incident
*/
function incidents_get_lastupdate($id_incident)
{
if ($id_incident < 1) {
return '';
}
return (string) db_get_value('id_lastupdate', 'tincidencia', 'id_incidencia', (int) $id_incident);
}
/**
* Get the group id of an incident.
*
* @param integer $id_incident Incident id.
*
* @return integer The group id of an incident
*/
function incidents_get_group($id_incident)
{
if ($id_incident < 1) {
return 0;
}
return (int) db_get_value('id_grupo', 'tincidencia', 'id_incidencia', (int) $id_incident);
}
/**
* Delete an incident out the database.
*
* @param mixed $id_inc An int or an array of ints to be deleted
*
* @return boolean True if incident was succesfully deleted, false if not
*/
function incidents_delete_incident($id_incident)
{
global $config;
$ids = (array) safe_int($id_incident, 1);
// Make the input an array
$notes = [];
$attachments = [];
$errors = 0;
foreach ($ids as $id_inc) {
// Delete incident
$ret = db_process_sql_delete('tincidencia', ['id_incidencia' => $id_inc]);
if ($ret === false) {
$errors++;
}
// We only need the ID's
$notes = array_merge($notes, array_keys(incidents_get_notes($id_inc)));
$attachments = array_merge($attachments, array_keys(incidents_get_attach($id_inc)));
db_pandora_audit(
AUDIT_LOG_INCIDENT_MANAGEMENT,
$config['id_user'].' deleted incident #'.$id_inc
);
}
// Delete notes
$note_err = incidents_delete_note($notes, false);
$attach_err = incidents_delete_attach($attachments, false);
if ($note_err === false || $attach_err === false) {
$errors++;
}
if ($errors > 0) {
return false;
}
return true;
}
/**
* Delete notes out the database.
*
* @param mixed $id_note An int or an array of ints to be deleted
* @param boolean $transact true if a transaction should be started, false if not
*
* @return boolean True if note was succesfully deleted, false if not
*/
function incidents_delete_note($id_note, $transact=true)
{
$id_note = (array) safe_int($id_note, 1);
// cast as array
$errors = 0;
// Delete notes
foreach ($id_note as $id) {
$ret = db_process_sql_delete('tnota', ['id_nota' => $id]);
if ($ret === false) {
$errors++;
}
}
if ($errors > 0) {
return false;
} else {
return true;
}
}
/**
* Delete attachments out the database and from the machine.
*
* @param mixed $id_attach An int or an array of ints to be deleted
* @param boolean $transact true if a transaction should be started, false if not
*
* @return boolean True if attachment was succesfully deleted, false if not
*/
function incidents_delete_attach($id_attach, $transact=true)
{
global $config;
$id_attach = (array) safe_int($id_attach, 1);
// cast as array
$errors = 0;
// Delete attachment
foreach ($id_attach as $id) {
$filename = db_get_value('filename', 'tattachment', 'id_attachment', $id);
$ret = db_process_sql_delete('tattachment', ['id_attachment' => $id]);
if ($ret === false) {
$errors++;
}
unlink($config['attachment_store'].'/pand'.$id.'_'.$filename);
}
if ($errors > 0) {
return false;
} else {
return true;
}
}
/**
* Get notes based on the incident id.
*
* @param integer $id_incident An int with the incident id
*
* @return array An array of all the notes for that incident
*/
function incidents_get_notes($id_incident)
{
$return = db_get_all_rows_field_filter('tnota', 'id_incident', (int) $id_incident);
if ($return === false) {
$return = [];
}
$notes = [];
foreach ($return as $row) {
$notes[$row['id_nota']] = $row;
}
return $notes;
}
/**
* Get attachments based on the incident id.
*
* @param integer $id_incident An int with the incident id
*
* @return array An array of all the notes for that incident
*/
function incidents_get_attach($id_incident)
{
$return = db_get_all_rows_field_filter('tattachment', 'id_incidencia', (int) $id_incident);
if ($return === false) {
$return = [];
}
$attach = [];
foreach ($return as $row) {
$attach[$row['id_attachment']] = $row;
}
return $attach;
}
/**
* Get user id of a note.
*
* @param integer $id_note Note id.
*
* @return string User id of the given note.
*/
function incidents_get_notes_author($id_note)
{
return (string) db_get_value('id_usuario', 'tnota', 'id_nota', (int) $id_note);
}
/**
* Interface to Integria API functionality.
*
* @param string $url Url to Integria API with user, password and option (function to use).
* @param string $postparameters Additional parameters to pass.
*
* @return variant The function result called in the API.
*/
function incidents_call_api($url, $postparameters=false)
{
$curlObj = curl_init();
curl_setopt($curlObj, CURLOPT_URL, $url);
curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1);
if ($postparameters !== false) {
curl_setopt($curlObj, CURLOPT_POSTFIELDS, $postparameters);
}
$result = curl_exec($curlObj);
curl_close($curlObj);
return $result;
}
/**
* Converts Xml format file to an array datatype.
*
* @param string $xml Xml file to convert.
*
* @return array A Json encoded array with xml content.
*/
function incidents_xml_to_array($xml)
{
$xmlObj = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA);
return json_decode(json_encode($xmlObj), true);
}

View File

@ -1,564 +0,0 @@
<?php
// Pandora FMS - https://pandorafms.com
// ==================================================
// Copyright (c) 2005-2023 Pandora FMS
// Please see https://pandorafms.com/community/ for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
/**
* @package Include
* @subpackage Incidents
*/
global $config;
require_once $config['homedir'].'/include/functions_ui.php';
require_once $config['homedir'].'/include/functions_html.php';
require_once $config['homedir'].'/include/functions_users.php';
require_once $config['homedir'].'/include/functions.php';
/**
* Show header tabs.
*
* @param string $active_tab Current tab or false for View page.
* @param number $view Id of incident. Show View tab.
*
* @return array HTML code. Print tabs in header.
*/
function integriaims_tabs($active_tab, $view=false)
{
global $config;
$url_tabs = ui_get_full_url('index.php?sec=incident&sec2=operation/incidents/');
$setup_tab['text'] = '<a href="'.ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup&section=integria').'">'.html_print_image('images/configuration@svg.svg', true, ['title' => __('Configure Integria IMS'), 'class' => 'main_menu_icon invert_filter']).'</a>';
$list_tab['text'] = '<a href="'.$url_tabs.'list_integriaims_incidents">'.html_print_image('images/logs@svg.svg', true, ['title' => __('Ticket list'), 'class' => 'main_menu_icon invert_filter']).'</a>';
$create_tab['text'] = '<a href="'.$url_tabs.'configure_integriaims_incident">'.html_print_image('images/edit.svg', true, ['title' => __('New ticket'), 'class' => 'main_menu_icon invert_filter']).'</a>';
switch ($active_tab) {
case 'setup_tab':
$setup_tab['active'] = true;
$list_tab['active'] = false;
$create_tab['active'] = false;
break;
case 'list_tab':
$setup_tab['active'] = false;
$list_tab['active'] = true;
$create_tab['active'] = false;
break;
case 'create_tab':
$setup_tab['active'] = false;
$list_tab['active'] = false;
$create_tab['active'] = true;
break;
default:
$setup_tab['active'] = false;
$list_tab['active'] = false;
$create_tab['active'] = false;
break;
}
if ($view) {
$create_tab['text'] = '<a href="'.$url_tabs.'configure_integriaims_incident&incident_id='.$view.'">'.html_print_image('images/edit.svg', true, ['title' => __('Edit ticket'), 'class' => 'main_menu_icon invert_filter']).'</a>';
$view_tab['text'] = '<a href="'.$url_tabs.'dashboard_detail_integriaims_incident&incident_id='.$view.'">'.html_print_image('images/details.svg', true, ['title' => __('View ticket'), 'class' => 'main_menu_icon invert_filter']).'</a>';
// When the current page is the View page.
if (!$active_tab) {
$view_tab['active'] = true;
}
}
$onheader = [];
$onheader['view'] = $view_tab;
$onheader['configure'] = $setup_tab;
$onheader['list'] = $list_tab;
$onheader['create'] = $create_tab;
return $onheader;
}
/**
* Gets all the details of Integria IMS API
*
* @param string $details Type of API call.
* @param number $detail_index Send index if you want return the text.
*
* @return string or array with result of API call.
*/
function integriaims_get_details($details, $detail_index=false)
{
global $config;
switch ($details) {
case 'status':
$operation = 'get_incidents_status';
break;
case 'group':
$operation = 'get_groups';
break;
case 'priority':
$operation = 'get_incident_priorities';
break;
case 'resolution':
$operation = 'get_incidents_resolutions';
break;
case 'type':
$operation = 'get_types';
break;
default:
// code...
break;
}
$api_call = integria_api_call(null, null, null, null, $operation);
$result = [];
get_array_from_csv_data_pair($api_call, $result);
if ($detail_index !== false) {
if ($result[$detail_index] == '' || $result[$detail_index] === null) {
return __('None');
} else {
return $result[$detail_index];
}
} else {
return $result;
}
}
/**
* Perform an API call to Integria IMS.
*
* @param string|null $api_hostname API host URL.
* @param string|null $user User name.
* @param string|null $user_pass User password.
* @param string|null $api_pass API password.
* @param string|null $operation API Operation.
* @param mixed $params String or array with parameters required by the API function.
* @param mixed $show_credentials_error_msg Show_credentials_error_msg.
* @param mixed $return_type Return_type.
* @param mixed $token Token.
* @param mixed $user_level_conf User_level_conf.
*
* @return boolean True if API request succeeded, false if API request failed.
*/
function integria_api_call(
$api_hostname=null,
$user=null,
$user_pass=null,
$api_pass=null,
$operation=null,
$params='',
$show_credentials_error_msg=false,
$return_type='',
$token='',
$user_level_conf=null
) {
global $config;
if (is_metaconsole()) {
$servers = metaconsole_get_connection_names();
foreach ($servers as $key => $server) {
$connection = metaconsole_get_connection($server);
if (metaconsole_connect($connection) != NOERR) {
continue;
}
$integria_enabled = db_get_sql(
'SELECT `value` FROM tconfig WHERE `token` = "integria_enabled"'
);
if (!$integria_enabled) {
metaconsole_restore_db();
continue;
}
// integria_user_level_conf, integria_hostname, integria_api_pass, integria_user, integria_user_level_user, integria_pass, integria_user_level_pass
$config_aux = db_get_all_rows_sql('SELECT `token`, `value` FROM `tconfig` WHERE `token` IN ("integria_user_level_conf", "integria_hostname", "integria_api_pass", "integria_user", "integria_user_level_user", "integria_pass", "integria_user_level_pass")');
$user_info = users_get_user_by_id($config['id_user']);
foreach ($config_aux as $key => $conf) {
if ($conf['token'] === 'integria_user_level_conf') {
$user_level_conf = $conf['value'];
}
if ($conf['token'] === 'integria_hostname') {
$api_hostname = $conf['value'];
}
if ($conf['token'] === 'integria_api_pass') {
$api_pass = $conf['value'];
}
if ($conf['token'] === 'integria_user') {
$user = $conf['value'];
}
if ($conf['token'] === 'integria_pass') {
$user_pass = $conf['value'];
}
}
if ($user_level_conf == true) {
$user = $user_info['integria_user_level_user'];
$user_pass = $user_info['integria_user_level_pass'];
}
metaconsole_restore_db();
}
} else {
if ($user_level_conf === null) {
$user_level_conf = (bool) $config['integria_user_level_conf'];
}
$user_info = users_get_user_by_id($config['id_user']);
// API access data.
if ($api_hostname === null) {
$api_hostname = $config['integria_hostname'];
}
if ($api_pass === null) {
$api_pass = $config['integria_api_pass'];
}
// Integria user and password.
if ($user === null || $user_level_conf === true) {
$user = $config['integria_user'];
if ($user_level_conf === true) {
$user = $user_info['integria_user_level_user'];
}
}
if ($user_pass === null || $user_level_conf === true) {
$user_pass = $config['integria_pass'];
if ($user_level_conf === true) {
$user_pass = $user_info['integria_user_level_pass'];
}
}
}
if (is_array($params)) {
$params = implode($token, $params);
}
$url_data = [
'user' => $user,
'user_pass' => $user_pass,
'pass' => $api_pass,
'op' => $operation,
'params' => io_safe_output($params),
];
if ($return_type !== '') {
$url_data['return_type'] = $return_type;
}
if ($token !== '') {
$url_data['token'] = $token;
}
// Build URL for API request.
$url = $api_hostname.'/include/api.php';
// ob_start();
// $out = fopen('php://output', 'w');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $url_data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_STDERR, $out);
$result = curl_exec($ch);
// fclose($out);
// $debug = ob_get_clean();
$http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$error = false;
if ($result === false) {
$error = curl_error($ch);
}
curl_close($ch);
if ($error === true || $http_status !== 200) {
if ($show_credentials_error_msg === true) {
ui_print_error_message(__('API request failed. Please check Integria IMS\' access credentials in Pandora setup.'));
}
return false;
} else {
return $result;
}
}
// Parse CSV consisting of one or more lines of the form key-value pair into an array.
function get_array_from_csv_data_pair($csv_data, &$array_values)
{
$csv_array = explode("\n", $csv_data);
foreach ($csv_array as $csv_value) {
if (empty($csv_value)) {
continue;
}
$new_csv_value = str_getcsv($csv_value);
$array_values[$new_csv_value[0]] = $new_csv_value[1];
}
}
/**
* Parse CSV consisting of all lines into an array.
*
* @param string $csv_data Data returned of csv api call.
* @param string $array_values Returned array.
* @param array $index Array to create an associative index (opcional).
*/
function get_array_from_csv_data_all($csv_data, &$array_values, $index=false)
{
$csv_array = explode("\n", $csv_data);
foreach ($csv_array as $csv_value) {
if (empty($csv_value)) {
continue;
}
$new_csv_value = str_getcsv($csv_value);
if ($index !== false) {
foreach ($new_csv_value as $key => $value) {
$new_csv_value_index[$index[$key]] = str_replace(':::', ',', $value);
;
}
$array_values[$new_csv_value[0]] = $new_csv_value_index;
} else {
$new_csv_value_comma = array_map(
function ($item) {
return str_replace(':::', ',', $item);
},
$new_csv_value
);
$array_values[$new_csv_value[0]] = $new_csv_value_comma;
}
}
}
/**
* Print priority for Integria IMS with colors.
*
* @param string $priority value of priority in Integria IMS.
* @param string $priority_label text shown in color box.
*
* @return string HTML code. code to print the color box.
*/
function ui_print_integria_incident_priority($priority, $priority_label)
{
global $config;
$output = '';
switch ($priority) {
case 0:
$color = COL_UNKNOWN;
break;
case 1:
$color = COL_NORMAL;
break;
case 10:
$color = COL_NOTINIT;
break;
case 2:
$color = COL_WARNING;
break;
case 3:
$color = COL_ALERTFIRED;
break;
case 4:
$color = COL_CRITICAL;
break;
}
$output = '<div class="priority" style="background: '.$color.'">';
$output .= $priority_label;
$output .= '</div>';
return $output;
}
/**
* Get tickets from Integria IMS.
*
* @param array $tickets_filters Filters to send to API.
*
* @return array Tickets returned by API call.
*/
function get_tickets_integriaims($tickets_filters)
{
global $config;
// Filters.
$incident_text = $tickets_filters['incident_text'];
$incident_status = $tickets_filters['incident_status'];
$incident_group = $tickets_filters['incident_group'];
$incident_owner = $tickets_filters['incident_owner'];
$incident_creator = $tickets_filters['incident_creator'];
$incident_priority = $tickets_filters['incident_priority'];
$incident_resolution = $tickets_filters['incident_resolution'];
$created_from = $tickets_filters['created_from'];
$created_to = $tickets_filters['created_to'];
// API call.
$result_api_call_list = integria_api_call(
null,
null,
null,
null,
'get_incidents',
[
$incident_text,
$incident_status,
$incident_group,
$incident_priority,
'0',
$incident_owner,
$incident_creator,
],
false,
'',
','
);
// Return array of api call 'get_incidents'.
$array_get_incidents = [];
get_array_from_csv_data_all($result_api_call_list, $array_get_incidents);
// Modify $array_get_incidents if filter for resolution exists.
$filter_resolution = [];
foreach ($array_get_incidents as $key => $value) {
if ($incident_resolution !== '' && ($array_get_incidents[$key][12] == $incident_resolution)) {
$filter_resolution[$key] = $array_get_incidents[$key];
continue;
}
}
if ($incident_resolution !== '') {
$array_get_incidents = $filter_resolution;
}
// Modify $array_get_incidents if filter for date is selected.
if ($created_from !== '' && $created_to !== '') {
$date = [];
$date_utimestamp = [];
foreach ($array_get_incidents as $key => $value) {
// Change format date / to -.
$date[$key] = date('Y-m-d', strtotime($array_get_incidents[$key][9]));
// Covert date to utimestamp.
$date_utimestamp[$key] = strtotime($date[$key]);
}
// Change format date / to -.
$created_from_date = date('Y-m-d', strtotime($created_from));
$created_to_date = date('Y-m-d', strtotime($created_to));
// Covert date to utimestamp.
$created_from_timestamp = strtotime($created_from_date);
$created_to_timestamp = strtotime($created_to_date);
// Dates within the selected period.
$selected_period = array_filter(
$date_utimestamp,
function ($value) use ($created_from_timestamp, $created_to_timestamp) {
return ($value >= $created_from_timestamp && $value <= $created_to_timestamp);
}
);
// Return incidents with the correct dates.
$filter_date = [];
foreach ($array_get_incidents as $key => $value) {
foreach ($selected_period as $index => $value) {
if ($array_get_incidents[$key][0] == $index) {
$filter_date[$key] = $array_get_incidents[$key];
continue;
}
}
}
$array_get_incidents = $filter_date;
}
return $array_get_incidents;
}
function integriaims_upload_file($filename, $incident_id, $file_description)
{
if ($_FILES[$filename]['name'] != '') {
$filename = io_safe_input($_FILES[$filename]['name']);
$filesize = io_safe_input($_FILES[$filename]['size']);
$extension = pathinfo($filename, PATHINFO_EXTENSION);
$invalid_extensions = '/^(bat|exe|cmd|sh|php|php1|php2|php3|php4|php5|pl|cgi|386|dll|com|torrent|js|app|jar|iso|
pif|vb|vbscript|wsf|asp|cer|csr|jsp|drv|sys|ade|adp|bas|chm|cpl|crt|csh|fxp|hlp|hta|inf|ins|isp|jse|htaccess|
htpasswd|ksh|lnk|mdb|mde|mdt|mdw|msc|msi|msp|mst|ops|pcd|prg|reg|scr|sct|shb|shs|url|vbe|vbs|wsc|wsf|wsh)$/i';
if (!preg_match($invalid_extensions, $extension)) {
// The following is if you have clamavlib installed.
// (php5-clamavlib) and enabled in php.ini
// http://www.howtoforge.com/scan_viruses_with_php_clamavlib
if (extension_loaded('clamav')) {
cl_setlimits(5, 1000, 200, 0, 10485760);
$malware = cl_scanfile($_FILES['file']['tmp_name']);
if ($malware) {
$error = 'Malware detected: '.$malware.'<br>ClamAV version: '.clam_get_version();
die($error);
}
}
$filecontent = base64_encode(file_get_contents($_FILES[$filename]['tmp_name']));
$result_api_call = integria_api_call(null, null, null, null, 'attach_file', [$incident_id, $filename, $filesize, $file_description, $filecontent], false, '', '|;|');
// API method returns '0' string if success.
$file_added = ($result_api_call === '0') ? true : false;
ui_print_result_message(
$file_added,
__('File successfully added'),
__('File could not be added')
);
} else {
ui_print_error_message(__('File has an invalid extension'));
}
}
}

View File

@ -147,6 +147,12 @@ function menu_print_menu(&$menu)
|| $sec2 === 'enterprise/godmode/servers/manage_credential_boxes'
) {
$sec2 = 'enterprise/godmode/servers/list_satellite';
} else if ($sec2 === 'operation/ITSM/itsm') {
$sec2 = (string) get_parameter('sec2');
$operation = (string) get_parameter('operation', '');
if (empty($operation) === false) {
$sec2 = $sec2.'&operation='.$operation;
}
} else {
$sec2 = (string) get_parameter('sec2');
}
@ -287,7 +293,7 @@ function menu_print_menu(&$menu)
}
}
// Set class.
// Set class.;
if (($sec2 == $subsec2 || $allsec2 == $subsec2
|| $selected_submenu2) && isset($sub[$subsec2]['options'])
&& (get_parameter_get($sub[$subsec2]['options']['name']) == $sub[$subsec2]['options']['value'])

View File

@ -940,6 +940,57 @@ function reporting_make_reporting_data(
);
break;
case 'top_n_agents_sh':
$report['contents'][] = reporting_top_n_agents_sh(
$report,
$content
);
break;
case 'top_n_checks_failed':
$report['contents'][] = reporting_top_n_checks_failed(
$report,
$content
);
break;
case 'top_n_categories_checks':
$report['contents'][] = reporting_top_n_categories_checks(
$report,
$content
);
break;
case 'vul_by_cat':
$report['contents'][] = reporting_vul_by_categories(
$report,
$content,
$type
);
break;
case 'list_checks':
$report['contents'][] = reporting_list_checks(
$report,
$content
);
break;
case 'scoring':
$report['contents'][] = reporting_scoring(
$report,
$content
);
break;
case 'evolution':
$report['contents'][] = reporting_evolution_hardening(
$report,
$content,
$type
);
break;
default:
// Default.
break;

View File

@ -475,6 +475,34 @@ function reporting_html_print_report($report, $mini=false, $report_info=1, $cust
case 'ncm':
reporting_html_ncm_config($table, $item);
break;
case 'top_n_agents_sh':
reporting_html_top_n_agents_sh($table, $item);
break;
case 'top_n_checks_failed':
reporting_html_top_n_checks_failed($table, $item);
break;
case 'top_n_categories_checks':
reporting_html_top_n_categories_checks($table, $item);
break;
case 'vul_by_cat':
reporting_vul_by_cat_graph($table, $item);
break;
case 'list_checks':
reporting_html_list_checks($table, $item);
break;
case 'scoring':
reporting_html_scoring($table, $item);
break;
case 'evolution':
reporting_evolution_graph($table, $item);
break;
}
if ($item['type'] == 'agent_module') {
@ -490,6 +518,280 @@ function reporting_html_print_report($report, $mini=false, $report_info=1, $cust
}
/**
* Function to print the security hardening evolution.
*
* @param object $table Head table or false if it comes from pdf.
* @param array $item Items data.
*
* @return void
*/
function reporting_evolution_graph($table, $item)
{
$table->rowclass[0] = '';
$table->colspan['chart']['cell'] = 3;
$table->cellstyle['chart']['cell'] = 'text-align: center;';
$table->data['chart']['cell'] = $item['chart'];
}
/**
* Function to print the agents scoring.
*
* @param object $table Head table or false if it comes from pdf.
* @param array $item Items data.
* @param boolean $pdf If it comes from pdf.
*
* @return string
*/
function reporting_html_scoring($table, $item, $pdf=0)
{
global $config;
$table->width = '99%';
$table->styleTable = 'border: 0px;';
$table->colspan[2][0] = 3;
$table1 = new stdClass();
$table1->headstyle[0] = 'text-align: left';
$table1->headstyle[1] = 'text-align: left';
$table1->headstyle[2] = 'text-align: left';
$table1->width = '99%';
$table1->class = 'info_table';
$table1->titleclass = 'title_table_pdf';
$table1->rowclass[0] = '';
$table1->head[0] = '<b>'.__('Date').'</b>';
$table1->head[1] = '<b>'.__('Agent').'</b>';
$table1->head[2] = '<b>'.__('Score').'</b>';
$row = 1;
foreach ($item['data'] as $key => $check) {
$table1->data[$row][1] = date($config['date_format'], $check['date']);
$table1->data[$row][2] = $check['agent'];
$table1->data[$row][3] = $check['scoring'].' %';
$row++;
}
if ($pdf === 1) {
$table1->title = $item['title'];
$table1->titleclass = 'title_table_pdf';
$table1->titlestyle = 'text-align:left;';
}
$table->data[2][0] = html_print_table($table1, true);
if ($pdf === 1) {
return html_print_table($table1, true);
}
}
/**
* Function to print HTML checks filtered by agent and category.
*
* @param object $table Head table or false if it comes from pdf.
* @param array $item Items data.
* @param boolean $pdf If it comes from pdf.
*
* @return string
*/
function reporting_html_list_checks($table, $item, $pdf=0)
{
$table->width = '99%';
$table->styleTable = 'border: 0px;';
$table->colspan[2][0] = 4;
$table1 = new stdClass();
$table1->width = '99%';
$table1->headstyle[0] = 'text-align: left';
$table1->headstyle[1] = 'text-align: left';
$table1->headstyle[2] = 'text-align: left';
$table1->class = 'info_table';
$table1->titleclass = 'title_table_pdf';
$table1->rowclass[0] = '';
$table1->head[0] = '<b>'.__('Id').'</b>';
$table1->head[1] = '<b>'.__('Title').'</b>';
$table1->head[2] = '<b>'.__('Category').'</b>';
$table1->head[3] = '<b>'.__('Status').'</b>';
$row = 2;
foreach ($item['data'] as $key => $check) {
$table1->data[$row][0] = $check['id'];
$table1->data[$row][1] = $check['title'];
$table1->data[$row][2] = $check['category'];
$table1->data[$row][3] = $check['status'];
$row++;
}
if ($pdf === 1) {
$table1->title = $item['title'];
$table1->titleclass = 'title_table_pdf';
$table1->titlestyle = 'text-align:left;';
}
$table->data[2][0] = html_print_table($table1, true);
if ($pdf === 1) {
return html_print_table($table1, true);
}
}
/**
* Function to print HTML top checks failed by category
*
* @param object $table Head table or false if it comes from pdf.
* @param array $item Items data.
* @param boolean $pdf If it comes from pdf.
*
* @return string
*/
function reporting_html_top_n_categories_checks($table, $item, $pdf=0)
{
$table->width = '99%';
$table->styleTable = 'border: 0px;';
$table->colspan[2][0] = 3;
$table1 = new stdClass();
$table1->width = '99%';
$table1->headstyle[0] = 'text-align: left';
$table1->headstyle[1] = 'text-align: left';
$table1->headstyle[2] = 'text-align: left';
$table1->class = 'info_table';
$table1->titleclass = 'title_table_pdf';
$table1->rowclass[0] = '';
$table1->head[0] = '<b>'.__('Id').'</b>';
$table1->head[1] = '<b>'.__('Category').'</b>';
$table1->head[2] = '<b>'.__('Total Failed').'</b>';
$row = 2;
foreach ($item['data'] as $key => $check) {
$table1->data[$row][0] = $check['id'];
$table1->data[$row][1] = $check['category'];
$table1->data[$row][2] = $check['total'];
$row++;
}
if ($pdf === 1) {
$table1->title = $item['title'];
$table1->titleclass = 'title_table_pdf';
$table1->titlestyle = 'text-align:left;';
}
$table->data[2][0] = html_print_table($table1, true);
if ($pdf === 1) {
return html_print_table($table1, true);
}
}
/**
* Function to print HTML top checks failed.
*
* @param object $table Head table or false if it comes from pdf.
* @param array $item Items data.
* @param boolean $pdf If it comes from pdf.
*
* @return string
*/
function reporting_html_top_n_checks_failed($table, $item, $pdf=0)
{
$table->width = '99%';
$table->styleTable = 'border: 0px;';
$table->colspan[2][0] = 3;
$table1 = new stdClass();
$table1->width = '99%';
$table1->headstyle[0] = 'text-align: left';
$table1->headstyle[2] = 'text-align: left';
$table1->class = 'info_table';
$table1->titleclass = 'title_table_pdf';
$table1->headstyle[1] = 'width: 10%; text-align: center;';
$table1->style[2] = 'text-align: center;';
$table1->rowclass[0] = '';
$table1->head[0] = '<b>'.__('Title').'</b>';
$table1->head[1] = '<b>'.__('Total Failed').'</b>';
$table1->head[2] = '<b>'.__('Description').'</b>';
$row = 2;
foreach ($item['data'] as $key => $check) {
$table1->data[$row][1] = $check['title'];
$table1->data[$row][2] = $check['total'];
$table1->data[$row][3] = $check['description'];
$row++;
}
if ($pdf === 1) {
$table1->title = $item['title'];
$table1->titleclass = 'title_table_pdf';
$table1->titlestyle = 'text-align:left;';
}
$table->data[2][0] = html_print_table($table1, true);
if ($pdf === 1) {
return html_print_table($table1, true);
}
}
/**
* Function to print HTML top categories in graph.
*
* @param object $table Head table or false if it comes from pdf.
* @param array $item Items data.
*
* @return void
*/
function reporting_vul_by_cat_graph($table, $item)
{
$table->rowclass[0] = '';
$table->colspan['chart']['cell'] = 3;
$table->cellstyle['chart']['cell'] = 'text-align: center;';
$table->data['chart']['cell'] = $item['chart'];
}
/**
* Function to print HTML top n agents from security hardening.
*
* @param object $table Head table or false if it comes from pdf.
* @param array $item Items data.
* @param boolean $pdf If it comes from pdf.
*
* @return string
*/
function reporting_html_top_n_agents_sh($table, $item, $pdf=0)
{
global $config;
$table->width = '99%';
$table->styleTable = 'border: 0px;';
$table->colspan[2][0] = 3;
$table1 = new stdClass();
$table1->headstyle = [];
$table1->width = '99%';
$table1->class = 'info_table';
$table1->titleclass = 'title_table_pdf';
$table1->rowclass[0] = '';
$table1->head[0] = '<b>'.__('Agent').'</b>';
$table1->head[1] = '<b>'.__('Last audit scan').'</b>';
$table1->head[2] = '<b>'.__('Score').'</b>';
$row = 2;
foreach ($item['data'] as $key => $agent) {
$table1->data[$row][0] = $agent['alias'];
$table1->data[$row][1] = date($config['date_format'], $agent['utimestamp']);
$table1->data[$row][2] = $agent['datos'].' %';
$row++;
}
if ($pdf === 1) {
$table1->title = $item['title'];
$table1->titleclass = 'title_table_pdf';
$table1->titlestyle = 'text-align:left;';
}
$table->data[2][0] = html_print_table($table1, true);
if ($pdf === 1) {
return html_print_table($table, true);
}
}
/**
* Function to print to HTML SLA report.
*

View File

@ -963,6 +963,43 @@ function reports_get_report_types($template=false, $not_editor=false)
'name' => __('Network configuration changes'),
];
if (enterprise_installed() === true) {
$types['top_n_agents_sh'] = [
'optgroup' => __('Security hardening'),
'name' => __('Top-N agents with the worst score'),
];
$types['top_n_checks_failed'] = [
'optgroup' => __('Security hardening'),
'name' => __('Top-N most frequent failed checks'),
];
$types['top_n_categories_checks'] = [
'optgroup' => __('Security hardening'),
'name' => __('Top-N checks failed by category'),
];
$types['vul_by_cat'] = [
'optgroup' => __('Security hardening'),
'name' => __('Vulnerabilities by category'),
];
$types['list_checks'] = [
'optgroup' => __('Security hardening'),
'name' => __('List of checks'),
];
$types['scoring'] = [
'optgroup' => __('Security hardening'),
'name' => __('Scoring by date'),
];
$types['evolution'] = [
'optgroup' => __('Security hardening'),
'name' => __('Evolution'),
];
}
return $types;
}

View File

@ -708,6 +708,13 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
$row['data'] = human_time_description_raw($agent['intervalo']);
$table->data['interval'] = $row;
if (isset($agent['quiet']) && $agent['quiet']) {
$row = [];
$row['title'] = __('Quiet mode enabled');
$row['data'] = ui_print_help_tip(__('This agent would not raise events or alerts'), true);
$table->data['quiet'] = $row;
}
// Comments.
$row = [];
$row['title'] = __('Description');

View File

@ -609,12 +609,20 @@ function ui_print_timestamp($unixtime, $return=false, $option=[])
$tag = 'span';
}
if (empty($option['style']) === true) {
$style = 'class="'.($option['class'] ?? 'nowrap').'"';
if (empty($option['class']) === false) {
$class = 'class="nowrap '.$option['class'].'"';
} else {
$style = 'style="'.$option['style'].'"';
$class = 'class="nowrap"';
}
if (empty($option['style']) === false) {
$style = 'style="'.$option['style'].'"';
} else {
$style = 'style=""';
}
$style .= ' '.$class;
if (empty($option['prominent']) === false) {
$prominent = $option['prominent'];
} else {
@ -4003,6 +4011,10 @@ function ui_print_datatable(array $parameters)
$parameters['csv'] = 1;
}
if (isset($parameters['no_move_elements_to_action']) === false) {
$parameters['no_move_elements_to_action'] = false;
}
$filter = '';
// Datatable filter.
if (isset($parameters['form']) && is_array($parameters['form'])) {
@ -4159,13 +4171,13 @@ function ui_print_datatable(array $parameters)
foreach ($names as $column) {
if (is_array($column)) {
$table .= '<th id="'.$column['id'].'" class="'.$column['class'].'" ';
$table .= '<th id="'.($column['id'] ?? '').'" class="'.($column['class'] ?? '').'" ';
if (isset($column['title']) === true) {
$table .= 'title="'.__($column['title']).'" ';
}
$table .= ' style="'.$column['style'].'">'.__($column['text']);
$table .= $column['extra'];
$table .= ' style="'.($column['style'] ?? '').'">'.__($column['text']);
$table .= ($column['extra'] ?? '');
$table .= '</th>';
} else {
$table .= '<th>'.__($column).'</th>';
@ -4225,8 +4237,7 @@ function ui_print_datatable(array $parameters)
$spinner = '<div id="'.$table_id.'-spinner" class="invisible spinner-fixed"><span></span><span></span><span></span><span></span></div>';
// TODO This widget should take a return: ui_print_info_message($info_msg_arr, '', true)
$info_msg = '<div>'.ui_print_info_message($info_msg_arr).'</div>';
$info_msg = '<div>'.ui_print_info_message($info_msg_arr, '', true).'</div>';
$info_msg_filter = '<div>'.ui_print_info_message($info_msg_arr_filter, true).'</div>';
@ -7973,6 +7984,54 @@ function ui_print_status_div($status)
}
function ui_print_div(?string $class='', ?string $title='')
{
$return = '<div class="'.$class.'" title="'.$title.'" data-title="'.$title.'" data-use_title_for_force_title="1">';
$return .= '&nbsp';
$return .= '</div>';
return $return;
}
function ui_print_status_agent_div(int $status, ?string $title=null)
{
$return = '';
$class = 'status_rounded_rectangles forced_title';
switch ((int) $status) {
case AGENT_STATUS_CRITICAL:
$return = ui_print_div('group_view_crit '.$class, $title);
break;
case AGENT_STATUS_NORMAL:
$return = ui_print_div('group_view_ok '.$class, $title);
break;
case AGENT_STATUS_NOT_INIT:
$return = ui_print_div('group_view_not_init '.$class, $title);
break;
case AGENT_STATUS_UNKNOWN:
$return = ui_print_div('group_view_unk '.$class, $title);
break;
case AGENT_STATUS_WARNING:
$return = ui_print_div('group_view_warn '.$class, $title);
break;
case AGENT_STATUS_ALERT_FIRED:
$return = ui_print_div('group_view_alrm '.$class, $title);
break;
default:
// Not posible.
break;
}
return $return;
}
function ui_print_fav_menu($id_element, $url, $label, $section)
{
global $config;

View File

@ -498,8 +498,12 @@ function radar_graph(
$chart_data,
$options
) {
$chart = get_build_setup_charts('RADAR', $options, $chart_data);
return $chart->render(true, true);
if (count($chart_data[0]['data']) > 0) {
$chart = get_build_setup_charts('RADAR', $options, $chart_data);
return $chart->render(true, true);
} else {
return graph_nodata_image([]);
}
}
@ -515,6 +519,26 @@ function line_graph(
$chart_data,
$options
) {
if (empty($chart_data) === true) {
if (isset($options['ttl']) === true
&& (int) $options['ttl'] === 2
) {
$options['base64'] = true;
}
return graph_nodata_image($options);
}
if (isset($options['ttl']) === true && (int) $options['ttl'] === 2) {
$params = [
'chart_data' => $chart_data,
'options' => $options,
'return_img_base_64' => true,
];
return generator_chart_to_pdf('line_graph', $params);
}
$chart = get_build_setup_charts('LINE', $options, $chart_data);
return $chart->render(true, true);
}

View File

@ -0,0 +1,191 @@
/* global $ jQuery */
/* Function get custom fields incidences */
// eslint-disable-next-line no-unused-vars
function getInputFieldsIncidenceType(idIncidenceType, fieldsData, ajaxUrl) {
// Failed request handler.
var handleFail = function(jqXHR, textStatus, errorThrown) {
console.log(jqXHR, textStatus, errorThrown);
};
// Function which handle success case.
var handleSuccess = function(data) {
$(".object-type-fields").empty();
$(".object-type-fields").append(data);
};
// Visual Console container request.
jQuery
.post(
ajaxUrl,
{
page: "operation/ITSM/itsm",
method: "getInputFieldsIncidenceType",
idIncidenceType: idIncidenceType,
fieldsData: fieldsData
},
"html"
)
.done(handleSuccess)
.fail(handleFail);
}
/* Function get custom fields incidences */
// eslint-disable-next-line no-unused-vars
function downloadIncidenceAttachment(
idIncidence,
idAttachment,
ajaxUrl,
filename
) {
$.ajax({
type: "POST",
url: ajaxUrl,
data: {
page: "operation/ITSM/itsm",
method: "getDownloadIncidenceAttachment",
idIncidence: idIncidence,
idAttachment: idAttachment
},
dataType: "binary",
xhrFields: {
responseType: "arraybuffer"
},
success: function(data) {
var blob = new Blob([data], { type: "application/octetstream" });
var link = document.createElement("a");
link.href = window.URL.createObjectURL(blob);
link.download = filename;
document.body.appendChild(link);
link.click();
},
error: function(jqXHR, textStatus, message) {
console.error(textStatus, message);
}
});
}
/* Function check API */
// eslint-disable-next-line no-unused-vars
function testConectionApi(pass, host) {
var hideLoadingImage = function() {
$("span#ITSM-spinner").hide();
};
var showLoadingImage = function() {
$("span#ITSM-spinner").show();
};
var hideSuccessImage = function() {
$("span#ITSM-success").hide();
};
var showSuccessImage = function() {
$("span#ITSM-success").show();
};
var hideFailureImage = function() {
$("span#ITSM-failure").hide();
};
var showFailureImage = function() {
$("span#ITSM-failure").show();
};
var hideMessage = function() {
$("span#ITSM-message").hide();
};
var showMessage = function() {
$("span#ITSM-message").show();
};
hideSuccessImage();
hideFailureImage();
hideMessage();
showLoadingImage();
var data = {
page: "operation/ITSM/itsm",
method: "checkConnectionApi",
pass: pass,
host: host
};
$.ajax({
type: "POST",
url: "ajax.php",
dataType: "json",
data: data
})
.done(function(data) {
if (data.valid == 1) {
showSuccessImage();
} else {
showFailureImage();
showMessage();
}
})
.fail(function() {
showFailureImage();
showMessage();
})
.always(function() {
hideLoadingImage();
});
}
/* Function check API */
// eslint-disable-next-line no-unused-vars
function testConectionApiItsmToPandora(path) {
var hideLoadingImage = function() {
$("span#ITSM-spinner-pandora").hide();
};
var showLoadingImage = function() {
$("span#ITSM-spinner-pandora").show();
};
var hideSuccessImage = function() {
$("span#ITSM-success-pandora").hide();
};
var showSuccessImage = function() {
$("span#ITSM-success-pandora").show();
};
var hideFailureImage = function() {
$("span#ITSM-failure-pandora").hide();
};
var showFailureImage = function() {
$("span#ITSM-failure-pandora").show();
};
var hideMessage = function() {
$("span#ITSM-message-pandora").hide();
};
var showMessage = function() {
$("span#ITSM-message-pandora").show();
};
hideSuccessImage();
hideFailureImage();
hideMessage();
showLoadingImage();
var data = {
page: "operation/ITSM/itsm",
method: "checkConnectionApiITSMToPandora",
path: path
};
$.ajax({
type: "POST",
url: "ajax.php",
dataType: "json",
data: data
})
.done(function(data) {
if (data.valid == 1) {
showSuccessImage();
} else {
showFailureImage();
showMessage();
}
})
.fail(function() {
showFailureImage();
showMessage();
})
.always(function() {
hideLoadingImage();
});
}

View File

@ -131,6 +131,11 @@ if (dt.startDisabled === true) {
startDisabled = true;
}
var noMoveElementsToAction = false;
if (dt.no_move_elements_to_action === true) {
noMoveElementsToAction = true;
}
$(document).ready(function() {
function checkPages() {
if (dt_table.page.info().pages > 1) {
@ -226,7 +231,9 @@ $(document).ready(function() {
]
: [],
initComplete: function(settings, json) {
moveElementsToActionButtons();
if (noMoveElementsToAction === false) {
moveElementsToActionButtons();
}
checkPages();

View File

@ -653,7 +653,8 @@ $("[data-button=export]").click(function(e) {
});
});
$("#button-export-modal").click(function(e) {
// Export graph.
function exportCustomGraph() {
const filter = parseInt($("#export-filter-id").val());
const group = parseInt($("#export-group-id").val());
@ -682,8 +683,19 @@ $("#button-export-modal").click(function(e) {
}
}
});
} else {
confirmDialog({
title: titleExportError,
message: messageExportError,
hideCancelButton: true,
onAccept: function() {
$(
"button.ui-button.ui-corner-all.ui-widget.ui-button-icon-only.ui-dialog-titlebar-close"
).click();
}
});
}
});
}
// Remove graph.
function removeGraph(e) {

View File

@ -25,7 +25,15 @@ function progress_task_list(id, title) {
draggable: true,
closeOnEscape: true,
width: 800,
height: 600,
height: "auto",
buttons: [
{
text: "OK",
click: function() {
$(this).dialog("close");
}
}
],
close: function() {
if (xhr != null) xhr.abort();
if (timeoutRef != null) clearTimeout(timeoutRef);
@ -35,13 +43,17 @@ function progress_task_list(id, title) {
// Function var.
var handleFetchTaskList = function(err, data) {
if (err) {
console.error(err);
let err_text = err.toString();
err_text = err_text.replace("Error: ", "");
err_text =
"<b>Error</b><br/>" + err_text[0].toUpperCase() + err_text.substring(1);
$elem.html(err_text);
}
if (data.error) {
// TODO: Show info about the problem.
$elem.html(data.error);
} else {
$elem.html(data.html);
if (data) {
let split_data = data.split('{"html":');
data = '{"html":' + split_data[1];
data = JSON.parse(data);
$elem.html(data.html + " " + split_data[0]);
}
if (!$elem.dialog("isOpen")) $elem.dialog("open");
@ -71,7 +83,7 @@ function fetchTaskList(id, callback) {
},
type: "POST",
url: $("#ajax-url").val(),
dataType: "json",
dataType: "text",
success: function(data) {
callback(null, data);
},

View File

@ -205,6 +205,92 @@ class Cluster extends Entity
}
/**
* Counters modules involved status.
*
* @return array
*/
public function getCounters() :array
{
$id_agent_modules = $this->getIdsModulesInvolved();
$sql = sprintf(
'SELECT SUM( IF(estado = 1, 1, 0) ) AS critical,
SUM( IF(estado = 2, 1, 0) ) AS warning,
SUM( IF(estado = 0, 1, 0) ) AS normal,
SUM( IF(estado = 3, 1, 0) ) AS unknown,
SUM( IF(estado = 4 OR estado = 5, 1, 0) ) AS not_init,
COUNT(id_agente_modulo) AS total
FROM tagente_estado
WHERE id_agente_modulo IN (%s)',
implode(',', $id_agent_modules)
);
$counters = db_get_row_sql($sql);
if ($counters === false) {
$counters = [];
}
return $counters;
}
/**
* Return Ids modules involved.
*
* @return array
*/
public function getIdsModulesInvolved(): array
{
$members = $this->getMembers();
$modules_ids = [];
$modules_names = $this->getItemNames();
if (empty($members) === false) {
foreach ($members as $agent) {
$modules_filtered = $agent->searchModules(['nombre' => $modules_names], 0);
if (empty($modules_filtered) === false) {
foreach ($modules_filtered as $idAgent => $module) {
$modules_ids[] = $module->id_agente_modulo();
}
}
}
}
return $modules_ids;
}
/**
* Return names modules involved.
*
* @return array
*/
public function getItemNames(): array
{
$result = [];
if (empty($this->getItems()) === false) {
$result = array_keys($this->getItems());
}
return $result;
}
/**
* Return name type.
*
* @return string
*/
public function getStringTypeName(): string
{
$result = __('Active').' / '.__('Active');
if ($this->cluster_type() === 'AP') {
$result = __('Active').' / '.__('Pasive');
}
return $result;
}
/**
* Cleans members from cluster object.
*

View File

@ -216,15 +216,27 @@ class ClusterManager
$err = '';
$id = get_parameter('id', null);
try {
$cluster = new Cluster($id);
} catch (\Exception $e) {
$err = ui_print_error_message(
__('Cluster not found: '.$e->getMessage()),
'',
true
);
if (empty($id) === true) {
$id_agente = get_parameter('id_agente', null);
try {
$cluster = Cluster::loadFromAgentId($id_agente, true);
} catch (\Exception $e) {
$err = ui_print_error_message(
__('Cluster not found: '.$e->getMessage()),
'',
true
);
}
} else {
try {
$cluster = new Cluster($id);
} catch (\Exception $e) {
$err = ui_print_error_message(
__('Cluster not found: '.$e->getMessage()),
'',
true
);
}
}
if ($cluster->agent()->id_agente() === null) {
@ -237,15 +249,60 @@ class ClusterManager
$critical = true;
}
$allGroups = agents_get_all_groups_agent(
$cluster->agent()->id_agente(),
$cluster->agent()->id_grupo()
);
$flag = (int) get_parameter('flag', 0);
if ($flag === 1 && check_acl_one_of_groups($config['id_user'], $allGroups, 'AW') === true) {
$id_agent_module = get_parameter('id_agente_modulo');
db_process_sql_update(
'tagente_modulo',
['flag' => 1],
['id_agente_modulo' => $id_agent_module]
);
}
$flag_agent = (int) get_parameter('flag_agent', 0);
if ($flag_agent === 1 && check_acl_one_of_groups($config['id_user'], $allGroups, 'AW') === true) {
db_process_sql_update(
'tagente_modulo',
['flag' => 1],
['id_agente' => $cluster->agent()->id_agente()]
);
}
$counters = $cluster->getCounters();
$counters_chart = [];
$counters_bullet = [];
foreach ($counters as $key => $value) {
if ($key === 'not_init') {
$counters_chart['Not init'] = $value;
} else {
$counters_chart[ucfirst($key)] = $value;
}
$counters_bullet[$key.'_count'] = $value;
}
unset($counters_chart['Total']);
$module_involved_ids = $cluster->getIdsModulesInvolved();
View::render(
'cluster/view',
[
'message' => $msg,
'error' => $err,
'config' => $config,
'model' => $this,
'cluster' => $cluster,
'critical' => $critical,
'message' => $msg,
'error' => $err,
'config' => $config,
'model' => $this,
'cluster' => $cluster,
'critical' => $critical,
'allGroups' => $allGroups,
'counters_chart' => $counters_chart,
'counters_bullet' => $counters_bullet,
'module_involved_ids' => array_combine($module_involved_ids, $module_involved_ids),
]
);
}

View File

@ -725,14 +725,11 @@ class ClusterWizard extends \HTML
}
if ($this->page === 7) {
/*
*
* PARSE ALERTS
*
*/
// There is no need to parse anything. Already managed by alert
// builder.
global $config;
$step = true;
$id_agente = $this->cluster->agent()->id_agente();
$dont_display_alert_create_bttn = true;
include_once $config['homedir'].'/godmode/alerts/alert_list.php';
header('Location: '.$this->url.'&op=view&id='.$this->cluster->id());
}
@ -1212,26 +1209,15 @@ class ClusterWizard extends \HTML
'block_content' => $inputs,
];
} else if ($this->page === 6) {
/*
*
* Page: Alerts.
*
*/
ob_start();
global $config;
$step = true;
$id_agente = $this->cluster->agent()->id_agente();
$dont_display_alert_create_bttn = true;
include_once $config['homedir'].'/godmode/alerts/alert_list.php';
ob_start();
include_once $config['homedir'].'/godmode/alerts/alert_list.builder.php';
// XXX: Please do not use this kind of thing never more.
$hack = ob_get_clean();
// TODO: Alert form.
$form['pre-content'] = $hack;
html_print_input_hidden('create_alert', 1);
$hack_form = ob_get_clean();
$form['inputs'][] = ['extra' => $hack_form];
$final = true;
}

View File

@ -440,10 +440,26 @@ class Widget
$className .= '\\'.$name;
break;
case 'ITSMIncidences':
if (isset($config['ITSM_enabled']) === false || (bool) $config['ITSM_enabled'] === false) {
$not_installed = true;
}
$className .= '\\'.$name;
break;
case 'heatmap':
$className .= '\HeatmapWidget';
break;
case 'security_hardening':
if (\enterprise_installed() === false) {
$not_installed = true;
}
$className .= '\SecurityHardening';
break;
default:
$className = false;
break;

View File

@ -0,0 +1,453 @@
<?php
/**
* Widget Simple graph Pandora FMS Console
*
* @category Console Class
* @package Pandora FMS
* @subpackage Widget
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2023 Pandora FMS
* Please see https://pandorafms.com/community/ for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
namespace PandoraFMS\Dashboard;
use PandoraFMS\Enterprise\Metaconsole\Node;
use PandoraFMS\ITSM\ITSM;
global $config;
/**
* URL Widgets
*/
class ITSMIncidences extends Widget
{
/**
* Name widget.
*
* @var string
*/
protected $name;
/**
* Title widget.
*
* @var string
*/
protected $title;
/**
* Page widget;
*
* @var string
*/
protected $page;
/**
* Class name widget.
*
* @var [type]
*/
protected $className;
/**
* Values options for each widget.
*
* @var [type]
*/
protected $values;
/**
* Configuration required.
*
* @var boolean
*/
protected $configurationRequired;
/**
* Error load widget.
*
* @var boolean
*/
protected $loadError;
/**
* Width.
*
* @var integer
*/
protected $width;
/**
* Heigth.
*
* @var integer
*/
protected $height;
/**
* Grid Width.
*
* @var integer
*/
protected $gridWidth;
/**
* Cell ID.
*
* @var integer
*/
protected $cellId;
/**
* Construct.
*
* @param integer $cellId Cell ID.
* @param integer $dashboardId Dashboard ID.
* @param integer $widgetId Widget ID.
* @param integer|null $width New width.
* @param integer|null $height New height.
* @param integer|null $gridWidth Grid width.
*/
public function __construct(
int $cellId,
int $dashboardId=0,
int $widgetId=0,
?int $width=0,
?int $height=0,
?int $gridWidth=0
) {
global $config;
// WARNING: Do not edit. This chunk must be in the constructor.
parent::__construct(
$cellId,
$dashboardId,
$widgetId
);
// Width.
$this->width = $width;
// Height.
$this->height = $height;
// Grid Width.
$this->gridWidth = $gridWidth;
// Cell Id.
$this->cellId = $cellId;
// Options.
$this->values = $this->decoders($this->getOptionsWidget());
// Positions.
$this->position = $this->getPositionWidget();
// Page.
$this->page = basename(__FILE__);
// ClassName.
$class = new \ReflectionClass($this);
$this->className = $class->getShortName();
// Title.
$this->title = __('Pandora ITSM tickets');
// Name.
if (empty($this->name) === true) {
$this->name = 'ITSMIncidences';
}
// This forces at least a first configuration.
$this->configurationRequired = false;
if (isset($config['ITSM_enabled']) === false || (bool) $config['ITSM_enabled'] === false) {
$this->configurationRequired = true;
} else {
if (empty($this->values['customSearch']) === true || empty($this->values['fields']) === true) {
$this->configurationRequired = true;
}
}
$this->overflow_scrollbars = false;
}
/**
* Decoders hack for retrocompability.
*
* @param array $decoder Values.
*
* @return array Returns the values with the correct key.
*/
public function decoders(array $decoder): array
{
$values = [];
// Retrieve global - common inputs.
$values = parent::decoders($decoder);
if (isset($decoder['show_full_legend']) === true) {
$values['showLegend'] = $decoder['show_full_legend'];
}
if (isset($decoder['fields']) === true) {
if (is_array($decoder['fields']) === true) {
$decoder['fields'] = implode(',', $decoder['fields']);
}
$values['fields'] = $decoder['fields'];
}
if (isset($decoder['limit']) === true) {
$values['limit'] = $decoder['limit'];
}
if (isset($decoder['customSearch']) === true) {
$values['customSearch'] = $decoder['customSearch'];
}
return $values;
}
/**
* Generates inputs for form (specific).
*
* @return array Of inputs.
*
* @throws Exception On error.
*/
public function getFormInputs(): array
{
global $config;
$values = $this->values;
// Retrieve global - common inputs.
$inputs = parent::getFormInputs();
// Default values.
if (isset($values['fields']) === false) {
$values['fields'] = implode(
',',
[
'idIncidence',
'title',
'priority',
'idCreator',
]
);
}
if (isset($values['limit']) === false) {
$values['limit'] = $config['block_size'];
}
$inputs[] = [
'label' => __('Limit'),
'arguments' => [
'type' => 'number',
'name' => 'limit',
'value' => $values['limit'],
'return' => true,
'max' => 100,
'min' => 0,
],
];
$customSearches = [];
if (isset($config['ITSM_enabled']) === true && (bool) $config['ITSM_enabled'] === true) {
try {
$ITSM = new ITSM();
$customSearches = $ITSM->listCustomSearch();
} catch (\Throwable $th) {
$error = $th->getMessage();
}
}
$inputs[] = [
'label' => __('Custom search'),
'arguments' => [
'type' => 'select',
'fields' => $customSearches,
'name' => 'customSearch',
'selected' => $values['customSearch'],
'return' => true,
'sort' => false,
],
];
$fields = [
'idIncidence' => __('ID'),
'title' => __('Title'),
'groupCompany' => __('Group').'/'.__('Company'),
'statusResolution' => __('Status').'/'.__('Resolution'),
'priority' => __('Priority'),
'updateDate' => __('Updated'),
'startDate' => __('Started'),
'idCreator' => __('Creator'),
'owner' => __('Owner'),
];
$inputs[] = [
'label' => __('Fields to show'),
'arguments' => [
'type' => 'select',
'fields' => $fields,
'name' => 'fields[]',
'selected' => explode(',', $values['fields']),
'return' => true,
'multiple' => true,
'sort' => false,
],
];
return $inputs;
}
/**
* Get Post for widget.
*
* @return array
*/
public function getPost():array
{
// Retrieve global - common inputs.
$values = parent::getPost();
$values['fields'] = \get_parameter('fields', []);
$values['limit'] = \get_parameter('limit', 20);
$values['customSearch'] = \get_parameter('customSearch', 20);
return $values;
}
/**
* Draw widget.
*
* @return string;
*/
public function load()
{
global $config;
\ui_require_css_file('pandoraitsm', 'include/styles/', true);
$fields = [
'idIncidence' => __('ID'),
'title' => __('Title'),
'groupCompany' => __('Group').'/'.__('Company'),
'statusResolution' => __('Status').'/'.__('Resolution'),
'priority' => __('Priority'),
'updateDate' => __('Updated'),
'startDate' => __('Started'),
'idCreator' => __('Creator'),
'owner' => __('Owner'),
];
$fields_selected = explode(',', $this->values['fields']);
if (is_array($fields_selected) === false && empty($fields_selected) === true) {
$output = '';
$output .= '<div class="container-center">';
$output .= \ui_print_info_message(
__('Not found fields selected'),
'',
true
);
$output .= '</div>';
return $output;
}
$columns = $fields_selected;
$column_names = [];
foreach ($fields_selected as $field) {
$column_names[] = $fields[$field];
}
$tableId = 'ITSMIncidence_'.$this->dashboardId.'_'.$this->cellId;
try {
ui_print_datatable(
[
'id' => $tableId,
'class' => 'info_table table-widget-itsm',
'style' => 'width: 99%',
'columns' => $columns,
'column_names' => $column_names,
'ajax_url' => 'operation/ITSM/itsm',
'ajax_data' => [
'method' => 'getListTickets',
'customSearch' => $this->values['customSearch'],
],
'order' => [
'field' => 'updateDate',
'direction' => 'desc',
],
'csv' => 0,
'dom_elements' => 'frtip',
'default_pagination' => $this->values['limit'],
]
);
} catch (\Exception $e) {
echo $e->getMessage();
}
}
/**
* Get description.
*
* @return string.
*/
public static function getDescription()
{
return __('Pandora ITSM tickets');
}
/**
* Get Name.
*
* @return string.
*/
public static function getName()
{
return 'ITSMIncidences';
}
/**
* Get size Modal Configuration.
*
* @return array
*/
public function getSizeModalConfiguration(): array
{
$size = [
'width' => 450,
'height' => 430,
];
return $size;
}
}

View File

@ -256,7 +256,7 @@ class InventoryWidget extends Widget
'arguments' => [
'name' => 'free_search',
'type' => 'text',
'class' => 'w100p',
'class' => 'w96p',
'input_class' => 'flex-row',
'value' => $values['freeSearch'],
'return' => true,
@ -612,7 +612,7 @@ class InventoryWidget extends Widget
$table = ui_print_datatable(
[
'id' => $id_table,
'class' => 'info_table w100p',
'class' => 'info_table w96p',
'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $columns,
@ -642,8 +642,8 @@ class InventoryWidget extends Widget
true,
true,
'',
'white-box-content w100p',
'box-shadow white_table_graph w100p',
'white-box-content w96p',
'box-shadow white_table_graph w96p',
'images/arrow_down_green.png',
'images/arrow_right_green.png',
false,
@ -666,8 +666,8 @@ class InventoryWidget extends Widget
true,
true,
'',
'white-box-content w100p',
'box-shadow white_table_graph w100p',
'white-box-content w96p',
'box-shadow white_table_graph w96p',
);
}
@ -682,7 +682,10 @@ class InventoryWidget extends Widget
'',
'',
false,
false
false,
'',
'white-box-content',
'box-flat white_table_graph w96p'
);
}
} else {
@ -729,7 +732,7 @@ class InventoryWidget extends Widget
$table = ui_print_datatable(
[
'id' => $id_table,
'class' => 'info_table w100p',
'class' => 'info_table w96p',
'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $columns,
@ -759,8 +762,8 @@ class InventoryWidget extends Widget
true,
true,
'',
'white-box-content w100p',
'box-shadow white_table_graph w100p',
'white-box-content w96p',
'box-shadow white_table_graph w96p',
'images/arrow_down_green.png',
'images/arrow_right_green.png',
false,
@ -782,8 +785,8 @@ class InventoryWidget extends Widget
true,
true,
'',
'white-box-content w100p',
'box-shadow white_table_graph w100p',
'white-box-content w96p',
'box-shadow white_table_graph w96p',
);
}
@ -895,7 +898,7 @@ class InventoryWidget extends Widget
$table = ui_print_datatable(
[
'id' => $id_table,
'class' => 'info_table w100p',
'class' => 'info_table w96p',
'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $columns,
@ -925,8 +928,8 @@ class InventoryWidget extends Widget
true,
true,
'',
'white-box-content w100p',
'box-shadow white_table_graph w100p',
'white-box-content w96p',
'box-shadow white_table_graph w96p',
'images/arrow_down_green.png',
'images/arrow_right_green.png',
false,
@ -947,7 +950,10 @@ class InventoryWidget extends Widget
'',
'',
false,
false
false,
'',
'white-box-content',
'box-flat white_table_graph w96p'
);
}
} else {
@ -986,7 +992,7 @@ class InventoryWidget extends Widget
$table = ui_print_datatable(
[
'id' => $id_table,
'class' => 'info_table w100p',
'class' => 'info_table w96p',
'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $columns,
@ -1022,7 +1028,7 @@ class InventoryWidget extends Widget
$table = ui_print_datatable(
[
'id' => $id_table,
'class' => 'info_table w100p',
'class' => 'info_table w96p',
'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $columns,
@ -1049,7 +1055,7 @@ class InventoryWidget extends Widget
$id_agente = $inventory_id_agent;
$agentes = [];
$data = [];
$class = 'info_table w100p';
$class = 'info_table w96p';
$style = 'width: 100%; font-size: 100px !important;';
$ordering = true;
$searching = false;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,612 @@
<?php
namespace PandoraFMS\ITSM;
/**
* Dashboard manager.
*/
class ITSM
{
/**
* User level conf.
*
* @var boolean
*/
private ?bool $userLevelConf;
/**
* User level conf.
*
* @var string
*/
private string $url;
/**
* Bearer.
*
* @var string
*/
private ?string $userBearer;
/**
* ITSM.
*
* @param string|null $host Host url.
* @param string|null $token Token.
*/
public function __construct(?string $host=null, ?string $token=null)
{
global $config;
$user_info = \users_get_user_by_id($config['id_user']);
$this->userLevelConf = (bool) $config['ITSM_user_level_conf'];
$this->url = ($host ?? $config['ITSM_hostname']);
$this->userBearer = ($token ?? $config['ITSM_token']);
if ($this->userLevelConf === true) {
$this->userBearer = ($token ?? $user_info['integria_user_level_pass']);
}
}
/**
* Call api ITSM.
*
* @param string $action Endpoint.
* @param array $queryParams Params send get.
* @param array $postFields Params send post.
* @param mixed $id Specific id for path.
* @param string|null $method Request method.
* @param array|null $file Upload file.
* @param boolean $download Download file.
*
* @return array Array result.
* @throws \Exception On error.
*/
public function callApi(
string $action,
?array $queryParams=null,
?array $postFields=null,
mixed $id=null,
?string $method='POST',
?array $file=null,
?bool $download=false
) {
$headers = [
'accept: application/json',
'Content-Type: application/json',
'Authorization: Bearer '.$this->userBearer,
];
$path = $this->pathAction($action, $queryParams, $id);
$url = $this->url.$path;
$data = [];
// Clean safe_input forms.
if (empty($postFields) === false) {
foreach ($postFields as $key => $field) {
if ($field !== null) {
$field = io_safe_output($field);
}
$data[$key] = $field;
}
}
if ($file !== null && file_exists($file['tmp_name']) === true) {
$data['attachment'] = curl_file_create(
$file['tmp_name'],
$file['type'],
$file['name']
);
$headers = [
'Content-Type: multipart/form-data',
'Authorization: Bearer '.$this->userBearer,
];
} else {
$data = json_encode($data);
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_VERBOSE, true);
$response = curl_exec($ch);
if ($download === true) {
return $response;
}
$result = json_decode($response, true);
if (json_last_error() !== JSON_ERROR_NONE) {
throw new \Exception(__('Invalid response').', '.$response);
}
$http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($http_status !== 200) {
throw new \Exception($result['error']);
}
return $result;
}
/**
* Convert path to endpoint ITSM.
*
* @param string $action EndPoint.
* @param array|null $queryParams Params to url.
* @param mixed $id Specific id for path.
*
* @return string Return path to Endpoint.
*/
private function pathAction(string $action, ?array $queryParams=null, mixed $id=null): string
{
$path = '';
switch ($action) {
case 'ping':
$path = '/ping';
break;
case 'listTickets':
$path = '/incidence/list';
break;
case 'listObjectTypes':
$path = '/incidencetype/list';
break;
case 'listGroups':
$path = '/group/list';
break;
case 'listResolutions':
$path = '/incidence/resolution/list';
break;
case 'listStatus':
$path = '/incidence/status/list';
break;
case 'listPriorities':
$path = '/incidence/priority/list';
break;
case 'listUsers':
$path = '/user/list';
break;
case 'listCompanies':
$path = '/company/list';
break;
case 'createIncidence':
$path = '/incidence';
break;
case 'updateIncidence':
$path = '/incidence/'.$id;
break;
case 'incidenceTypeFields':
$path = '/incidencetype/'.$id.'/field/list';
break;
case 'incidence':
$path = '/incidence/'.$id;
break;
case 'deleteIncidence':
$path = '/incidence/'.$id;
break;
case 'incidenceWus':
$path = '/incidence/'.$id.'/workunit/list';
break;
case 'incidenceFiles':
$path = '/incidence/'.$id.'/attachment/list';
break;
case 'createIncidenceAttachment':
$path = '/incidence/'.$id.'/attachment';
break;
case 'createIncidenceWu':
$path = '/incidence/'.$id.'/workunit';
break;
case 'deleteIncidenceAttachment':
$path = '/incidence/'.$id['idIncidence'].'/attachment/'.$id['idAttachment'];
break;
case 'downloadIncidenceAttachment':
$path = '/incidence/'.$id['idIncidence'].'/attachment/'.$id['idAttachment'].'/download';
break;
case 'getIncidencesGroupedByStatus':
$path = '/incidence/statistic/groupedByStatus';
break;
case 'getIncidencesGroupedByPriorities':
$path = '/incidence/statistic/groupedByPriorities';
break;
case 'getIncidencesGroupedByGroups':
$path = '/incidence/statistic/groupedByGroups';
break;
case 'getIncidencesGroupedByOwners':
$path = '/incidence/statistic/groupedByOwners';
break;
case 'listCustomSearch':
$path = '/customSearch/list';
break;
case 'customSearch':
$path = '/customSearch/'.$id;
break;
case 'inventory':
$path = '/inventory/'.$id;
break;
case 'createNode':
$path = '/pandorafms/nodes';
break;
case 'getNode':
$path = '/pandorafms/node/'.$id;
break;
case 'pingItsmToPandora':
$path = '/pandorafms/node/ping';
break;
default:
// Not posible.
break;
}
if (empty($queryParams) === false) {
if (isset($queryParams['field']) === true) {
$queryParams['sortField'] = $queryParams['field'];
unset($queryParams['field']);
}
if (isset($queryParams['direction']) === true) {
$queryParams['sortDirection'] = $queryParams['direction'];
unset($queryParams['direction']);
}
$path .= '?';
$path .= http_build_query($queryParams);
}
return $path;
}
/**
* Ping API.
*
* @return boolean Data incidence
*/
public function ping(): bool
{
$result = $this->callApi(
'ping',
[],
[],
null,
'GET'
);
return $result['valid'];
}
/**
* Get Groups.
*
* @return array Return mode select.
*/
public function getGroups(): array
{
$listGroups = $this->callApi('listGroups');
$result = [];
foreach ($listGroups['data'] as $group) {
if ($group['idGroup'] > 1) {
$result[$group['idGroup']] = $group['name'];
}
}
return $result;
}
/**
* Get Priorities.
*
* @return array Return mode select.
*/
public function getPriorities(): array
{
$listPriorities = $this->callApi('listPriorities');
return $listPriorities;
}
/**
* Get Status.
*
* @return array Return mode select.
*/
public function getStatus(): array
{
$listStatus = $this->callApi('listStatus');
$result = [];
foreach ($listStatus['data'] as $status) {
$result[$status['idIncidenceStatus']] = $status['name'];
}
return $result;
}
/**
* Get Incidences types.
*
* @return array Return mode select.
*/
public function getObjectypes(): array
{
$listObjectTypes = $this->callApi('listObjectTypes');
$result = [];
foreach ($listObjectTypes['data'] as $objectType) {
$result[$objectType['idIncidenceType']] = $objectType['name'];
}
return $result;
}
/**
* Get fields incidence type.
*
* @param integer $idIncidenceType Incidence Type ID.
*
* @return array Fields array.
*/
public function getObjecTypesFields(int $idIncidenceType): array
{
$result = $this->callApi(
'incidenceTypeFields',
[
'page' => 0,
'sizePage' => 0,
'field' => 'idIncidenceTypeField',
'direction' => 'ascending',
],
[],
$idIncidenceType
);
return $result['data'];
}
/**
* List custom search.
*
* @return array Result.
*/
public function listCustomSearch(): array
{
$listCustomSearch = $this->callApi(
'listCustomSearch',
[
'page' => 0,
'sizePage' => 0,
],
['section' => 'incidences']
);
$result = [];
foreach ($listCustomSearch['data'] as $customSearch) {
$result[$customSearch['idCustomSearch']] = $customSearch['name'];
}
return $result;
}
/**
* Get Custom search.
*
* @param integer $idCustomSearch Custom search ID.
*
* @return array Data custom search.
*/
public function getCustomSearch(int $idCustomSearch): array
{
$result = $this->callApi(
'customSearch',
[],
[],
$idCustomSearch,
'GET'
);
return $result;
}
/**
* List incidences.
*
* @param integer $idAgent Agent id.
*
* @return array list Incidences.
*/
public function listIncidenceAgents(int $idAgent, ?bool $blocked=null): array
{
global $config;
$listIncidences = $this->callApi(
'listTickets',
[
'page' => 0,
'sizePage' => 0,
],
[
'externalIdLike' => $config['metaconsole_node_id'].'-'.$idAgent,
'blocked' => $blocked,
]
);
return $listIncidences['data'];
}
/**
* Get table incicidences for agent.
*
* @param integer $idAgent Id agent.
* @param boolean|null $mini Visual mode mini.
* @param integer|null $blocked Blocked.
*
* @return string Html output.
*/
public function getTableIncidencesForAgent(int $idAgent, ?bool $mini=false, ?int $blocked=null)
{
\ui_require_css_file('pandoraitsm');
\ui_require_javascript_file('ITSM');
global $config;
$columns = [
'idIncidence',
'title',
'groupCompany',
'statusResolution',
'priority',
'updateDate',
'startDate',
'idCreator',
'owner',
];
$column_names = [
__('ID'),
__('Title'),
__('Group').'/'.__('Company'),
__('Status').'/'.__('Resolution'),
__('Priority'),
__('Updated'),
__('Started'),
__('Creator'),
__('Owner'),
];
$options = [
'id' => 'itms_list_tickets',
'class' => 'info_table',
'style' => 'width: 99%',
'columns' => $columns,
'column_names' => $column_names,
'ajax_url' => 'operation/ITSM/itsm',
'ajax_data' => [
'method' => 'getListTickets',
'externalIdLike' => $config['metaconsole_node_id'].'-'.$idAgent,
'blocked' => $blocked,
],
'no_sortable_columns' => [
2,
3,
-1,
],
'order' => [
'field' => 'updateDate',
'direction' => 'desc',
],
'return' => true,
];
if ($mini === true) {
$options['csv'] = 0;
$options['dom_elements'] = 'frtip';
}
return ui_print_datatable($options);
}
/**
* Create Node in pandora ITSM.
*
* @param array $data Info connect to node from ITSM.
*
* @return boolean
*/
public function createNode(array $data): array
{
return $this->callApi('createNode', null, $data);
}
/**
* Get info node sincronization.
*
* @param string $serverAuth Server Auth.
*
* @return array Array.
*/
public function getNode(string $serverAuth): array
{
$result = $this->callApi(
'getNode',
[],
[],
$serverAuth,
'GET'
);
return $result;
}
/**
* Ping Itsm to pandora node.
*
* @param string $path Path.
*
* @return boolean
*/
public function pingItsmtoPandora(string $path): bool
{
global $config;
$result = $this->callApi(
'pingItsmToPandora',
[],
[
'path' => $path,
'apiPass' => $config['api_password'],
'serverAuth' => $config['server_unique_identifier'],
]
);
return (bool) $result['valid'];
}
}

File diff suppressed because it is too large Load Diff

View File

@ -565,3 +565,7 @@ div.container-filter-buttons {
justify-content: space-between;
align-items: center;
}
.ui-state-active {
border-radius: 0px !important;
}

View File

@ -239,6 +239,11 @@
background-size: 18px;
}
.icon_security {
background: url(../../images/menu/security.svg) no-repeat 50% 50%;
background-size: 18px;
}
.icon_oper-agents {
background: url(../../images/menu/monitoring.svg) no-repeat 50% 50%;
background-size: 18px;
@ -259,6 +264,12 @@
background-size: 18px;
}
/* ITSM */
.icon_oper-itsm {
background: url(../../images/menu/itsm.svg) no-repeat 50% 50%;
background-size: 18px;
}
/* trap console */
.icon_oper-snmpc,
.icon_god-snmpc {

View File

@ -6215,19 +6215,18 @@ div#status_pie {
padding: 15px;
}
/*
.agent_details_content {
display: flex;
align-items: flex-start;
padding: 20px;
padding-bottom: 0;
}
*/
.agent_details_content {
.agent_details_content_cluster {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: flex-start;
padding: 20px;
padding-bottom: 0;
}
.agent_details_content .agent_details_graph {
@ -6240,10 +6239,69 @@ div#status_pie {
justify-content: center;
}
.agent_details_content .agent_details_info {
flex: 1 1 70%;
overflow: hidden;
padding-left: 15px;
.agent_details_content_cluster .agent_details_graph {
display: flex;
flex-direction: column;
margin-left: 10px;
min-width: 35%;
max-width: 50%;
}
.agent_details_content_cluster .agent_details_graph > div {
display: flex;
flex-direction: row;
justify-content: space-around;
align-items: center;
width: 100%;
margin-bottom: 5px;
}
.agent_details_content_cluster div#status_pie {
margin: 0px;
}
.agent_details_content_cluster .agent_details_info {
display: flex;
flex-direction: column;
margin-right: 10px;
min-width: 35%;
max-width: 50%;
justify-content: space-between;
align-items: center;
height: 180px;
}
.agent_details_content_cluster .agent_details_info > div {
display: flex;
flex-direction: column;
justify-content: space-around;
align-items: flex-end;
width: 100%;
margin-bottom: 5px;
}
.agent_details_content_cluster .agent_details_info {
display: flex;
flex-direction: column;
margin-left: 10px;
min-width: 35%;
max-width: 50%;
justify-content: space-around;
align-items: flex-end;
margin-right: 20px;
}
.agent_event_chart_cluster {
margin-left: 10px;
margin-bottom: 10px;
}
.agent_event_chart_cluster div b {
margin-left: 0px;
}
.agent_event_chart_cluster .white-table-graph-content {
height: auto;
}
.agent_details_info {
@ -6280,6 +6338,17 @@ div#status_pie {
justify-content: flex-start;
}
.agent_details_bullets_cluster #bullets_modules {
display: flex;
justify-content: flex-start;
flex-direction: column;
}
.agent_details_bullets_cluster #bullets_modules > div {
padding: 0px;
margin-bottom: 10px;
}
.agent_details_bullets #bullets_modules > div {
display: flex;
align-items: center;
@ -8543,7 +8612,7 @@ div.graph div.legend table {
padding: 5px;
}
.integria_title .ehorus_title {
.ITSM_title .ehorus_title {
color: #515151;
}
@ -12566,3 +12635,25 @@ tr[id^="network_component-plugin-snmp-fields-dynamicMacroRow-"] input {
.ui-date-range-in > a {
background-color: #81b92e3b !important;
}
.ui-datepicker-title > span {
color: #82b92e !important;
}
.div-report_export_filter {
left: 0em;
top: 0em;
position: relative;
}
.button-export_filter {
position: relative;
left: 17em;
top: -38px;
width: 30%;
}
.filter_label_position_after {
position: relative;
top: -92px;
}

View File

@ -1013,7 +1013,7 @@ div#dashboard-controls {
color: #fff;
}
.integria_details_shadow {
.ITSM_details_shadow {
background-color: #222;
border-bottom: 1px solid #e2e2e2;
border-left: 1px solid #e2e2e2;
@ -1022,7 +1022,7 @@ div#dashboard-controls {
border-top-right-radius: 5px;
}
div.integria_details_description textarea {
div.ITSM_details_description textarea {
width: 100%;
background-color: #111;
color: #fff;

View File

@ -1,31 +1,30 @@
/* --- Integria IMS --- */
div.priority {
width: 80px;
color: #fff;
text-align: center;
border-radius: 5px;
padding: 5px;
padding: 0px;
display: table-cell;
vertical-align: middle;
}
/* Details view */
div.integria_details {
div.ITSM_details {
display: grid;
grid-column-gap: 10px;
grid-template-columns: repeat(3, minmax(min-content, auto));
grid-auto-rows: 1fr;
}
div.integria_details div.box-shadow.white_table_graph {
div.ITSM_details div.box-shadow.white_table_graph {
box-shadow: none;
}
div.integria_details div.priority {
div.ITSM_details div.priority {
display: inline-block;
}
div.integriaims_details_row {
div.pandoraitsm_details_row {
display: grid;
grid-gap: 10px;
text-align: center;
@ -33,30 +32,25 @@ div.integriaims_details_row {
margin-bottom: 8px;
}
div.integriaims_details_titles {
div.pandoraitsm_details_titles {
font-weight: bold;
}
div.integria_details_row_five {
div.ITSM_details_row_five {
grid-template-columns: repeat(5, 1fr);
}
div.integria_details_row_three {
div.ITSM_details_row_three {
grid-template-columns: repeat(3, 1fr);
}
div.integria_details_description {
div.ITSM_details_description {
width: 100%;
overflow: auto;
padding: 0px 10px;
}
div.integria_details_description textarea {
width: 100%;
background-color: #fbfbfb;
resize: vertical;
color: #000;
}
.integriaims_details_box {
.pandoraitsm_details_box {
display: grid;
grid-column-gap: 10px;
grid-row-gap: 5px;
@ -65,18 +59,18 @@ div.integria_details_description textarea {
text-align: center;
}
.integriaims_details_box_five {
.pandoraitsm_details_box_five {
grid-template-rows: repeat(3, 1fr);
grid-template-columns: repeat(5, 1fr);
}
.integriaims_details_box_three {
.pandoraitsm_details_box_three {
grid-template-rows: repeat(3, 1fr);
grid-template-columns: repeat(3, 1fr);
}
/* ui_toggles */
.integria_details_shadow {
.ITSM_details_shadow {
background-color: #fff;
border-bottom: 1px solid #e2e2e2;
border-left: 1px solid #e2e2e2;
@ -85,35 +79,17 @@ div.integria_details_description textarea {
border-top-right-radius: 5px;
}
.integria_details_shadow .white_table_graph_header {
.ITSM_details_shadow .white_table_graph_header {
border-left: none;
border-right: none;
}
.integria_details_content {
.ITSM_details_content {
border-bottom: none;
border-left: none;
border-right: none;
}
/* Inputs type text shown as a black line */
.integria_incidents_options input[type="text"] {
background-color: transparent;
border: none;
border-radius: 0;
border-bottom: 1px solid #ccc;
font-size: 10pt;
padding: 2px 5px;
box-sizing: border-box;
background-repeat: no-repeat;
background-position: left bottom 2px;
margin-bottom: 4px;
}
.integria_incident_options input[readonly] {
color: #848484;
}
.comment_title {
padding: 5px 10px 5px 20px;
background-color: rgba(130, 185, 46, 0.16);
@ -123,3 +99,46 @@ div.integria_details_description textarea {
.comment_body {
padding: 15px 20px 15px 20px;
}
/*---*/
div.incidence-type-custom-fields {
display: flex;
flex-direction: row;
justify-content: center;
align-items: baseline;
flex-wrap: wrap;
}
.incidence-type-custom-fields > div {
flex: 1 1 45%;
display: flex;
margin: 0px 20px;
flex-direction: column;
}
.incidence-type-custom-fields > div.incidence-type-custom-fields-textarea {
flex: 1 1 100%;
}
.label_select,
.label_select_simple {
display: flex;
flex-direction: column;
margin: 0;
}
div.container-statistics {
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
div.container-statistics > div {
flex: 1 1 45%;
max-width: 46%;
margin: 1%;
}
table.table-widget-itsm tr > td {
text-align: left;
}

View File

@ -31,6 +31,26 @@
margin: 10px;
}
.col-md-1 {
width: 15%;
margin: 10px;
}
.col-md-2 {
width: 30%;
margin: 10px;
}
.col-md-7 {
width: 40%;
margin: 10px;
}
.col-md-9 {
width: 63%;
margin: 10px;
}
.text-fail {
font-size: 18px;
color: #e63c52;
@ -75,7 +95,7 @@
margin-right: 10px;
}
.issues-audit {
.resume-audit {
margin: 11px 12px 0px 18px;
}
@ -88,7 +108,15 @@
margin: 21px auto;
}
.time-line {
.custom-filter label {
font-size: 13px !important;
margin-right: 10px;
}
#time-line-graph {
height: 300px;
}
.time-line,
#time-line-graph {
max-height: 300px;
}
.summary_categories {
@ -96,8 +124,8 @@
margin: 20px;
}
#list_total_resume .sorting_asc {
background-image: none;
.sorting_asc {
background-image: none !important;
}
#form_list_resume {
@ -105,31 +133,67 @@
align-items: flex-end;
}
#form_list_total_resume {
#form_list_total_resume,
#form_list_total_failed {
display: flex;
align-items: flex-end;
}
.dt-buttons {
display: flex;
margin-top: 10px;
}
#date-result {
padding-left: 4px !important;
}
.total-agents {
font-weight: 800;
font-size: 40px;
text-align: center;
}
.avg-scoring {
font-size: 25px;
font-weight: 700;
line-height: normal;
}
.separator-bar {
font-size: 50px;
}
#filter-range-date {
width: 90%;
margin: 0 auto;
align-items: flex-end;
}
#filter-category > div,
#filter-group > div {
display: flex;
align-items: center;
}
@media (max-width: 1500px) {
.col-md-3 {
width: 40%;
}
.col-md-1 {
width: 20%;
}
.col-md-2 {
width: 45%;
}
.col-md-6 {
width: 88%;
}
.issues-audit {
.col-md-7 {
width: 80%;
}
.resume-audit {
justify-content: center;
}
.time-line {
.time-line,
#time-line-graph {
max-height: 230px;
}
}

View File

@ -45,6 +45,7 @@ div.container-button-play > button#button-start-search {
#tabs-sound-modal ul.tabs-sound-modal-options li.ui-tabs-active {
border-bottom: 2px solid #82b92e;
border-radius: 0px !important;
}
#tabs-sound-modal ul.wizard li label {

View File

@ -131,7 +131,7 @@
<div style='padding-bottom: 50px'>
<?php
$version = '7.0NG.773.3';
$build = '230919';
$build = '230928';
$banner = "v$version Build $build";
error_reporting(0);

View File

@ -0,0 +1,73 @@
<?php
/**
* ITSM.
*
* @category ITSM
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2023 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Begin.
global $config;
require $config['homedir'].'/vendor/autoload.php';
use PandoraFMS\ITSM\Manager;
if ((bool) is_metaconsole() === true) {
ui_require_css_file('meta_dashboards');
}
$ajaxPage = 'operation/ITSM/itsm';
// Control call flow.
try {
// User access and validation is being processed on class constructor.
$cs = new Manager($ajaxPage);
} catch (Exception $e) {
if (is_ajax() === true) {
echo json_encode(['error' => '[ITSM]'.$e->getMessage() ]);
} else {
echo '[ITSM]'.$e->getMessage();
}
// Stop this execution, but continue 'globally'.
return;
}
// AJAX controller.
if (is_ajax() === true) {
$method = get_parameter('method');
if (method_exists($cs, $method) === true) {
if ($cs->ajaxMethod($method) === true) {
$cs->{$method}();
} else {
$cs->error('Unavailable method.');
}
} else {
$cs->error('Method not found. ['.$method.']');
}
} else {
// Run.
$cs->run();
}

View File

@ -109,6 +109,7 @@ $sec = safe_url_extraclean($sec);
$flag_alert = (bool) get_parameter('force_execution', 0);
$alert_validate = (bool) get_parameter('alert_validate', 0);
$tab = get_parameter_get('tab', null);
$op = get_parameter('op', null);
$refr = (int) get_parameter('refr', 0);
$pure = get_parameter('pure', 0);
@ -119,8 +120,11 @@ if ($flag_alert == 1 && check_acl($config['id_user'], $id_group, 'AW')) {
forceExecution($id_group);
}
$idAgent = get_parameter_get('id_agente', 0);
if (isset($id_agente) === false || empty($id_agente) === true) {
$idAgent = get_parameter_get('id_agente', 0);
} else {
$idAgent = $id_agente;
}
// Show alerts for specific agent.
if ($idAgent != 0) {
@ -207,6 +211,10 @@ if ($idAgent != 0) {
$alerts = [];
if ($op != null) {
$url = $url.'&op='.$op;
}
if ($tab != null) {
$url = $url.'&tab='.$tab;
}

View File

@ -1153,11 +1153,8 @@ foreach ($agents as $agent) {
$cluster = PandoraFMS\Cluster::loadFromAgentId(
$agent['id_agente']
);
$url = 'index.php?sec=reporting&sec2=';
$url .= 'operation/cluster/cluster';
$url = ui_get_full_url(
$url.'&op=view&id='.$cluster->id()
);
$url_cluster = 'index.php?sec=reporting&sec2=operation/cluster/cluster';
$url = $url_cluster.'&op=view&id='.$cluster->id();
} else {
$url = 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent['id_agente'];
}

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