Pandora FMS Community

Agent's Variables

Robas · 17 ene 2011, 23:55 · 3 mensajes · 69 visitas

  1. Inicio del debate

    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.

  2. 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*$//;
                    }
    
  3. Ops, the name of the function is: read_config []s

Entra en tu cuenta para publicar.