Agent’s Variables

  • Agent’s Variables

    Posted by Robas on enero 17, 2011 at 23:55

    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.

    Robas replied 13 years, 9 months ago 1 Member · 2 Replies
  • 2 Replies
  • Robas

    Member
    marzo 3, 2011 at 21:58
    0 Karma points
    Community rank: tentacle-noob-1 Tentacle noob
    Like it
    Up
    0
    Down
    Drop it
    ::

    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_vars+(w+)s*=s*(.+)$/) {
                            $ENV{$1} = $2;

    It will looks like the following:

                   

    # Collection
                    } elsif ($line =~ /^s*file_collections+(.+)$/) {
                            my $collection = $1;
    
                            # Prevent path traversal attacks
                            if ($collection !~ m/(..)|//) {
                                    $Collections{$collection} = 0;
                            }
                    # Environment Variable BEGIN
                    } elsif ($line =~ /^s*env_vars+(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*$//;
                    }
  • Robas

    Member
    marzo 3, 2011 at 22:58
    0 Karma points
    Community rank: tentacle-noob-1 Tentacle noob
    Like it
    Up
    0
    Down
    Drop it
    ::

    Ops, the name of the function is: read_config

    []s