Merge branch 'ent-11363-automonitoring-alertserver' into 'develop'
Ent-11363-automonitoring-alertserver Closes pandora_enterprise#11363 See merge request artica/pandorafms!6406
This commit is contained in:
commit
83732250da
|
@ -316,6 +316,8 @@ class Diagnostics extends Wizard
|
||||||
* Graph of the Free Disk Spool Dir module.
|
* Graph of the Free Disk Spool Dir module.
|
||||||
* Graph of the Free RAM module.
|
* Graph of the Free RAM module.
|
||||||
* Graph of the Queued Modules module.
|
* Graph of the Queued Modules module.
|
||||||
|
* Graph of the Queued_Alerts.
|
||||||
|
* Graph of the Alert_Server_Status.
|
||||||
* Graph of the Status module.
|
* Graph of the Status module.
|
||||||
* Graph of the System Load AVG module.
|
* Graph of the System Load AVG module.
|
||||||
* Graph of the Execution Time module.
|
* Graph of the Execution Time module.
|
||||||
|
@ -366,6 +368,20 @@ class Diagnostics extends Wizard
|
||||||
'nameModule' => 'Queued_Modules',
|
'nameModule' => 'Queued_Modules',
|
||||||
'idAgent' => $agentIdMasterServer,
|
'idAgent' => $agentIdMasterServer,
|
||||||
],
|
],
|
||||||
|
'chartQueuedAlerts' => [
|
||||||
|
'title' => __(
|
||||||
|
'Graph of the Queued Alerts total.'
|
||||||
|
),
|
||||||
|
'nameModule' => 'Queued_Alerts',
|
||||||
|
'idAgent' => $agentIdMasterServer,
|
||||||
|
],
|
||||||
|
'chartAlertServerStatus' => [
|
||||||
|
'title' => __(
|
||||||
|
'Graph of the Alert Server Status.'
|
||||||
|
),
|
||||||
|
'nameModule' => 'Alert_Server_Status',
|
||||||
|
'idAgent' => $agentIdMasterServer,
|
||||||
|
],
|
||||||
'chartStatus' => [
|
'chartStatus' => [
|
||||||
'title' => __('Graph of the Status module.'),
|
'title' => __('Graph of the Status module.'),
|
||||||
'nameModule' => 'Status',
|
'nameModule' => 'Status',
|
||||||
|
|
|
@ -8,6 +8,7 @@ use POSIX qw(strftime);
|
||||||
use PandoraFMS::DB;
|
use PandoraFMS::DB;
|
||||||
|
|
||||||
use constant DATASERVER => 0;
|
use constant DATASERVER => 0;
|
||||||
|
use constant ALERTSERVER => 21;
|
||||||
use Scalar::Util qw(looks_like_number);
|
use Scalar::Util qw(looks_like_number);
|
||||||
|
|
||||||
|
|
||||||
|
@ -160,6 +161,18 @@ sub pandora_self_monitoring ($$) {
|
||||||
$queued_modules = 0;
|
$queued_modules = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my $queued_alerts = get_db_value ($dbh, "SELECT count(id) FROM talert_execution_queue");
|
||||||
|
|
||||||
|
if (!defined($queued_alerts)) {
|
||||||
|
$queued_alerts = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $alert_server_status = get_db_value ($dbh, "SELECT status FROM tserver WHERE server_type = ?", ALERTSERVER);
|
||||||
|
|
||||||
|
if (!defined($alert_server_status || $alert_server_status eq "") ) {
|
||||||
|
$alert_server_status = 0;
|
||||||
|
}
|
||||||
|
|
||||||
my $dbmaintance;
|
my $dbmaintance;
|
||||||
if ($RDBMS eq 'postgresql') {
|
if ($RDBMS eq 'postgresql') {
|
||||||
$dbmaintance = trim(get_db_value ($dbh,
|
$dbmaintance = trim(get_db_value ($dbh,
|
||||||
|
@ -194,6 +207,18 @@ sub pandora_self_monitoring ($$) {
|
||||||
$xml_output .=" <data>$queued_modules</data>\n";
|
$xml_output .=" <data>$queued_modules</data>\n";
|
||||||
$xml_output .=" </module>\n";
|
$xml_output .=" </module>\n";
|
||||||
|
|
||||||
|
$xml_output .=" <module>\n";
|
||||||
|
$xml_output .=" <name>Queued_Alerts</name>\n";
|
||||||
|
$xml_output .=" <type>generic_data</type>\n";
|
||||||
|
$xml_output .=" <data>$queued_alerts</data>\n";
|
||||||
|
$xml_output .=" </module>\n";
|
||||||
|
|
||||||
|
$xml_output .=" <module>\n";
|
||||||
|
$xml_output .=" <name>Alert_Server_Status</name>\n";
|
||||||
|
$xml_output .=" <type>generic_proc</type>\n";
|
||||||
|
$xml_output .=" <data>$alert_server_status</data>\n";
|
||||||
|
$xml_output .=" </module>\n";
|
||||||
|
|
||||||
$xml_output .=" <module>\n";
|
$xml_output .=" <module>\n";
|
||||||
$xml_output .=" <name>Agents_Unknown</name>\n";
|
$xml_output .=" <name>Agents_Unknown</name>\n";
|
||||||
$xml_output .=" <type>generic_data</type>\n";
|
$xml_output .=" <type>generic_data</type>\n";
|
||||||
|
|
|
@ -127,6 +127,7 @@ use JSON qw(decode_json encode_json);
|
||||||
use MIME::Base64;
|
use MIME::Base64;
|
||||||
use Text::ParseWords;
|
use Text::ParseWords;
|
||||||
use Math::Trig; # Math functions
|
use Math::Trig; # Math functions
|
||||||
|
use constant ALERTSERVER => 21;
|
||||||
|
|
||||||
# Debugging
|
# Debugging
|
||||||
#use Data::Dumper;
|
#use Data::Dumper;
|
||||||
|
@ -6133,6 +6134,18 @@ sub pandora_self_monitoring ($$) {
|
||||||
$queued_modules = 0;
|
$queued_modules = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my $queued_alerts = get_db_value ($dbh, "SELECT count(id) FROM talert_execution_queue");
|
||||||
|
|
||||||
|
if (!defined($queued_alerts)) {
|
||||||
|
$queued_alerts = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $alert_server_status = get_db_value ($dbh, "SELECT status FROM tserver WHERE server_type = ?", ALERTSERVER);
|
||||||
|
|
||||||
|
if (!defined($alert_server_status) || $alert_server_status eq "") {
|
||||||
|
$alert_server_status = 0;
|
||||||
|
}
|
||||||
|
|
||||||
my $pandoradb = 0;
|
my $pandoradb = 0;
|
||||||
my $pandoradb_tstamp = get_db_value ($dbh, "SELECT `value` FROM tconfig WHERE token = 'db_maintance'");
|
my $pandoradb_tstamp = get_db_value ($dbh, "SELECT `value` FROM tconfig WHERE token = 'db_maintance'");
|
||||||
if (!defined($pandoradb_tstamp) || $pandoradb_tstamp == 0) {
|
if (!defined($pandoradb_tstamp) || $pandoradb_tstamp == 0) {
|
||||||
|
@ -6159,6 +6172,18 @@ sub pandora_self_monitoring ($$) {
|
||||||
$xml_output .=" <data>$queued_modules</data>";
|
$xml_output .=" <data>$queued_modules</data>";
|
||||||
$xml_output .=" </module>";
|
$xml_output .=" </module>";
|
||||||
|
|
||||||
|
$xml_output .=" <module>\n";
|
||||||
|
$xml_output .=" <name>Queued_Alerts</name>\n";
|
||||||
|
$xml_output .=" <type>generic_data</type>\n";
|
||||||
|
$xml_output .=" <data>$queued_alerts</data>\n";
|
||||||
|
$xml_output .=" </module>\n";
|
||||||
|
|
||||||
|
$xml_output .=" <module>\n";
|
||||||
|
$xml_output .=" <name>Alert_Server_Status</name>\n";
|
||||||
|
$xml_output .=" <type>generic_proc</type>\n";
|
||||||
|
$xml_output .=" <data>$alert_server_status</data>\n";
|
||||||
|
$xml_output .=" </module>\n";
|
||||||
|
|
||||||
$xml_output .=" <module>";
|
$xml_output .=" <module>";
|
||||||
$xml_output .=" <name>Agents_Unknown</name>";
|
$xml_output .=" <name>Agents_Unknown</name>";
|
||||||
$xml_output .=" <type>generic_data</type>";
|
$xml_output .=" <type>generic_data</type>";
|
||||||
|
|
Loading…
Reference in New Issue