2012-11-15 Sergio Martin <sergio.martin@artica.es>
* pandora_agent: Added support to the new fields of the agent in the XML: custom_id, url_addres and custom fields git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7151 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
47f3dd55fa
commit
e63d9162d9
|
@ -1,3 +1,8 @@
|
||||||
|
2012-11-15 Sergio Martin <sergio.martin@artica.es>
|
||||||
|
|
||||||
|
* pandora_agent: Added support to the new fields of the
|
||||||
|
agent in the XML: custom_id, url_addres and custom fields
|
||||||
|
|
||||||
2012-11-13 Sergio Martin <sergio.martin@artica.es>
|
2012-11-13 Sergio Martin <sergio.martin@artica.es>
|
||||||
|
|
||||||
* pandora_agent: Added several fields to the XML
|
* pandora_agent: Added several fields to the XML
|
||||||
|
|
|
@ -157,6 +157,8 @@ my %Conf = (
|
||||||
'intensive_interval' => 0,
|
'intensive_interval' => 0,
|
||||||
'timestamp' => 0,
|
'timestamp' => 0,
|
||||||
'xml_buffer' => 0,
|
'xml_buffer' => 0,
|
||||||
|
'custom_id' => '',
|
||||||
|
'url_address' => '',
|
||||||
);
|
);
|
||||||
|
|
||||||
# Modules
|
# Modules
|
||||||
|
@ -190,6 +192,9 @@ my %Parts = (
|
||||||
# Collections
|
# Collections
|
||||||
my %Collections;
|
my %Collections;
|
||||||
|
|
||||||
|
# Custom fields
|
||||||
|
my %Customfields;
|
||||||
|
|
||||||
# $DevNull
|
# $DevNull
|
||||||
my $DevNull = '/dev/null';
|
my $DevNull = '/dev/null';
|
||||||
|
|
||||||
|
@ -337,7 +342,6 @@ sub parse_conf_modules($) {
|
||||||
'description' => '',
|
'description' => '',
|
||||||
'func' => 0,
|
'func' => 0,
|
||||||
'params' => '',
|
'params' => '',
|
||||||
'description' => '',
|
|
||||||
'interval' => 1,
|
'interval' => 1,
|
||||||
'timeout' => 0,
|
'timeout' => 0,
|
||||||
'counter' => 0,
|
'counter' => 0,
|
||||||
|
@ -628,6 +632,13 @@ sub read_config (;$) {
|
||||||
# Replace CRLF with LF
|
# Replace CRLF with LF
|
||||||
$line =~ s/\r\n/\n/g;
|
$line =~ s/\r\n/\n/g;
|
||||||
|
|
||||||
|
# Store the custom fields
|
||||||
|
|
||||||
|
if (($line =~ m/^(custom_field\d+_name)\s+(.*)/) or ($line =~ m/^(custom_field\d+_value)\s+(.*)/)) {
|
||||||
|
$Customfields{$1} = $2;
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
# Token search
|
# Token search
|
||||||
if (defined ($token)) {
|
if (defined ($token)) {
|
||||||
if ($line =~ /^\s*(\S+)\s+(.*)$/ && $1 eq $token) {
|
if ($line =~ /^\s*(\S+)\s+(.*)$/ && $1 eq $token) {
|
||||||
|
@ -1989,6 +2000,24 @@ while (1) {
|
||||||
# Clear the XML
|
# Clear the XML
|
||||||
$Xml = "";
|
$Xml = "";
|
||||||
|
|
||||||
|
# Custom fields
|
||||||
|
|
||||||
|
my @customfieldskeys = keys(%Customfields);
|
||||||
|
if ($#customfieldskeys > -1) {
|
||||||
|
$Xml .= "<custom_fields>\n";
|
||||||
|
foreach my $customfieldkey (@customfieldskeys) {
|
||||||
|
if($customfieldkey =~ m/^(custom_field\d+_)name/) {
|
||||||
|
if(defined($Customfields{$1."value"})) {
|
||||||
|
$Xml .= " <field>\n";
|
||||||
|
$Xml .= " <name><![CDATA[". $Customfields{$1."name"} ."]]></name>\n";
|
||||||
|
$Xml .= " <value><![CDATA[". $Customfields{$1."value"} ."]]></value>\n";
|
||||||
|
$Xml .= " </field>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$Xml .= "</custom_fields>\n";
|
||||||
|
}
|
||||||
|
|
||||||
# Execute modules
|
# Execute modules
|
||||||
foreach my $module (@Modules) {
|
foreach my $module (@Modules) {
|
||||||
|
|
||||||
|
@ -2041,7 +2070,8 @@ while (1) {
|
||||||
"<agent_data description='" . $Conf{'description'} ."' group='" . $Conf{'group'} .
|
"<agent_data description='" . $Conf{'description'} ."' group='" . $Conf{'group'} .
|
||||||
"' os_name='$OS' os_version='$OS_VERSION' interval='" . $Conf{'interval'} .
|
"' os_name='$OS' os_version='$OS_VERSION' interval='" . $Conf{'interval'} .
|
||||||
"' version='" . AGENT_VERSION . '(Build ' . AGENT_BUILD . ')' . ($Conf{'autotime'} eq '1' ? '' : "' timestamp='" . strftime ('%Y/%m/%d %H:%M:%S', localtime ())) .
|
"' version='" . AGENT_VERSION . '(Build ' . AGENT_BUILD . ')' . ($Conf{'autotime'} eq '1' ? '' : "' timestamp='" . strftime ('%Y/%m/%d %H:%M:%S', localtime ())) .
|
||||||
"' agent_name='" . $Conf{'agent_name'} . "' timezone_offset='". $Conf{'timezone_offset'};
|
"' agent_name='" . $Conf{'agent_name'} . "' timezone_offset='". $Conf{'timezone_offset'} .
|
||||||
|
"' custom_id='" . $Conf{'custom_id'} . "' url_address='". $Conf{'url_address'};
|
||||||
|
|
||||||
if (defined ($Conf{'address'})) {
|
if (defined ($Conf{'address'})) {
|
||||||
$xml_header .= "' address='" .$address;
|
$xml_header .= "' address='" .$address;
|
||||||
|
|
Loading…
Reference in New Issue