mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
Merge remote-tracking branch 'origin/develop' into ent-4176-8084-8169-actualizacion-selenium-firefox-wux
This commit is contained in:
commit
5c405b1d32
@ -29,6 +29,7 @@ $CODEHOME/pandora_console/pandora_console.redhat.spec \
|
|||||||
$CODEHOME/pandora_console/pandora_console.rhel7.spec \
|
$CODEHOME/pandora_console/pandora_console.rhel7.spec \
|
||||||
$CODEHOME/pandora_agents/unix/pandora_agent.redhat.spec \
|
$CODEHOME/pandora_agents/unix/pandora_agent.redhat.spec \
|
||||||
$CODEHOME/pandora_server/pandora_server.redhat.spec \
|
$CODEHOME/pandora_server/pandora_server.redhat.spec \
|
||||||
|
$PANDHOME_ENT/pandora_agents/pandora_agent.spec \
|
||||||
$PANDHOME_ENT/pandora_console/enterprise/pandora_console_enterprise.redhat.spec \
|
$PANDHOME_ENT/pandora_console/enterprise/pandora_console_enterprise.redhat.spec \
|
||||||
$PANDHOME_ENT/pandora_console/enterprise/pandora_console_enterprise.rhel7.spec \
|
$PANDHOME_ENT/pandora_console/enterprise/pandora_console_enterprise.rhel7.spec \
|
||||||
$PANDHOME_ENT/pandora_server/PandoraFMS-Enterprise/pandora_server_enterprise.redhat.spec"
|
$PANDHOME_ENT/pandora_server/PandoraFMS-Enterprise/pandora_server_enterprise.redhat.spec"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
package: pandorafms-agent-unix
|
package: pandorafms-agent-unix
|
||||||
Version: 7.0NG.744-200326
|
Version: 7.0NG.744-200408
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: admin
|
Section: admin
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
pandora_version="7.0NG.744-200326"
|
pandora_version="7.0NG.744-200408"
|
||||||
|
|
||||||
echo "Test if you has the tools for to make the packages."
|
echo "Test if you has the tools for to make the packages."
|
||||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||||
@ -79,7 +79,7 @@ cp Linux/pandora_agent.conf temp_package/etc/pandora/
|
|||||||
cp -aRf man/man1/* temp_package/usr/share/man/man1/
|
cp -aRf man/man1/* temp_package/usr/share/man/man1/
|
||||||
|
|
||||||
# Relocate plugins to the final dir and delete
|
# Relocate plugins to the final dir and delete
|
||||||
mv temp_package/usr/share/pandora_agent/plugins/* temp_package/etc/pandora/plugins
|
cp temp_package/usr/share/pandora_agent/plugins/* temp_package/etc/pandora/plugins
|
||||||
|
|
||||||
echo "Official plugins are placed on /etc/pandora/plugins" > temp_package/usr/share/pandora_agent/plugins/README
|
echo "Official plugins are placed on /etc/pandora/plugins" > temp_package/usr/share/pandora_agent/plugins/README
|
||||||
|
|
||||||
|
@ -254,6 +254,9 @@ module_plugin pandora_mem_used
|
|||||||
|
|
||||||
module_plugin pandora_netusage
|
module_plugin pandora_netusage
|
||||||
|
|
||||||
|
# Service autodiscovery plugin
|
||||||
|
module_plugin autodiscover --default
|
||||||
|
|
||||||
# Plugin for inventory on the agent (Only Enterprise)
|
# Plugin for inventory on the agent (Only Enterprise)
|
||||||
#module_plugin inventory 1 cpu ram video nic hd cdrom software init_services filesystem users route
|
#module_plugin inventory 1 cpu ram video nic hd cdrom software init_services filesystem users route
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ my $Sem = undef;
|
|||||||
my $ThreadSem = undef;
|
my $ThreadSem = undef;
|
||||||
|
|
||||||
use constant AGENT_VERSION => '7.0NG.744';
|
use constant AGENT_VERSION => '7.0NG.744';
|
||||||
use constant AGENT_BUILD => '200326';
|
use constant AGENT_BUILD => '200408';
|
||||||
|
|
||||||
# Agent log default file size maximum and instances
|
# Agent log default file size maximum and instances
|
||||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
%define name pandorafms_agent_unix
|
%define name pandorafms_agent_unix
|
||||||
%define version 7.0NG.744
|
%define version 7.0NG.744
|
||||||
%define release 200326
|
%define release 200408
|
||||||
|
|
||||||
Summary: Pandora FMS Linux agent, PERL version
|
Summary: Pandora FMS Linux agent, PERL version
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
%define name pandorafms_agent_unix
|
%define name pandorafms_agent_unix
|
||||||
%define version 7.0NG.744
|
%define version 7.0NG.744
|
||||||
%define release 200326
|
%define release 200408
|
||||||
|
|
||||||
Summary: Pandora FMS Linux agent, PERL version
|
Summary: Pandora FMS Linux agent, PERL version
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
# **********************************************************************
|
# **********************************************************************
|
||||||
|
|
||||||
PI_VERSION="7.0NG.744"
|
PI_VERSION="7.0NG.744"
|
||||||
PI_BUILD="200326"
|
PI_BUILD="200408"
|
||||||
OS_NAME=`uname -s`
|
OS_NAME=`uname -s`
|
||||||
|
|
||||||
FORCE=0
|
FORCE=0
|
||||||
|
BIN
pandora_agents/unix/plugins/autodiscover
Normal file
BIN
pandora_agents/unix/plugins/autodiscover
Normal file
Binary file not shown.
@ -245,6 +245,10 @@ module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\network.vbs"
|
|||||||
#module_crontab * 12-15 * * 1
|
#module_crontab * 12-15 * * 1
|
||||||
#module_end
|
#module_end
|
||||||
|
|
||||||
|
# Service autodiscovery plugin
|
||||||
|
module_plugin "%PROGRAMFILES%\Pandora_Agent\util\autodiscover.exe" --default
|
||||||
|
|
||||||
|
|
||||||
#########################################
|
#########################################
|
||||||
# EXAMPLES #
|
# EXAMPLES #
|
||||||
#########################################
|
#########################################
|
||||||
|
BIN
pandora_agents/win32/bin/util/autodiscover.exe
Normal file
BIN
pandora_agents/win32/bin/util/autodiscover.exe
Normal file
Binary file not shown.
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
Version
|
Version
|
||||||
{200326}
|
{200408}
|
||||||
|
|
||||||
ViewReadme
|
ViewReadme
|
||||||
{Yes}
|
{Yes}
|
||||||
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||||||
using namespace Pandora_Strutils;
|
using namespace Pandora_Strutils;
|
||||||
|
|
||||||
#define PATH_SIZE _MAX_PATH+1
|
#define PATH_SIZE _MAX_PATH+1
|
||||||
#define PANDORA_VERSION ("7.0NG.744(Build 200326)")
|
#define PANDORA_VERSION ("7.0NG.744(Build 200408)")
|
||||||
|
|
||||||
string pandora_path;
|
string pandora_path;
|
||||||
string pandora_dir;
|
string pandora_dir;
|
||||||
|
@ -11,7 +11,7 @@ BEGIN
|
|||||||
VALUE "LegalCopyright", "Artica ST"
|
VALUE "LegalCopyright", "Artica ST"
|
||||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||||
VALUE "ProductVersion", "(7.0NG.744(Build 200326))"
|
VALUE "ProductVersion", "(7.0NG.744(Build 200408))"
|
||||||
VALUE "FileVersion", "1.0.0.0"
|
VALUE "FileVersion", "1.0.0.0"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
package: pandorafms-console
|
package: pandorafms-console
|
||||||
Version: 7.0NG.744-200326
|
Version: 7.0NG.744-200408
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: admin
|
Section: admin
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
pandora_version="7.0NG.744-200326"
|
pandora_version="7.0NG.744-200408"
|
||||||
|
|
||||||
package_pear=0
|
package_pear=0
|
||||||
package_pandora=1
|
package_pandora=1
|
||||||
|
@ -830,14 +830,7 @@ foreach ($modules as $module) {
|
|||||||
$data[4] .= ui_print_help_tip(__('The policy modules of data type will only update their intervals when policy is applied.'), true);
|
$data[4] .= ui_print_help_tip(__('The policy modules of data type will only update their intervals when policy is applied.'), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$data[5] = ui_print_truncate_text($module['descripcion'], 'description', false);
|
||||||
if ($module['id_modulo'] == MODULE_DATA && $module['id_policy_module'] != 0) {
|
|
||||||
$module_description = utf8_decode($module['descripcion']);
|
|
||||||
} else {
|
|
||||||
$module_description = $module['descripcion'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$data[5] = ui_print_truncate_text($module_description, 'description', false);
|
|
||||||
|
|
||||||
$data[6] = ui_print_status_image($status, htmlspecialchars($title), true);
|
$data[6] = ui_print_status_image($status, htmlspecialchars($title), true);
|
||||||
|
|
||||||
|
@ -696,7 +696,7 @@ foreach ($simple_alerts as $alert) {
|
|||||||
$data[3] .= __('Agent');
|
$data[3] .= __('Agent');
|
||||||
$data[3] .= '</td>';
|
$data[3] .= '</td>';
|
||||||
$data[3] .= '<td class="datos">';
|
$data[3] .= '<td class="datos">';
|
||||||
$data[3] .= ui_print_truncate_text($agent_name, 'agent_small', false, true, true, '[…]');
|
$data[3] .= ui_print_truncate_text($alias, 'agent_small', false, true, true, '[…]');
|
||||||
$data[3] .= '</td>';
|
$data[3] .= '</td>';
|
||||||
$data[3] .= '</tr>';
|
$data[3] .= '</tr>';
|
||||||
}
|
}
|
||||||
|
@ -468,12 +468,12 @@ foreach ($info as $user_id => $user_info) {
|
|||||||
|
|
||||||
$data[0] = '<a href="index.php?sec='.$sec.'&sec2=godmode/users/configure_user&pure='.$pure.'&id='.$user_id.'">'.$user_id.'</a>';
|
$data[0] = '<a href="index.php?sec='.$sec.'&sec2=godmode/users/configure_user&pure='.$pure.'&id='.$user_id.'">'.$user_id.'</a>';
|
||||||
$data[1] = '<ul style="margin-top: 0 !important; margin-left: auto !important; padding-left: 10px !important; list-style-type: none !important;">';
|
$data[1] = '<ul style="margin-top: 0 !important; margin-left: auto !important; padding-left: 10px !important; list-style-type: none !important;">';
|
||||||
$data[1] .= '<li><b>'.__('Name').':</b> '.$user_info['fullname'].'</li>';
|
$data[1] .= '<li>'.$user_info['fullname'].'</li>';
|
||||||
/*
|
/*
|
||||||
$data[1] .= '<li><b>' . __('First name') . ':</b> ' . $user_info["firstname"] . '</li>';
|
$data[1] .= '<li><b>' . __('First name') . ':</b> ' . $user_info["firstname"] . '</li>';
|
||||||
$data[1] .= '<li><b>' . __('Last name') . ':</b> ' . $user_info["lastname"] . '</li>';*/
|
$data[1] .= '<li><b>' . __('Last name') . ':</b> ' . $user_info["lastname"] . '</li>';*/
|
||||||
$data[1] .= '<li><b>'.__('Phone').':</b> '.$user_info['phone'].'</li>';
|
$data[1] .= '<li>'.$user_info['phone'].'</li>';
|
||||||
$data[1] .= '<li><b>'.__('E-mail').':</b> '.$user_info['email'].'</li>';
|
$data[1] .= '<li>'.$user_info['email'].'</li>';
|
||||||
$data[1] .= '</ul>';
|
$data[1] .= '</ul>';
|
||||||
$data[2] = ui_print_timestamp($user_info['last_connect'], true);
|
$data[2] = ui_print_timestamp($user_info['last_connect'], true);
|
||||||
|
|
||||||
|
@ -472,7 +472,7 @@ class DiscoveryTaskList extends Wizard
|
|||||||
// Name task.
|
// Name task.
|
||||||
$data[1] = '';
|
$data[1] = '';
|
||||||
if ($task['disabled'] != 2) {
|
if ($task['disabled'] != 2) {
|
||||||
$data[1] .= '<a href="#" onclick="progress_task_list('.$task['id_rt'].',\''.$task['name'].'\')">';
|
$data[1] .= '<a onclick="progress_task_list('.$task['id_rt'].',\''.$task['name'].'\')">';
|
||||||
}
|
}
|
||||||
|
|
||||||
$data[1] .= '<b>'.$task['name'].'</b>';
|
$data[1] .= '<b>'.$task['name'].'</b>';
|
||||||
@ -623,7 +623,7 @@ class DiscoveryTaskList extends Wizard
|
|||||||
&& $task['type'] != DISCOVERY_CLOUD_AWS_RDS
|
&& $task['type'] != DISCOVERY_CLOUD_AWS_RDS
|
||||||
) {
|
) {
|
||||||
if (check_acl($config['id_user'], 0, 'MR')) {
|
if (check_acl($config['id_user'], 0, 'MR')) {
|
||||||
$data[9] .= '<a href="#" onclick="show_map('.$task['id_rt'].',\''.$task['name'].'\')">';
|
$data[9] .= '<a onclick="show_map('.$task['id_rt'].',\''.$task['name'].'\')">';
|
||||||
$data[9] .= html_print_image(
|
$data[9] .= html_print_image(
|
||||||
'images/dynamic_network_icon.png',
|
'images/dynamic_network_icon.png',
|
||||||
true
|
true
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 515 B |
Binary file not shown.
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 515 B |
@ -1004,14 +1004,8 @@ if (check_login()) {
|
|||||||
$data[3] .= ' <a class="relations_details" href="ajax.php?page=operation/agentes/estado_monitores&get_relations_tooltip=1&id_agente_modulo='.$module['id_agente_modulo'].'">'.html_print_image('images/link2.png', true, ['id' => 'relations-details-'.$module['id_agente_modulo'], 'class' => 'img_help']).'</a> ';
|
$data[3] .= ' <a class="relations_details" href="ajax.php?page=operation/agentes/estado_monitores&get_relations_tooltip=1&id_agente_modulo='.$module['id_agente_modulo'].'">'.html_print_image('images/link2.png', true, ['id' => 'relations-details-'.$module['id_agente_modulo'], 'class' => 'img_help']).'</a> ';
|
||||||
}
|
}
|
||||||
|
|
||||||
$module_description = '';
|
|
||||||
if ($module['id_modulo'] == MODULE_DATA && $module['id_policy_module'] != 0) {
|
|
||||||
$module_description = utf8_decode($module['descripcion']);
|
|
||||||
} else {
|
|
||||||
$module_description = $module['descripcion'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$data[4] = ui_print_string_substr($module_description, 60, true, 8);
|
$data[4] = ui_print_string_substr($module['descripcion'], 60, true, 8);
|
||||||
|
|
||||||
|
|
||||||
if ($module['datos'] != strip_tags($module['datos'])) {
|
if ($module['datos'] != strip_tags($module['datos'])) {
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
/**
|
/**
|
||||||
* Pandora build version and version
|
* Pandora build version and version
|
||||||
*/
|
*/
|
||||||
$build_version = 'PC200326';
|
$build_version = 'PC200408';
|
||||||
$pandora_version = 'v7.0NG.744';
|
$pandora_version = 'v7.0NG.744';
|
||||||
|
|
||||||
// Do not overwrite default timezone set if defined.
|
// Do not overwrite default timezone set if defined.
|
||||||
|
File diff suppressed because one or more lines are too long
2
pandora_console/include/ehorus/bundle.min.js
vendored
2
pandora_console/include/ehorus/bundle.min.js
vendored
File diff suppressed because one or more lines are too long
@ -13541,6 +13541,9 @@ function api_get_module_graph($id_module, $thrash2, $other, $thrash4)
|
|||||||
// 1 hour by default.
|
// 1 hour by default.
|
||||||
$graph_threshold = (!empty($other) && isset($other['data'][2]) && $other['data'][2]) ? $other['data'][2] : 0;
|
$graph_threshold = (!empty($other) && isset($other['data'][2]) && $other['data'][2]) ? $other['data'][2] : 0;
|
||||||
|
|
||||||
|
// Graph height when send email by alert
|
||||||
|
$height = (!empty($other) && isset($other['data'][3]) && $other['data'][3]) ? $other['data'][3] : null;
|
||||||
|
|
||||||
if (is_nan($graph_seconds) || $graph_seconds <= 0) {
|
if (is_nan($graph_seconds) || $graph_seconds <= 0) {
|
||||||
// returnError('error_module_graph', __(''));
|
// returnError('error_module_graph', __(''));
|
||||||
return;
|
return;
|
||||||
|
@ -3355,9 +3355,11 @@ function html_print_switch($attributes=[])
|
|||||||
$attributes['style'] = '';
|
$attributes['style'] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$disabled_class .= (bool) ($attributes['disabled']) ? ' p-slider-disabled' : '';
|
||||||
|
|
||||||
return "<label class='p-switch' style='".$attributes['style']."'>
|
return "<label class='p-switch' style='".$attributes['style']."'>
|
||||||
<input type='checkbox' ".$html_expand.">
|
<input type='checkbox' ".$html_expand.">
|
||||||
<span class='p-slider'></span>
|
<span class='p-slider".$disabled_class."'></span>
|
||||||
</label>";
|
</label>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -699,45 +699,6 @@ function notifications_print_global_source_configuration($source)
|
|||||||
$source['id']
|
$source['id']
|
||||||
);
|
);
|
||||||
$html_selectors .= '</div>';
|
$html_selectors .= '</div>';
|
||||||
// Generate the checkboxes and time select.
|
|
||||||
$html_checkboxes = "<div class='global-config-notification-checkboxes'>";
|
|
||||||
$html_checkboxes .= ' <span>';
|
|
||||||
$html_checkboxes .= html_print_checkbox_extended('all-'.$source['id'], 1, $is_group_all, false, '', 'class= "elem-clickable"', true, 'id="nt-'.$source['id'].'-all_users"');
|
|
||||||
$html_checkboxes .= __('Notify all users');
|
|
||||||
$html_checkboxes .= ' </span><br><span>';
|
|
||||||
$html_checkboxes .= html_print_checkbox_extended('mail-'.$source['id'], 1, $source['also_mail'], false, '', 'class= "elem-clickable"', true, 'id="nt-'.$source['id'].'-also_mail"');
|
|
||||||
$html_checkboxes .= __('Also email users with notification content');
|
|
||||||
$html_checkboxes .= ' </span><br><span>';
|
|
||||||
$html_checkboxes .= html_print_checkbox_extended('user-'.$source['id'], 1, $source['user_editable'], false, '', 'class= "elem-clickable"', true, 'id="nt-'.$source['id'].'-user_editable"');
|
|
||||||
$html_checkboxes .= __('Users can modify notification preferences');
|
|
||||||
$html_checkboxes .= ' </span>';
|
|
||||||
$html_checkboxes .= '</div>';
|
|
||||||
|
|
||||||
// Generate the select with the time.
|
|
||||||
$html_select_pospone = __('Users can postpone notifications up to');
|
|
||||||
// FIXMEit should not be disabled.
|
|
||||||
$html_select_pospone .= html_print_select(
|
|
||||||
[
|
|
||||||
SECONDS_5MINUTES => __('5 minutes'),
|
|
||||||
SECONDS_15MINUTES => __('15 minutes'),
|
|
||||||
SECONDS_12HOURS => __('12 hours'),
|
|
||||||
SECONDS_1DAY => __('1 day'),
|
|
||||||
SECONDS_1WEEK => __('1 week'),
|
|
||||||
SECONDS_15DAYS => __('15 days'),
|
|
||||||
SECONDS_1MONTH => __('1 month'),
|
|
||||||
NOTIFICATIONS_POSTPONE_FOREVER => __('forever'),
|
|
||||||
],
|
|
||||||
'nt-'.$source['id'].'-max_postpone_time',
|
|
||||||
$source['max_postpone_time'],
|
|
||||||
'',
|
|
||||||
'',
|
|
||||||
0,
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
true,
|
|
||||||
'elem-changeable',
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
// Return all html.
|
// Return all html.
|
||||||
return $html_title.$html_selectors.$html_checkboxes.$html_select_pospone;
|
return $html_title.$html_selectors.$html_checkboxes.$html_select_pospone;
|
||||||
@ -916,7 +877,7 @@ function notifications_print_two_ways_select($info_selec, $users, $source_id)
|
|||||||
function notifications_print_user_switch($source, $user, $label)
|
function notifications_print_user_switch($source, $user, $label)
|
||||||
{
|
{
|
||||||
$status = notifications_get_user_label_status($source, $user, $label);
|
$status = notifications_get_user_label_status($source, $user, $label);
|
||||||
return html_print_switch(
|
$switch = html_print_switch(
|
||||||
[
|
[
|
||||||
'name' => $label,
|
'name' => $label,
|
||||||
'value' => $status['status'],
|
'value' => $status['status'],
|
||||||
@ -925,6 +886,13 @@ function notifications_print_user_switch($source, $user, $label)
|
|||||||
'id' => 'notifications-user-'.$source['id'].'-label-'.$label,
|
'id' => 'notifications-user-'.$source['id'].'-label-'.$label,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'disabled' => !$status['enabled'],
|
||||||
|
'switch' => $switch,
|
||||||
|
];
|
||||||
|
|
||||||
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -124,16 +124,16 @@ function treeview_printModuleTable($id_module, $server_data=false, $no_head=fals
|
|||||||
$table->data['module_group'] = $row;
|
$table->data['module_group'] = $row;
|
||||||
|
|
||||||
// Description
|
// Description
|
||||||
$module_description = '';
|
|
||||||
if ($module['id_modulo'] == MODULE_DATA && $module['id_policy_module'] != 0) {
|
|
||||||
$module_description = utf8_decode($module['descripcion']);
|
|
||||||
} else {
|
|
||||||
$module_description = $module['descripcion'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$row = [];
|
$row = [];
|
||||||
$row['title'] = __('Description');
|
$row['title'] = __('Description');
|
||||||
$row['data'] = ui_print_truncate_text($module_description, 'description', true, true, true, '[…]');
|
$row['data'] = ui_print_truncate_text(
|
||||||
|
$module['descripcion'];,
|
||||||
|
'description',
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
'[…]'
|
||||||
|
);
|
||||||
$table->data['description'] = $row;
|
$table->data['description'] = $row;
|
||||||
|
|
||||||
// Tags
|
// Tags
|
||||||
|
@ -458,10 +458,19 @@ function pandoraFlotHBars(
|
|||||||
// v, axis;
|
// v, axis;
|
||||||
function xFormatter(v) {
|
function xFormatter(v) {
|
||||||
var label = parseFloat(v);
|
var label = parseFloat(v);
|
||||||
|
|
||||||
|
const unit_prefixes = ["K", "M", "G"];
|
||||||
|
var unit_prefix = "";
|
||||||
|
var i = 0;
|
||||||
|
|
||||||
|
while (label >= 1000 && i < 3) {
|
||||||
|
label = label / 1000;
|
||||||
|
unit_prefix = unit_prefixes[i];
|
||||||
|
i++;
|
||||||
|
}
|
||||||
var text = label.toLocaleString();
|
var text = label.toLocaleString();
|
||||||
if (label >= 1000000) text = text.substring(0, 4) + "M";
|
|
||||||
else if (label >= 100000) text = text.substring(0, 3) + "K";
|
text = text + unit_prefix;
|
||||||
else if (label >= 1000) text = text.substring(0, 2) + "K";
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
'<div style="font-size:' +
|
'<div style="font-size:' +
|
||||||
|
@ -77,6 +77,7 @@ function fetchTaskList(id, callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function show_map(id, name) {
|
function show_map(id, name) {
|
||||||
|
var myPos = ["center" / 2, 1];
|
||||||
$("#map_task")
|
$("#map_task")
|
||||||
.empty()
|
.empty()
|
||||||
.hide()
|
.hide()
|
||||||
@ -86,8 +87,9 @@ function show_map(id, name) {
|
|||||||
resizable: true,
|
resizable: true,
|
||||||
draggable: true,
|
draggable: true,
|
||||||
modal: false,
|
modal: false,
|
||||||
width: 1280,
|
width: 900,
|
||||||
height: 700
|
height: 550,
|
||||||
|
position: { my: "center", at: "center", of: window }
|
||||||
})
|
})
|
||||||
.show();
|
.show();
|
||||||
|
|
||||||
|
@ -4564,6 +4564,10 @@ div#dialog_messages table th:last-child {
|
|||||||
border-radius: 34px;
|
border-radius: 34px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.p-slider-disabled {
|
||||||
|
background-color: #dfdfdf !important;
|
||||||
|
}
|
||||||
|
|
||||||
.p-slider:before {
|
.p-slider:before {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
content: "";
|
content: "";
|
||||||
|
@ -129,7 +129,7 @@
|
|||||||
<div style='height: 10px'>
|
<div style='height: 10px'>
|
||||||
<?php
|
<?php
|
||||||
$version = '7.0NG.744';
|
$version = '7.0NG.744';
|
||||||
$build = '200326';
|
$build = '200408';
|
||||||
$banner = "v$version Build $build";
|
$banner = "v$version Build $build";
|
||||||
|
|
||||||
error_reporting(0);
|
error_reporting(0);
|
||||||
|
@ -176,7 +176,7 @@ $label = db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $id)
|
|||||||
|
|
||||||
|
|
||||||
// Graph.
|
// Graph.
|
||||||
echo '<div style="padding-top: 60px;">';
|
echo '<div style="padding-top: 60px; padding-right: 30px;">';
|
||||||
$width = '90%';
|
$width = '90%';
|
||||||
$height = '450';
|
$height = '450';
|
||||||
|
|
||||||
|
@ -1538,7 +1538,7 @@ if (!empty($result)) {
|
|||||||
|
|
||||||
$graph_params_str = http_build_query($graph_params);
|
$graph_params_str = http_build_query($graph_params);
|
||||||
|
|
||||||
$link = 'winopeng(\''.$url.'?'.$graph_params_str.'\',\''.$win_handle.'\')';
|
$link = 'winopeng_var(\''.$url.'?'.$graph_params_str.'\',\''.$win_handle.'\', 1000, 700)';
|
||||||
|
|
||||||
$data[8] = get_module_realtime_link_graph($row);
|
$data[8] = get_module_realtime_link_graph($row);
|
||||||
|
|
||||||
|
@ -64,7 +64,10 @@ echo '<div id="user-notifications-wrapper" class="white_box table_div table_thre
|
|||||||
<div class="table_th">'.__('Also receive an email').'</div>
|
<div class="table_th">'.__('Also receive an email').'</div>
|
||||||
</div>';
|
</div>';
|
||||||
|
|
||||||
$sources = notifications_get_all_sources();
|
$sources = notifications_get_all_sources();
|
||||||
|
|
||||||
|
$disabled_flag = false;
|
||||||
|
|
||||||
foreach ($sources as $source) {
|
foreach ($sources as $source) {
|
||||||
echo '<div class="table_tbody">';
|
echo '<div class="table_tbody">';
|
||||||
$table_content = [
|
$table_content = [
|
||||||
@ -72,12 +75,24 @@ foreach ($sources as $source) {
|
|||||||
notifications_print_user_switch($source, $id, 'enabled'),
|
notifications_print_user_switch($source, $id, 'enabled'),
|
||||||
notifications_print_user_switch($source, $id, 'also_mail'),
|
notifications_print_user_switch($source, $id, 'also_mail'),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$notifications_enabled = notifications_print_user_switch($source, $id, 'enabled');
|
||||||
|
$notifications_also_mail = notifications_print_user_switch($source, $id, 'also_mail');
|
||||||
|
|
||||||
|
if ($notifications_enabled['disabled'] == 1 || $notifications_also_mail['disabled'] == 1) {
|
||||||
|
$disabled_flag = true;
|
||||||
|
}
|
||||||
|
|
||||||
echo '<div class="table_td">'.$source['description'].'</div>';
|
echo '<div class="table_td">'.$source['description'].'</div>';
|
||||||
echo '<div class="table_td">'.notifications_print_user_switch($source, $id, 'enabled').'</div>';
|
echo '<div class="table_td">'.$notifications_enabled['switch'].'</div>';
|
||||||
echo '<div class="table_td">'.notifications_print_user_switch($source, $id, 'also_mail').'</div>';
|
echo '<div class="table_td">'.$notifications_also_mail['switch'].'</div>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($disabled_flag) {
|
||||||
|
echo '<span style="font-weight: bold; color: #ff0000;">Disabled controls have been set by the system administrator</span>';
|
||||||
|
}
|
||||||
|
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
// Print id user to handle it on js.
|
// Print id user to handle it on js.
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
%define name pandorafms_console
|
%define name pandorafms_console
|
||||||
%define version 7.0NG.744
|
%define version 7.0NG.744
|
||||||
%define release 200326
|
%define release 200408
|
||||||
|
|
||||||
# User and Group under which Apache is running
|
# User and Group under which Apache is running
|
||||||
%define httpd_name httpd
|
%define httpd_name httpd
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
%define name pandorafms_console
|
%define name pandorafms_console
|
||||||
%define version 7.0NG.744
|
%define version 7.0NG.744
|
||||||
%define release 200326
|
%define release 200408
|
||||||
|
|
||||||
# User and Group under which Apache is running
|
# User and Group under which Apache is running
|
||||||
%define httpd_name httpd
|
%define httpd_name httpd
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
%define name pandorafms_console
|
%define name pandorafms_console
|
||||||
%define version 7.0NG.744
|
%define version 7.0NG.744
|
||||||
%define release 200326
|
%define release 200408
|
||||||
%define httpd_name httpd
|
%define httpd_name httpd
|
||||||
# User and Group under which Apache is running
|
# User and Group under which Apache is running
|
||||||
%define httpd_name apache2
|
%define httpd_name apache2
|
||||||
|
398
pandora_plugins/Autodiscover services/autodiscover.py
Normal file
398
pandora_plugins/Autodiscover services/autodiscover.py
Normal file
@ -0,0 +1,398 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
###################################################
|
||||||
|
#
|
||||||
|
# Pandora FMS Autodiscovery plugin.
|
||||||
|
# Checks the status of the services in list and monitors CPU and Memory for each of them.
|
||||||
|
#
|
||||||
|
# (c) A. Kevin Rojas <kevin.rojas@pandorafms.com>
|
||||||
|
#
|
||||||
|
# TO DO LIST:
|
||||||
|
# - Enable child services detection (Windows)
|
||||||
|
# - Make CPU/Memory usage available for child services (Windows)
|
||||||
|
#
|
||||||
|
###################################################
|
||||||
|
|
||||||
|
from sys import argv, path, stderr, exit
|
||||||
|
import psutil
|
||||||
|
from subprocess import *
|
||||||
|
|
||||||
|
global module_list
|
||||||
|
module_list = []
|
||||||
|
|
||||||
|
|
||||||
|
#########################################################################################
|
||||||
|
# Powershell class
|
||||||
|
#########################################################################################
|
||||||
|
class PSCheck:
|
||||||
|
@staticmethod
|
||||||
|
def check_service(servicename, option=False, memcpu=False):
|
||||||
|
"""Check services with powershell by parsing their DisplayName. Returns a dict\
|
||||||
|
list with the name of the service and a boolean with its status.\n
|
||||||
|
Requires service name (case insensitive)."""
|
||||||
|
pscall = Popen(["powershell", "Get-Service", "-Name", "'*"+ str(servicename) + "*'",
|
||||||
|
"|", "Select-Object", "-ExpandProperty", "Name"],
|
||||||
|
stdout=PIPE, stdin=DEVNULL, stderr=DEVNULL, universal_newlines=True)
|
||||||
|
result = pscall.communicate()
|
||||||
|
result = str(result[0]).strip().split("\n")
|
||||||
|
procname = ''
|
||||||
|
if result != '':
|
||||||
|
output = []
|
||||||
|
for element in result:
|
||||||
|
if element != '':
|
||||||
|
# Get process name
|
||||||
|
procname = PSCheck.get_serviceprocess(element)
|
||||||
|
# Get process status
|
||||||
|
parstatus = PSCheck.getstatus(element)
|
||||||
|
if memcpu == True and parstatus == 1:
|
||||||
|
usage = get_memcpu(str(procname), str(element))
|
||||||
|
output += usage
|
||||||
|
# Generate module with name and status
|
||||||
|
parent = service_module(str(element), parstatus)
|
||||||
|
output += parent
|
||||||
|
if option == True:
|
||||||
|
children = PSCheck.getchildren(element, memcpu)
|
||||||
|
if type(children) == list and len(children) > 1:
|
||||||
|
for child in children:
|
||||||
|
output += child
|
||||||
|
else:
|
||||||
|
output += children
|
||||||
|
else:
|
||||||
|
next
|
||||||
|
|
||||||
|
#if output != '':
|
||||||
|
if output and element and procname:
|
||||||
|
return ({"name" : element, "process" : procname, "modules": output})
|
||||||
|
else:
|
||||||
|
return (None)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def getchildren(servicename, memcpu=False):
|
||||||
|
"""Gets Dependent services of a given Windows service"""
|
||||||
|
pschild = Popen(["powershell", "Get-Service", "-Name '" + str(servicename) +
|
||||||
|
"' -DS", "|", "Select-Object", "-ExpandProperty", "Name"],
|
||||||
|
stdout=PIPE, stdin=DEVNULL, stderr=DEVNULL, universal_newlines=True)
|
||||||
|
children = pschild.communicate()[0].strip()
|
||||||
|
kids = []
|
||||||
|
for child in (children.split("\n") if children != "" else []):
|
||||||
|
status = PSCheck.getstatus(child)
|
||||||
|
kids += service_module(str(child), status, "Service " + str(servicename) + " - Status")
|
||||||
|
if status:
|
||||||
|
if memcpu == True:
|
||||||
|
kidsusage = get_memcpu(str(child))
|
||||||
|
for usage in kidsusage:
|
||||||
|
kids += usage
|
||||||
|
else:
|
||||||
|
next
|
||||||
|
return (kids)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def getstatus(servicename):
|
||||||
|
"""Gets the status of a given Windows service"""
|
||||||
|
running = Popen(["powershell", "Get-Service", "-Name '" + str(servicename) +
|
||||||
|
"' |", "Select-Object", "-ExpandProperty", "Status"],
|
||||||
|
stdout=PIPE, stdin=DEVNULL, stderr=DEVNULL, universal_newlines=True)
|
||||||
|
status = running.communicate()[0].strip()
|
||||||
|
return (int(status == "Running"))
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_serviceprocess(servicename):
|
||||||
|
"""Gets name of the process of the service"""
|
||||||
|
service = psutil.win_service_get(servicename)
|
||||||
|
srv_pid = service.pid()
|
||||||
|
process = psutil.Process(srv_pid)
|
||||||
|
proc_name = process.name()
|
||||||
|
return (proc_name)
|
||||||
|
|
||||||
|
|
||||||
|
#########################################################################################
|
||||||
|
# Services creation
|
||||||
|
#########################################################################################
|
||||||
|
|
||||||
|
def service_module(name, value, parent=None):
|
||||||
|
#print ("service_module BEGIN "+str(now(0,1)))
|
||||||
|
module = [{
|
||||||
|
"name" : "Service "+ name + " - Status",
|
||||||
|
"type" : "generic_proc",
|
||||||
|
"value" : value,
|
||||||
|
"module_parent" : parent,
|
||||||
|
}]
|
||||||
|
#print ("service_module END "+str(now(0,1)))
|
||||||
|
return (module)
|
||||||
|
|
||||||
|
def get_memcpu (process, servicename):
|
||||||
|
"""Creates a module for Memory and CPU for a given process. Returns a list of dictionaries."""
|
||||||
|
modules = []
|
||||||
|
if process:
|
||||||
|
if servicename != None:
|
||||||
|
parentname = servicename
|
||||||
|
else:
|
||||||
|
parentname = process
|
||||||
|
modules += [{
|
||||||
|
"name" : "Service "+ process + " - Memory usage",
|
||||||
|
"type" : "generic_data",
|
||||||
|
"value" : proc_percentbyname(process)[0],
|
||||||
|
"unit" : "%",
|
||||||
|
"module_parent" : "Service "+ parentname + " - Status",
|
||||||
|
},
|
||||||
|
{"name" : "Service "+ process + " - CPU usage",
|
||||||
|
"type" : "generic_data",
|
||||||
|
"value" : proc_percentbyname(process)[1],
|
||||||
|
"unit" : "%",
|
||||||
|
"module_parent" : "Service "+ parentname + " - Status",
|
||||||
|
}]
|
||||||
|
return (modules)
|
||||||
|
|
||||||
|
def proc_percentbyname(procname): ############# 03/03/2020
|
||||||
|
"""Gets Memory and CPU usage for a given process. Returns a list."""
|
||||||
|
#print ("proc_percentbyname BEGIN "+str(now(0,1)))
|
||||||
|
procs = [p for p in psutil.process_iter() if procname in p.name().lower()]
|
||||||
|
memory = []
|
||||||
|
cpu = []
|
||||||
|
try:
|
||||||
|
for proc in procs:
|
||||||
|
if proc.name() == procname:
|
||||||
|
cpu.append(proc.cpu_percent(interval=0.5))
|
||||||
|
memory.append(proc.memory_percent())
|
||||||
|
else:
|
||||||
|
next
|
||||||
|
except psutil.NoSuchProcess:
|
||||||
|
next
|
||||||
|
#print ("proc_percentbyname END "+str(now(0,1)))
|
||||||
|
return ([sum(memory),sum(cpu)])
|
||||||
|
|
||||||
|
def win_service(servicelist, option=False, memcpu=False):
|
||||||
|
"""Creates modules for Windows servers."""
|
||||||
|
modules = []
|
||||||
|
for srvc in servicelist:
|
||||||
|
if srvc and len(srvc) > 2:
|
||||||
|
output = PSCheck.check_service(srvc, option, memcpu)
|
||||||
|
if output != None and output["modules"]:
|
||||||
|
modules += PSCheck.check_service(srvc.strip(), option, memcpu)["modules"]
|
||||||
|
module_list.append(srvc)
|
||||||
|
winprocess = output["name"]
|
||||||
|
#if memcpu == True:
|
||||||
|
# modules += get_memcpu(winprocess) ## Only available for parent service ATM.
|
||||||
|
else:
|
||||||
|
next
|
||||||
|
else:
|
||||||
|
next
|
||||||
|
for module in modules:
|
||||||
|
print_module(module, 1)
|
||||||
|
|
||||||
|
|
||||||
|
def lnx_service(services_list, memcpu=False):
|
||||||
|
"""Creates modules for Linux servers"""
|
||||||
|
modules = []
|
||||||
|
sysctl = getstatusoutput("command -v systemctl")[0]
|
||||||
|
servic = getstatusoutput("command -v service")[0]
|
||||||
|
for srvc in services_list:
|
||||||
|
status = None
|
||||||
|
if sysctl == 0:
|
||||||
|
### Systemd available
|
||||||
|
syscall = Popen(["systemctl", "is-active", srvc], stdout=PIPE,
|
||||||
|
stdin=DEVNULL, universal_newlines=True)
|
||||||
|
result = syscall.communicate()
|
||||||
|
result = result[0].strip().lower()
|
||||||
|
if result == "active":
|
||||||
|
modules += service_module(srvc, 1)
|
||||||
|
status = 1
|
||||||
|
elif result == "inactive":
|
||||||
|
modules += service_module(srvc, 0)
|
||||||
|
status = 0
|
||||||
|
elif result == "unknown":
|
||||||
|
next
|
||||||
|
elif sysctl != 0 and servic == 0:
|
||||||
|
### Systemd not available, switch to service command
|
||||||
|
syscall = Popen(["service", srvc, "status"], stdout=PIPE,
|
||||||
|
stdin=DEVNULL, stderr=DEVNULL, universal_newlines=True)
|
||||||
|
result = syscall.communicate()[0].lower()
|
||||||
|
if "is running" in result:
|
||||||
|
modules += service_module(srvc, 1)
|
||||||
|
status = 1
|
||||||
|
elif "is stopped" in result:
|
||||||
|
modules += service_module(srvc, 0)
|
||||||
|
status = 0
|
||||||
|
else:
|
||||||
|
next
|
||||||
|
else:
|
||||||
|
print ("No systemd or service commands available. Exiting...", file=stderr)
|
||||||
|
exit()
|
||||||
|
if status:
|
||||||
|
module_list.append(srvc)
|
||||||
|
if memcpu == True:
|
||||||
|
modules += get_memcpu(srvc, None)
|
||||||
|
|
||||||
|
for m in modules:
|
||||||
|
print_module (m, 1)
|
||||||
|
|
||||||
|
|
||||||
|
#########################################################################################
|
||||||
|
# print_module function
|
||||||
|
#########################################################################################
|
||||||
|
def print_module(module, str_flag=False):
|
||||||
|
"""Returns module in XML format. Accepts only {dict}.\n
|
||||||
|
+ Only works with one module at a time: otherwise iteration is needed.
|
||||||
|
+ Module "value" field accepts str type or [list] for datalists.
|
||||||
|
+ Use not_print_flag to avoid printing the XML (only populates variables).
|
||||||
|
"""
|
||||||
|
data = dict(module)
|
||||||
|
module_xml = ("<module>\n"
|
||||||
|
"\t<name><![CDATA[" + str(data["name"]) + "]]></name>\n"
|
||||||
|
"\t<type>" + str(data["type"]) + "</type>\n"
|
||||||
|
)
|
||||||
|
#### Strip spaces if module not generic_data_string
|
||||||
|
if type(data["type"]) is not str and "string" not in data["type"]:
|
||||||
|
data["value"] = data["value"].strip()
|
||||||
|
if isinstance(data["value"], list): # Checks if value is a list
|
||||||
|
module_xml += "\t<datalist>\n"
|
||||||
|
for value in data["value"]:
|
||||||
|
if type(value) is dict and "value" in value:
|
||||||
|
module_xml += "\t<data>\n"
|
||||||
|
module_xml += "\t\t<value><![CDATA[" + str(value["value"]) + "]]></value>\n"
|
||||||
|
if "timestamp" in value:
|
||||||
|
module_xml += "\t\t<timestamp><![CDATA[" + str(value["timestamp"]) + "]]></timestamp>\n"
|
||||||
|
module_xml += "\t</data>\n"
|
||||||
|
else:
|
||||||
|
module_xml += "\t<data><![CDATA[" + str(data["value"]) + "]]></data>\n"
|
||||||
|
if "desc" in data:
|
||||||
|
module_xml += "\t<description><![CDATA[" + str(data["desc"]) + "]]></description>\n"
|
||||||
|
if "unit" in data:
|
||||||
|
module_xml += "\t<unit><![CDATA[" + str(data["unit"]) + "]]></unit>\n"
|
||||||
|
if "interval" in data:
|
||||||
|
module_xml += "\t<module_interval><![CDATA[" + str(data["interval"]) + "]]></module_interval>\n"
|
||||||
|
if "tags" in data:
|
||||||
|
module_xml += "\t<tags>" + str(data["tags"]) + "</tags>\n"
|
||||||
|
if "module_group" in data:
|
||||||
|
module_xml += "\t<module_group>" + str(data["module_group"]) + "</module_group>\n"
|
||||||
|
if "module_parent" in data and data["module_parent"] != None:
|
||||||
|
module_xml += "\t<module_parent>" + str(data["module_parent"]) + "</module_parent>\n"
|
||||||
|
if "min_warning" in data:
|
||||||
|
module_xml += "\t<min_warning><![CDATA[" + str(data["min_warning"]) + "]]></min_warning>\n"
|
||||||
|
if "max_warning" in data:
|
||||||
|
module_xml += "\t<max_warning><![CDATA[" + str(data["max_warning"]) + "]]></max_warning>\n"
|
||||||
|
if "min_critical" in data:
|
||||||
|
module_xml += "\t<min_critical><![CDATA[" + str(data["min_critical"]) + "]]></min_critical>\n"
|
||||||
|
if "max_critical" in data:
|
||||||
|
module_xml += "\t<max_critical><![CDATA[" + str(data["max_critical"]) + "]]></max_critical>\n"
|
||||||
|
if "str_warning" in data:
|
||||||
|
module_xml += "\t<str_warning><![CDATA[" + str(data["str_warning"]) + "]]></str_warning>\n"
|
||||||
|
if "str_critical" in data:
|
||||||
|
module_xml += "\t<str_critical><![CDATA[" + str(data["str_critical"]) + "]]></str_critical>\n"
|
||||||
|
if "critical_inverse" in data:
|
||||||
|
module_xml += "\t<critical_inverse><![CDATA[" + str(data["critical_inverse"]) + "]]></critical_inverse>\n"
|
||||||
|
if "warning_inverse" in data:
|
||||||
|
module_xml += "\t<warning_inverse><![CDATA[" + str(data["warning_inverse"]) + "]]></warning_inverse>\n"
|
||||||
|
if "max" in data:
|
||||||
|
module_xml += "\t<max><![CDATA[" + str(data["max"]) + "]]></max>\n"
|
||||||
|
if "min" in data:
|
||||||
|
module_xml += "\t<min><![CDATA[" + str(data["min"]) + "]]></min>\n"
|
||||||
|
if "post_process" in data:
|
||||||
|
module_xml += "\t<post_process><![CDATA[" + str(data["post_process"]) + "]]></post_process>\n"
|
||||||
|
if "disabled" in data:
|
||||||
|
module_xml += "\t<disabled><![CDATA[" + str(data["disabled"]) + "]]></disabled>\n"
|
||||||
|
if "min_ff_event" in data:
|
||||||
|
module_xml += "\t<min_ff_event><![CDATA[" + str(data["min_ff_event"]) + "]]></min_ff_event>\n"
|
||||||
|
if "status" in data:
|
||||||
|
module_xml += "\t<status><![CDATA[" + str(data["status"]) + "]]></status>\n"
|
||||||
|
if "timestamp" in data:
|
||||||
|
module_xml += "\t<timestamp><![CDATA[" + str(data["timestamp"]) + "]]></timestamp>\n"
|
||||||
|
if "custom_id" in data:
|
||||||
|
module_xml += "\t<custom_id><![CDATA[" + str(data["custom_id"]) + "]]></custom_id>\n"
|
||||||
|
if "critical_instructions" in data:
|
||||||
|
module_xml += "\t<critical_instructions><![CDATA[" + str(data["critical_instructions"]) + "]]></critical_instructions>\n"
|
||||||
|
if "warning_instructions" in data:
|
||||||
|
module_xml += "\t<warning_instructions><![CDATA[" + str(data["warning_instructions"]) + "]]></warning_instructions>\n"
|
||||||
|
if "unknown_instructions" in data:
|
||||||
|
module_xml += "\t<unknown_instructions><![CDATA[" + str(data["unknown_instructions"]) + "]]></unknown_instructions>\n"
|
||||||
|
if "quiet" in data:
|
||||||
|
module_xml += "\t<quiet><![CDATA[" + str(data["quiet"]) + "]]></quiet>\n"
|
||||||
|
if "module_ff_interval" in data:
|
||||||
|
module_xml += "\t<module_ff_interval><![CDATA[" + str(data["module_ff_interval"]) + "]]></module_ff_interval>\n"
|
||||||
|
if "crontab" in data:
|
||||||
|
module_xml += "\t<crontab><![CDATA[" + str(data["crontab"]) + "]]></crontab>\n"
|
||||||
|
if "min_ff_event_normal" in data:
|
||||||
|
module_xml += "\t<min_ff_event_normal><![CDATA[" + str(data["min_ff_event_normal"]) + "]]></min_ff_event_normal>\n"
|
||||||
|
if "min_ff_event_warning" in data:
|
||||||
|
module_xml += "\t<min_ff_event_warning><![CDATA[" + str(data["min_ff_event_warning"]) + "]]></min_ff_event_warning>\n"
|
||||||
|
if "min_ff_event_critical" in data:
|
||||||
|
module_xml += "\t<min_ff_event_critical><![CDATA[" + str(data["min_ff_event_critical"]) + "]]></min_ff_event_critical>\n"
|
||||||
|
if "ff_type" in data:
|
||||||
|
module_xml += "\t<ff_type><![CDATA[" + str(data["ff_type"]) + "]]></ff_type>\n"
|
||||||
|
if "ff_timeout" in data:
|
||||||
|
module_xml += "\t<ff_timeout><![CDATA[" + str(data["ff_timeout"]) + "]]></ff_timeout>\n"
|
||||||
|
if "each_ff" in data:
|
||||||
|
module_xml += "\t<each_ff><![CDATA[" + str(data["each_ff"]) + "]]></each_ff>\n"
|
||||||
|
if "module_parent_unlink" in data:
|
||||||
|
module_xml += "\t<module_parent_unlink><![CDATA[" + str(data["parent_unlink"]) + "]]></module_parent_unlink>\n"
|
||||||
|
if "global_alerts" in data:
|
||||||
|
for alert in data["alert"]:
|
||||||
|
module_xml += "\t<alert_template><![CDATA[" + alert + "]]></alert_template>\n"
|
||||||
|
module_xml += "</module>\n"
|
||||||
|
|
||||||
|
#### Print flag
|
||||||
|
if str_flag is not False:
|
||||||
|
print (module_xml)
|
||||||
|
|
||||||
|
return (module_xml)
|
||||||
|
|
||||||
|
|
||||||
|
#########################################################################################
|
||||||
|
# MAIN
|
||||||
|
#########################################################################################
|
||||||
|
|
||||||
|
def main():
|
||||||
|
"""Checks OS and calls the discover function."""
|
||||||
|
if psutil.WINDOWS:
|
||||||
|
OS = "Windows"
|
||||||
|
service_list = ["MySQL", "postgresql", "pgsql", "oracle", "MSSQL", "IISADMIN",
|
||||||
|
"apache", "nginx", "W3svc", "NTDS", "Netlogon", "DNS", "MSExchangeADTopology",
|
||||||
|
"MSExchangeServiceHost", "MSExchangeSA", "MSExchangeTransport"]
|
||||||
|
discover(OS, service_list)
|
||||||
|
elif psutil.LINUX:
|
||||||
|
OS = "Linux"
|
||||||
|
service_list = ["httpd", "apache2", "nginx", "ldap", "docker",
|
||||||
|
"postfix", "mysqld", "postgres", "oracle", "mongod"]
|
||||||
|
discover(OS, service_list)
|
||||||
|
else:
|
||||||
|
print ("OS not recognized. Exiting...", file=stderr)
|
||||||
|
exit()
|
||||||
|
|
||||||
|
def discover(osyst, servicelist):
|
||||||
|
"""Shows help and triggers the creation of service modules"""
|
||||||
|
if "--usage" in argv:
|
||||||
|
memcpu = True
|
||||||
|
else:
|
||||||
|
memcpu = False
|
||||||
|
if len(argv) > 2 and argv[1] == "--list":
|
||||||
|
servicelist = argv[2].split(",")
|
||||||
|
if osyst == "Windows":
|
||||||
|
win_service(servicelist, False, memcpu) ## False won't get children
|
||||||
|
elif osyst == "Linux":
|
||||||
|
lnx_service(servicelist, memcpu)
|
||||||
|
elif len(argv) > 1 and argv[1] == "--default":
|
||||||
|
if osyst == "Windows":
|
||||||
|
win_service(servicelist, False, memcpu) ## False won't get children
|
||||||
|
elif osyst == "Linux":
|
||||||
|
lnx_service(servicelist, memcpu)
|
||||||
|
else:
|
||||||
|
print ("\nPandora FMS Autodiscovery plugin.")
|
||||||
|
print ("Checks the status of the services in list and monitors CPU and Memory for each of them.\n")
|
||||||
|
print ("Usage:")
|
||||||
|
print ("{} [options] [--usage]".format(argv[0]))
|
||||||
|
print ("--help")
|
||||||
|
print ("\tPrints this help screen")
|
||||||
|
print ("--default")
|
||||||
|
print ("\tRuns this tool with default monitoring.".format(argv[0]))
|
||||||
|
print ("\tServices monitored by default for {}:".format(osyst))
|
||||||
|
print ("\t",", ".join(servicelist))
|
||||||
|
print ("--list \"<srvc1,srvc2,srvc3>\"")
|
||||||
|
print ("\tReplaces default services for a given list (comma-separated)")
|
||||||
|
if osyst == "Windows":
|
||||||
|
print ("\tEach element of the list will be treated as a regexp, but they must be over 2 characters.")
|
||||||
|
print ("\tElements under 2 characters will be discarded.")
|
||||||
|
print ("--usage")
|
||||||
|
print ("\tAdds modules for CPU and Memory usage per service/process (optional, can take some time).\n")
|
||||||
|
|
||||||
|
|
||||||
|
##### RUN ####
|
||||||
|
main()
|
@ -1,5 +1,5 @@
|
|||||||
package: pandorafms-server
|
package: pandorafms-server
|
||||||
Version: 7.0NG.744-200326
|
Version: 7.0NG.744-200408
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: admin
|
Section: admin
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
pandora_version="7.0NG.744-200326"
|
pandora_version="7.0NG.744-200408"
|
||||||
|
|
||||||
package_cpan=0
|
package_cpan=0
|
||||||
package_pandora=1
|
package_pandora=1
|
||||||
|
@ -45,7 +45,7 @@ our @EXPORT = qw(
|
|||||||
|
|
||||||
# version: Defines actual version of Pandora Server for this module only
|
# version: Defines actual version of Pandora Server for this module only
|
||||||
my $pandora_version = "7.0NG.744";
|
my $pandora_version = "7.0NG.744";
|
||||||
my $pandora_build = "200326";
|
my $pandora_build = "200408";
|
||||||
our $VERSION = $pandora_version." ".$pandora_build;
|
our $VERSION = $pandora_version." ".$pandora_build;
|
||||||
|
|
||||||
# Setup hash
|
# Setup hash
|
||||||
|
@ -631,8 +631,9 @@ Process an alert given the status returned by pandora_evaluate_alert.
|
|||||||
|
|
||||||
=cut
|
=cut
|
||||||
##########################################################################
|
##########################################################################
|
||||||
sub pandora_process_alert ($$$$$$$$;$) {
|
sub pandora_process_alert ($$$$$$$$;$$) {
|
||||||
my ($pa_config, $data, $agent, $module, $alert, $rc, $dbh, $timestamp, $extra_macros) = @_;
|
my ($pa_config, $data, $agent, $module, $alert, $rc, $dbh, $timestamp,
|
||||||
|
$extra_macros, $is_correlated_alert) = @_;
|
||||||
|
|
||||||
if (defined ($agent)) {
|
if (defined ($agent)) {
|
||||||
logger ($pa_config, "Processing alert '" . safe_output($alert->{'name'}) . "' for agent '" . safe_output($agent->{'nombre'}) . "': " . (defined ($AlertStatus[$rc]) ? $AlertStatus[$rc] : 'Unknown status') . ".", 10);
|
logger ($pa_config, "Processing alert '" . safe_output($alert->{'name'}) . "' for agent '" . safe_output($agent->{'nombre'}) . "': " . (defined ($AlertStatus[$rc]) ? $AlertStatus[$rc] : 'Unknown status') . ".", 10);
|
||||||
@ -738,7 +739,8 @@ sub pandora_process_alert ($$$$$$$$;$) {
|
|||||||
last_fired = ?, internal_counter = ? ' . $new_interval . ' WHERE id = ?',
|
last_fired = ?, internal_counter = ? ' . $new_interval . ' WHERE id = ?',
|
||||||
$alert->{'times_fired'}, $utimestamp, $alert->{'internal_counter'}, $id);
|
$alert->{'times_fired'}, $utimestamp, $alert->{'internal_counter'}, $id);
|
||||||
|
|
||||||
pandora_execute_alert ($pa_config, $data, $agent, $module, $alert, 1, $dbh, $timestamp, 0, $extra_macros);
|
pandora_execute_alert ($pa_config, $data, $agent, $module, $alert, 1,
|
||||||
|
$dbh, $timestamp, 0, $extra_macros, $is_correlated_alert);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -750,9 +752,10 @@ Execute the given alert.
|
|||||||
|
|
||||||
=cut
|
=cut
|
||||||
##########################################################################
|
##########################################################################
|
||||||
sub pandora_execute_alert ($$$$$$$$$;$) {
|
sub pandora_execute_alert ($$$$$$$$$;$$) {
|
||||||
my ($pa_config, $data, $agent, $module,
|
my ($pa_config, $data, $agent, $module,
|
||||||
$alert, $alert_mode, $dbh, $timestamp, $forced_alert, $extra_macros) = @_;
|
$alert, $alert_mode, $dbh, $timestamp, $forced_alert,
|
||||||
|
$extra_macros, $is_correlated_alert) = @_;
|
||||||
|
|
||||||
# 'in-process' events can inhibit alers too.
|
# 'in-process' events can inhibit alers too.
|
||||||
if ($pa_config->{'event_inhibit_alerts'} == 1 && $alert_mode != RECOVERED_ALERT) {
|
if ($pa_config->{'event_inhibit_alerts'} == 1 && $alert_mode != RECOVERED_ALERT) {
|
||||||
@ -920,9 +923,50 @@ sub pandora_execute_alert ($$$$$$$$$;$) {
|
|||||||
#If we've spotted an alert recovered, we set the new event's severity to 2 (NORMAL), otherwise the original value is maintained.
|
#If we've spotted an alert recovered, we set the new event's severity to 2 (NORMAL), otherwise the original value is maintained.
|
||||||
my ($text, $event, $severity) = ($alert_mode == RECOVERED_ALERT) ? ('recovered', 'alert_recovered', 2) : ('fired', 'alert_fired', $alert->{'priority'});
|
my ($text, $event, $severity) = ($alert_mode == RECOVERED_ALERT) ? ('recovered', 'alert_recovered', 2) : ('fired', 'alert_fired', $alert->{'priority'});
|
||||||
|
|
||||||
pandora_event ($pa_config, "Alert $text (" . safe_output($alert->{'name'}) . ") " . (defined ($module) ? 'assigned to ('. safe_output($module->{'nombre'}) . ")" : ""),
|
if (defined($is_correlated_alert) && $is_correlated_alert == 1) {
|
||||||
(defined ($agent) ? $agent->{'id_grupo'} : 0), (defined ($agent) ? $agent->{'id_agente'} : 0), $severity, (defined ($alert->{'id_template_module'}) ? $alert->{'id_template_module'} : 0),
|
$text = "Correlated alert $text";
|
||||||
(defined ($alert->{'id_agent_module'}) ? $alert->{'id_agent_module'} : 0), $event, 0, $dbh, 'monitoring_server', '', '', '', '', $critical_instructions, $warning_instructions, $unknown_instructions);
|
pandora_event (
|
||||||
|
$pa_config,
|
||||||
|
"$text (" . safe_output($alert->{'name'}) . ") " . (defined ($module) ? 'assigned to ('. safe_output($module->{'nombre'}) . ")" : ""),
|
||||||
|
(defined ($agent) ? $agent->{'id_grupo'} : 0),
|
||||||
|
(defined ($agent) ? $agent->{'id_agente'} : 0),
|
||||||
|
$severity,
|
||||||
|
(defined ($alert->{'id_template_module'}) ? $alert->{'id_template_module'} : 0),
|
||||||
|
(defined ($alert->{'id_agent_module'}) ? $alert->{'id_agent_module'} : 0),
|
||||||
|
$event,
|
||||||
|
0,
|
||||||
|
$dbh,
|
||||||
|
'monitoring_server',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
$critical_instructions,
|
||||||
|
$warning_instructions,
|
||||||
|
$unknown_instructions
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
pandora_event (
|
||||||
|
$pa_config,
|
||||||
|
"$text (" . safe_output($alert->{'name'}) . ") " . (defined ($module) ? 'assigned to ('. safe_output($module->{'nombre'}) . ")" : ""),
|
||||||
|
(defined ($agent) ? $agent->{'id_grupo'} : 0),
|
||||||
|
(defined ($agent) ? $agent->{'id_agente'} : 0),
|
||||||
|
$severity,
|
||||||
|
(defined ($alert->{'id_template_module'}) ? $alert->{'id_template_module'} : 0),
|
||||||
|
(defined ($alert->{'id_agent_module'}) ? $alert->{'id_agent_module'} : 0),
|
||||||
|
$event,
|
||||||
|
0,
|
||||||
|
$dbh,
|
||||||
|
'monitoring_server',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
$critical_instructions,
|
||||||
|
$warning_instructions,
|
||||||
|
$unknown_instructions
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1269,11 +1313,11 @@ sub pandora_execute_action ($$$$$$$$$;$) {
|
|||||||
my $threshold = shift;
|
my $threshold = shift;
|
||||||
my $period = $hours * 3600; # Hours to seconds
|
my $period = $hours * 3600; # Hours to seconds
|
||||||
if($threshold == 0){
|
if($threshold == 0){
|
||||||
$params->{"other"} = $period . '%7C0%7C0';
|
$params->{"other"} = $period . '%7C0%7C0%7C225';
|
||||||
$cid = 'module_graph_' . $hours . 'h';
|
$cid = 'module_graph_' . $hours . 'h';
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$params->{"other"} = $period . '%7C0%7C1';
|
$params->{"other"} = $period . '%7C0%7C1%7C225';
|
||||||
$cid = 'module_graphth_' . $hours . 'h';
|
$cid = 'module_graphth_' . $hours . 'h';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3910,7 +3954,7 @@ sub pandora_evaluate_snmp_alerts ($$$$$$$$$) {
|
|||||||
'direccion' => $trap_agent,
|
'direccion' => $trap_agent,
|
||||||
'comentarios' => '',
|
'comentarios' => '',
|
||||||
'id_agente' => 0,
|
'id_agente' => 0,
|
||||||
'id_grupo' => 0
|
'id_grupo' => $alert->{'id_group'}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ our @ISA = qw(Exporter);
|
|||||||
|
|
||||||
# version: Defines actual version of Pandora Server for this module only
|
# version: Defines actual version of Pandora Server for this module only
|
||||||
my $pandora_version = "7.0NG.744";
|
my $pandora_version = "7.0NG.744";
|
||||||
my $pandora_build = "200326";
|
my $pandora_build = "200408";
|
||||||
our $VERSION = $pandora_version." ".$pandora_build;
|
our $VERSION = $pandora_version." ".$pandora_build;
|
||||||
|
|
||||||
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
%define name pandorafms_server
|
%define name pandorafms_server
|
||||||
%define version 7.0NG.744
|
%define version 7.0NG.744
|
||||||
%define release 200326
|
%define release 200408
|
||||||
|
|
||||||
Summary: Pandora FMS Server
|
Summary: Pandora FMS Server
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
%define name pandorafms_server
|
%define name pandorafms_server
|
||||||
%define version 7.0NG.744
|
%define version 7.0NG.744
|
||||||
%define release 200326
|
%define release 200408
|
||||||
|
|
||||||
Summary: Pandora FMS Server
|
Summary: Pandora FMS Server
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
# **********************************************************************
|
# **********************************************************************
|
||||||
|
|
||||||
PI_VERSION="7.0NG.744"
|
PI_VERSION="7.0NG.744"
|
||||||
PI_BUILD="200326"
|
PI_BUILD="200408"
|
||||||
|
|
||||||
MODE=$1
|
MODE=$1
|
||||||
if [ $# -gt 1 ]; then
|
if [ $# -gt 1 ]; then
|
||||||
|
@ -35,7 +35,7 @@ use PandoraFMS::Config;
|
|||||||
use PandoraFMS::DB;
|
use PandoraFMS::DB;
|
||||||
|
|
||||||
# version: define current version
|
# version: define current version
|
||||||
my $version = "7.0NG.744 PS200326";
|
my $version = "7.0NG.744 PS200408";
|
||||||
|
|
||||||
# Pandora server configuration
|
# Pandora server configuration
|
||||||
my %conf;
|
my %conf;
|
||||||
@ -402,16 +402,11 @@ sub pandora_purgedb ($$) {
|
|||||||
log_message ('PURGE', 'netflow_max_lifetime is set to 0. Old netflow data will not be deleted.');
|
log_message ('PURGE', 'netflow_max_lifetime is set to 0. Old netflow data will not be deleted.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Delete old log data
|
# Delete old log data
|
||||||
log_message ('PURGE', "Deleting old log data.");
|
log_message ('PURGE', "Deleting old log data.");
|
||||||
if (!defined ($conf->{'logstash_host'}) || $conf->{'logstash_host'} eq '') {
|
if (defined($conf->{'_days_purge_old_information'}) && $conf->{'_days_purge_old_information'} > 0) {
|
||||||
log_message ('!', "Log collection disabled.");
|
|
||||||
}
|
|
||||||
elsif (defined($conf->{'_days_purge_old_information'}) && $conf->{'_days_purge_old_information'} > 0) {
|
|
||||||
log_message ('PURGE', 'Deleting log data older than ' . $conf->{'_days_purge_old_information'} . ' days.');
|
log_message ('PURGE', 'Deleting log data older than ' . $conf->{'_days_purge_old_information'} . ' days.');
|
||||||
enterprise_hook ('pandora_purge_logs', [$dbh, $conf]);
|
enterprise_hook ('pandora_purge_logs', [$dbh, $conf]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log_message ('PURGE', 'days_purge_old_data is set to 0. Old log data will not be deleted.');
|
log_message ('PURGE', 'days_purge_old_data is set to 0. Old log data will not be deleted.');
|
||||||
|
@ -36,7 +36,7 @@ use Encode::Locale;
|
|||||||
Encode::Locale::decode_argv;
|
Encode::Locale::decode_argv;
|
||||||
|
|
||||||
# version: define current version
|
# version: define current version
|
||||||
my $version = "7.0NG.744 PS200326";
|
my $version = "7.0NG.744 PS200408";
|
||||||
|
|
||||||
# save program name for logging
|
# save program name for logging
|
||||||
my $progname = basename($0);
|
my $progname = basename($0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user