From 58c293809f6cd3ba2cbedf11f793a12c609a37e1 Mon Sep 17 00:00:00 2001 From: fermin831 Date: Thu, 9 Aug 2018 11:27:02 +0200 Subject: [PATCH] Added Execution_Time module to self monitoring agent --- pandora_server/lib/PandoraFMS/Core.pm | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index 27f7794b8a..90c03aa837 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -114,6 +114,7 @@ use Encode; use XML::Simple; use HTML::Entities; use Time::Local; +use Time::HiRes qw(time); use POSIX qw(strftime); use threads; use threads::shared; @@ -4770,6 +4771,10 @@ sub pandora_self_monitoring ($$) { WHERE token = 'db_maintance' AND value > UNIX_TIMESTAMP() - 86400"); } + my $start_performance = time; + get_db_value($dbh, "SELECT COUNT(*) FROM tagente_datos"); + my $read_speed = int((time - $start_performance) * 1e6); + $xml_output .= enterprise_hook("elasticsearch_performance", [$pa_config, $dbh]); $xml_output .=" "; @@ -4813,9 +4818,16 @@ sub pandora_self_monitoring ($$) { $xml_output .=" $free_disk_spool"; $xml_output .=" "; } - + + $xml_output .=" "; + $xml_output .=" Execution_Time"; + $xml_output .=" generic_data"; + $xml_output .=" us"; + $xml_output .=" $read_speed"; + $xml_output .=" "; + $xml_output .= ""; - + my $filename = $pa_config->{"incomingdir"}."/".$pa_config->{'servername'}.".self.".$utimestamp.".data"; open (XMLFILE, ">> $filename") or die "[FATAL] Could not open internal monitoring XML file for deploying monitorization at '$filename'";