mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-04-08 18:55:09 +02:00
Set the right OS and version for self-monitoring.
(cherry picked from commit 42454cd3e2cf73092e3f8a1e21678f02fe0c85ec)
This commit is contained in:
parent
72f8881685
commit
3654009b8d
@ -4371,7 +4371,7 @@ sub pandora_self_monitoring ($$) {
|
||||
|
||||
my $xml_output = "";
|
||||
|
||||
$xml_output = "<agent_data os_name='Linux' os_version='".$pa_config->{'version'}."' agent_name='".$pa_config->{'servername'}."' interval='".$pa_config->{"self_monitoring_interval"}."' timestamp='".$timestamp."' >";
|
||||
$xml_output = "<agent_data os_name='$OS' os_version='$OS_VERSION' version='" . $pa_config->{'version'} . "' description='Pandora FMS Server version " . $pa_config->{'version'} . "' agent_name='".$pa_config->{'servername'}."' interval='".$pa_config->{"self_monitoring_interval"}."' timestamp='".$timestamp."' >";
|
||||
$xml_output .=" <module>";
|
||||
$xml_output .=" <name>Status</name>";
|
||||
$xml_output .=" <type>generic_proc</type>";
|
||||
|
@ -59,6 +59,8 @@ our @EXPORT = qw(
|
||||
SATELLITESERVER
|
||||
METACONSOLE_LICENSE
|
||||
$DEVNULL
|
||||
$OS
|
||||
$OS_VERSION
|
||||
RECOVERED_ALERT
|
||||
FIRED_ALERT
|
||||
STATUS_NORMAL
|
||||
@ -132,8 +134,20 @@ use constant METACONSOLE_LICENSE => 0x01;
|
||||
use constant RECOVERED_ALERT => 0;
|
||||
use constant FIRED_ALERT => 1;
|
||||
|
||||
# /dev/null
|
||||
our $DEVNULL = ($^O eq 'MSWin32') ? '/Nul' : '/dev/null';
|
||||
# Set OS, OS version and /dev/null
|
||||
our $OS = $^O;
|
||||
our $OS_VERSION;
|
||||
our $DEVNULL = '/dev/null';
|
||||
if ($OS eq 'linux') {
|
||||
$OS_VERSION = `lsb_release -sd 2>/dev/null`;
|
||||
} elsif ($OS eq 'aix') {
|
||||
$OS_VERSION = "$2.$1" if (`uname -rv` =~ /\s*(\d)\s+(\d)\s*/);
|
||||
} elsif ($OS =~ /win/i) {
|
||||
$OS = "windows";
|
||||
$OS_VERSION = `ver`;
|
||||
$DEVNULL = '/Nul';
|
||||
}
|
||||
chomp($OS_VERSION);
|
||||
|
||||
########################################################################
|
||||
## SUB pandora_trash_ascii
|
||||
|
Loading…
x
Reference in New Issue
Block a user