Pages: [1]   Go Down
Author Topic: Agent's Variables  (Read 989 times)
0 Members and 2 Guests are viewing this topic.
Robas
Full Member
***

Karma: 0
Offline Offline

Posts: 28


View Profile
« on: January 17, 2011, 08:55:17 PM »

Hi there,

We're trying to monitor Oracle Databases here and one of the main subject to monitor is the .log;
It's location depends on the SID name (oracle's instance name). The idea is to have the ability to define variables to each agent using Pandora; with this we could, for example, set the variable "$sid"  with the correct SID name for each agent and use this variable on the modules. It would be great in order to achieve a better level of generality for the modules.
Instead of creating N modules for N static SID name, we could create only one module and use the variable to cover the different SIDs.
Logged

Robas
Full Member
***

Karma: 0
Offline Offline

Posts: 28


View Profile
« Reply #1 on: March 03, 2011, 06:58:36 PM »

Only for you to know, i've included a few (really few) lines on pandora_agent file (perl).
Before the "Configuration token" part of the read_configuration function, include:

Code:
} elsif ($line =~ /^\s*env_var\s+(\w+)\s*=\s*(.+)$/) {
                        $ENV{$1} = $2;

It will looks like the following:

               
Code:
# Collection
                } elsif ($line =~ /^\s*file_collection\s+(.+)$/) {
                        my $collection = $1;

                        # Prevent path traversal attacks
                        if ($collection !~ m/(\.\.)|\//) {
                                $Collections{$collection} = 0;
                        }
                # Environment Variable BEGIN
                } elsif ($line =~ /^\s*env_var\s+(\w+)\s*=\s*(.+)$/) {
                        $ENV{$1} = $2;
                # Environment Variable END
                # Configuration token
                } elsif ($line =~ /^\s*(\S+)\s+(.*)$/) {

                        log_message ('setup', "$1 is $2");
                        $Conf{$1} = $2;

                        # Remove trailing spaces
                        $Conf{$1} =~ s/\s*$//;
                }

Logged

Robas
Full Member
***

Karma: 0
Offline Offline

Posts: 28


View Profile
« Reply #2 on: March 03, 2011, 07:58:13 PM »

Ops, the name of the function is: read_config

[]s
Logged

Pages: [1]   Go Up
Print
 
Jump to:  


SourceForge.net Logo  This site is monitored by Pandora FMS   ArticaST