Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Agent's Variables
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.
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:

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

It will looks like the following:

# 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*$//;

Ops, the name of the function is: read_config


Users browsing this thread: 1 Guest(s)

(c) 2006-2018 Artica Soluciones Tecnológicas. Contents of this wiki are under Create Common Attribution v3 licence. | |

Theme © MyBB Themes