diff --git a/pandora_agents/unix/DEBIAN/control.orig b/pandora_agents/unix/DEBIAN/control.orig deleted file mode 100644 index 0d45b0b974..0000000000 --- a/pandora_agents/unix/DEBIAN/control.orig +++ /dev/null @@ -1,14 +0,0 @@ -package: pandorafms-agent-unix -<<<<<<< HEAD -Version: 7.0NG-170406 -======= -Version: 7.0NG-170418 ->>>>>>> develop -Architecture: all -Priority: optional -Section: admin -Installed-Size: 260 -Maintainer: Miguel de Dios -Homepage: http://pandorafms.org/ -Depends: coreutils, perl, unzip -Description: Pandora FMS agents are based on native languages in every platform: scripts that can be written in any language. It’s possible to reproduce any agent in any programming language and can be extended without difficulty the existing ones in order to cover aspects not taken into account up to the moment. These scripts are formed by modules that each one gathers a "chunk" of information. Thus, every agent gathers several "chunks" of information; this one is organized in a data set and stored in a single file, called data file. diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh.orig b/pandora_agents/unix/DEBIAN/make_deb_package.sh.orig deleted file mode 100644 index 731ccfb803..0000000000 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh.orig +++ /dev/null @@ -1,132 +0,0 @@ -#!/bin/bash - -#Pandora FMS- http:#pandorafms.com -# ================================================== -# Copyright (c) 2005-2010 Artica Soluciones Tecnologicas -# Please see http:#pandorafms.org for full contribution list - -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation; version 2 - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -<<<<<<< HEAD -pandora_version="7.0NG-170406" -======= -pandora_version="7.0NG-170418" ->>>>>>> develop - -echo "Test if you has the tools for to make the packages." -whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null -if [ $? = 1 ] -then - echo "No found \"dpkg-deb\" aplication, please install." - exit 1 -else - echo "Found \"dpkg-debs\"." -fi - -cd .. - -echo "Make a \"temp_package\" temp dir for job." - -mkdir -p temp_package/usr -mkdir -p temp_package/usr/share/pandora_agent/ -mkdir -p temp_package/usr/bin/ -mkdir -p temp_package/usr/sbin/ -mkdir -p temp_package/etc/pandora/plugins -mkdir -p temp_package/etc/pandora/collections -mkdir -p temp_package/etc/init.d/ -mkdir -p temp_package/lib/systemd/system/ -mkdir -p temp_package/var/log/pandora/ -mkdir -p temp_package/var/spool/pandora/data_out -mkdir -p temp_package/usr/share/man/man1/ -mkdir -p temp_package/usr/share/pandora_agent/plugins -mkdir -p temp_package/tmp -mkdir -p temp_package/etc/logrotate.d/ - -echo "Make directory system tree for package." -cp DEBIAN temp_package -R -chmod 755 -R temp_package/DEBIAN - -#Next lines is same to -#cp -aRf * temp_package/usr/share/pandora_agent/ -#but don't copy recursive the temp_package into temp_package - -for item in `ls | grep -v NT4 | grep -v AIX | grep -v FreeBSD | grep -v HP-UX | grep -v SunOS | grep -v temp_package` -do - #if [ \( $item != 'temp_package' \) -a \( $item != 'NT4' \) ] - #then - cp -aRf $item temp_package/usr/share/pandora_agent/ - #fi -done -cp -aRf tentacle_client temp_package/usr/bin/ -cp -aRf pandora_agent temp_package/usr/bin/ -cp -aRf pandora_agent_exec temp_package/usr/bin/pandora_agent_exec -cp -aRf pandora_agent_daemon temp_package/etc/init.d/pandora_agent_daemon -cp -aRf pandora_agent_daemon.service temp_package/lib/systemd/system/pandora_agent_daemon.service -cp -aRf pandora_agent_logrotate temp_package/etc/logrotate.d/pandora_agent -cp Linux/pandora_agent.conf temp_package/etc/pandora/ - -cp -aRf man/man1/* temp_package/usr/share/man/man1/ - -# Relocate plugins to the final dir and delete -mv temp_package/usr/share/pandora_agent/plugins/* temp_package/etc/pandora/plugins - -echo "Official plugins are placed on /etc/pandora/plugins" > temp_package/usr/share/pandora_agent/plugins/README - -#Disabled, now the package overwrite the previous files. -##Create a temp file for to update files of plugins dir but don't crush dir. -##cp -aRf temp_package/usr/share/pandora_agent/plugins temp_package/tmp -##rm -rf temp_package/usr/share/pandora_agent/plugins/* - -echo "Remove the SVN files and other temp files." -for item in `find temp_package` -do - echo -n "." - echo $item | grep "svn" > /dev/null - #last command success - if [ $? -eq 0 ] - then - rm -rf $item - fi - - echo $item | grep "make_deb_package.sh" > /dev/null - #last command success - if [ $? -eq 0 ] - then - rm -rf $item - fi -done -echo "END" - -echo "Calcule md5sum for md5sums file control of package" -for item in `find temp_package` -do - echo -n "." - if [ ! -d $item ] - then - echo $item | grep "DEBIAN" > /dev/null - #last command success - if [ $? -eq 1 ] - then - md5=`md5sum $item | cut -d" " -f1` - - #delete "temp_package" in the path - final_path=${item#temp_package} - echo $md5" "$final_path >> temp_package/DEBIAN/md5sums - fi - fi -done -echo "END" - -echo "Make the package \"Pandorafms console\"." -dpkg-deb --build temp_package -mv temp_package.deb pandorafms.agent_unix_$pandora_version.deb - -echo "Delete the \"temp_package\" temp dir for job." -rm -rf temp_package diff --git a/pandora_agents/unix/pandora_agent.orig b/pandora_agents/unix/pandora_agent.orig deleted file mode 100755 index 2f7de8cc2a..0000000000 --- a/pandora_agents/unix/pandora_agent.orig +++ /dev/null @@ -1,2824 +0,0 @@ -#!/usr/bin/perl -# ********************************************************************** -# Pandora FMS Generic Unix/Perl Agent -# (c) 2009-2015 Artica Soluciones Tecnológicas -# with the help of many people. Please see http://pandorafms.org -# This code is licensed under GPL 2.0 license. -# ********************************************************************** - -=head1 NAME - -pandora_agent - Pandora FMS Agent - -=head1 VERSION - -Version 6.0 - -=head1 USAGE - -<< pandora_agent F >> - -=cut - - -use strict; -use warnings; - -use POSIX qw(strftime floor); -use Sys::Hostname; -use File::Basename; -use File::Copy; -use IO::Socket; -use Sys::Syslog; - -# Agent XML data -my $Xml; - -# Semaphore used to acces $Xml -my $Sem = undef; - -# Semaphore used to control the number of threads -my $ThreadSem = undef; - -use constant AGENT_VERSION => '7.0NG'; -<<<<<<< HEAD -use constant AGENT_BUILD => '170406'; -======= -use constant AGENT_BUILD => '170418'; ->>>>>>> develop - -# Agent log default file size maximum and instances -use constant DEFAULT_MAX_LOG_SIZE => 600000; -use constant DEFAULT_LOG_ROTATE => 3; - -# Commands to retrieve total memory information in kB -use constant TOTALMEMORY_CMDS => { - linux => 'cat /proc/meminfo | grep MemTotal: | awk \'{ print $2 }\'', - solaris => '/usr/sbin/prtconf | awk \'/Memory/ { print $3 * 1024 }\'', - hpux => 'swapinfo -t | grep memory | awk \'{print $2}\'', - freebsd => '/sbin/sysctl hw.physmem | awk \'{print $2 / 1024}\'', -}; - -# Commands to retrieve free memory information in kB -use constant FREEMEMORY_CMDS => { - linux => 'cat /proc/meminfo | grep MemFree: | awk \'{ print $2 }\'', - solaris => 'vmstat 1 2 | tail -1 | awk \'{ print $5 }\'', - hpux => 'swapinfo -t | grep memory | awk \'{print $4}\'', - freebsd => '/sbin/sysctl -n vm.stats.vm.v_page_size vm.stats.vm.v_free_count | tr "\n" " " | awk \'{ print $1 * $2 / 1024 }\'', -}; - -# Commands to retrieve cpu information -use constant CPUUSAGE_CMDS => { - linux => 'vmstat 1 2 | tail -1 | awk \'{ print $13 }\'', - solaris => 'vmstat 1 2 | tail -1 | awk \'{ print $21 }\'', - hpux => 'vmstat 1 2 | tail -1 | awk \'{ print $16 }\'', - freebsd => 'vmstat -n 0 1 2 | tail -1 | awk \'{ print $15 }\'' -}; - -# Commands to retrieve process information -use constant PROC_CMDS => { - # cpu usage, memory usage, command name - linux => 'ps aux | awk \'NR > 1 {ps = ""; for (i = 11; i <= NF; ++i) {ps = (ps " " $i) }; print $3, $6, ps}\'', - solaris => 'prstat 1 1 | awk \'NR > 1 {split ($10, ps, "/"); cpu = substr ($9, 1, length ($9) - 1); mem = substr ($3, 1, length ($3) - 1); print cpu, mem, ps[1]}\'', - hpux => 'ps -elf | awk \'NR > 1 {ps = ""; for (i = 15; i <= NF; ++i) {ps = (ps " " $i) }; print 0, $10, ps}\'', - aix => 'ps aux | awk \'NR > 1 {print $3, $6, $11}\'', - freebsd => 'ps axww -o %cpu= -o %mem= -o command= | sed -e "s/^ *//"', -}; - -# Commands to retrieve partition information in kB -use constant PART_CMDS => { - # total, available, mount point - linux => 'df -P | awk \'NR > 1 {print $2, $4, $6}\'', - solaris => 'df -k | awk \'NR > 1 {print $2, $4, $6}\'', - hpux => 'df -P | awk \'NR > 1 {print $2, $4, $6}\'', - aix => 'df -kP | awk \'NR > 1 {print $2, $4, $6}\'', - freebsd => 'df -k | awk \'NR > 1 {print $2, $4, $6}\'' -}; - -# Commands to call df with POSIX output format -use constant DF_CMDS => { - # total, available, mount point - linux => 'df -P', - solaris => 'df -k', - hpux => 'df -P', - aix => 'df -kP', - freebsd => 'df -k' -}; - -# 2 to the power of 32. -use constant POW232 => 2**32; - -# OS and OS version -my $OS = $^O; - -my $OS_VERSION; - -# Used to calculate the MD5 checksum of a string -use constant MOD232 => 2**32; - -# Directory where pandora_agent.conf is located -my $ConfDir = ''; - -# Pandora FMS agent configuration file -my $ConfFile = 'pandora_agent.conf'; - -# Set to 1 if broker agents are enabled. -my $BrokerEnabled = 0; - -# Broker agent configuration files -my @BrokerPid; - -# Configuration tokens -my %DefaultConf = ( - 'server_ip' => 'localhost', - 'server_path' => '/var/spool/pandora/data_in', - 'logfile' =>'/var/log/pandora/pandora_agent.log', - 'logsize' => DEFAULT_MAX_LOG_SIZE, - 'logrotate' => DEFAULT_LOG_ROTATE, - 'temporal' => '/var/spool/pandora', - 'interval' => 300, - 'debug' => 0, - 'agent_name' => '', - 'agent_alias' => hostname(), - 'ehorus_conf' => undef, - 'agent_name_cmd' => '', - 'description' => '', - 'group' => '', - 'group_id' => undef, - 'group_password' => undef, - 'encoding' => 'UTF-8', - 'server_port' => 41121, - 'transfer_mode' => 'tentacle', - 'transfer_timeout' => 30, - 'server_user' => 'pandora', - 'server_pwd' => '', - 'server_ssl' => '0', - 'server_opts' => '', - 'delayed_startup' => 0, - 'pandora_nice' => 10, - 'cron_mode' => 0, - 'remote_config' => 0, - 'secondary_mode' => 'never', - 'secondary_server_ip' => 'localhost', - 'secondary_server_path' => '/var/spool/pandora/data_in', - 'secondary_server_port' => 41121, - 'secondary_transfer_mode' => 'tentacle', - 'secondary_transfer_timeout' => 30, - 'secondary_server_user' => 'pandora', - 'secondary_server_pwd' => '', - 'secondary_server_ssl' => '0', - 'secondary_server_opts' => '', - 'autotime' => 0, - 'temporal_min_size' => 1, - 'timezone_offset' => 0, - 'pandora_exec' => 'pandora_agent_exec', - 'agent_threads' => 1, - 'udp_server_port' => 41122, - 'udp_server_auth_address' => '0.0.0.0', - 'udp_server' => 0, - 'proxy_mode' => 0, - 'proxy_max_connection' => 10, - 'proxy_timeout' => 1, - 'intensive_interval' => 0, - 'timestamp' => 0, - 'xml_buffer' => 0, - 'custom_id' => '', - 'url_address' => '', -); -my %Conf = %DefaultConf; - -# Modules -my @Modules; - -# Logfile file handle -my $LogFileFH; - -# Logfile index -my $LogFileIdx; - -# Agent name MD5; -my $AgentMD5; - -# Remote configuration file name -my $RemoteConfFile; - -# Remote md5 file name -my $RemoteMD5File; - -# Process data -my %Procs = ( - '__utimestamp__' => 0 -); - -# Partition data -my %Parts = ( - '__utimestamp__' => 0 -); - -# Collections -my %Collections; - -# Custom fields -my %Customfields; - -# $DevNull -my $DevNull = '/dev/null'; - -# Shell command separator -my $CmdSep = ';'; - -# Global macros -my %Macros; - -# PID of tentacle proxy, used in proxy mode -my $tentacle_pid = undef; - -# PID of udp_server -my $udp_server_pid = undef; - -################################################################################ -# Print usage information and exit. -################################################################################ -sub print_usage () { - print "\nUsage: $0 \n\n"; - print "\tPandora home is the directory where pandora_agent.conf is located,\n"; - print "\tby default /etc/pandora.\n\n"; - exit 1; -} - -################################################################################ -# Print an error message and exit. -################################################################################ -sub error ($) { - my $msg = shift; - print ("[ERROR] $msg\n\n"); - `logger -i -t pandora_agent_daemon [ERROR] $msg 2>/dev/null`; - exit 1; -} - -################################################################################ -# Check a regular expression. Returns 1 if its valid, 0 otherwise. -################################################################################ -sub valid_regexp ($) { - my $regexp = shift; - - eval { - '' =~ /$regexp/; - }; - - # Something went wrong - return 0 if ($@); - - return 1; -} - -################################################################################ -# Recursively delete files and directories. -################################################################################ -sub rmrf { - my $path = shift; - local *DIR; - - if (-d $path) { - opendir (DIR, $path) || return; - while (defined (my $file_name = readdir(DIR))) { - next if ($file_name eq '.' || $file_name eq '..'); - rmrf ("$path/$file_name"); - } - closedir (DIR); - rmdir ($path); - } else { - unlink ($path); - } -} - -################################################################################ -# Recursively set file permissions. -################################################################################ -sub chmodr { - my ($perm, $path) = @_; - local *DIR; - - if (-d $path) { - opendir (DIR, $path) || return; - while (defined (my $file_name = readdir(DIR))) { - next if ($file_name eq '.' || $file_name eq '..'); - chmodr ($perm, "$path/$file_name"); - } - closedir (DIR); - } - chmod ($perm, $path); -} - -################################################################################ -# Open the agent logfile and start logging. -################################################################################ -sub start_log (;$) { - my $quiet = shift; - - # Get the logfile - $Conf{'logfile'} = read_config ('logfile'); - $Conf{'logfile'} = '/var/log/pandora/pandora_agent.log' unless defined ($Conf{'logfile'}); - - # Open it - if ($Conf{'logfile'} eq 'syslog') { - openlog('pandora_agent', 'nowait', 'daemon'); - } else { - open ($LogFileFH, "> $Conf{'logfile'}") or error ("Could not open log file $Conf{'logfile'} for writing: $!."); - print "Logging to $Conf{'logfile'}\n" if (!defined ($quiet)); - } -} - -################################################################################ -# Rotates the agent logfile. -################################################################################ -sub rotate_log () { - if ($Conf{'logfile'} eq 'syslog') { - # No action needed - return; - } else { - if ($Conf{'logrotate'} < 0){ - $Conf{'logrotate'} = DEFAULT_LOG_ROTATE; - } - if ($Conf{'logfile'} eq 'syslog') { - return; - } - - # Rotate file - $LogFileIdx = ($LogFileIdx+1) % $Conf{'logrotate'}; - my $fsize = (stat $Conf{'logfile'})[7]; - - stop_log(); - move ($Conf{'logfile'}, $Conf{'logfile'} . "." . $LogFileIdx); - start_log('quiet'); - - } -} - -################################################################################ -# Close the agent logfile and stop logging. -################################################################################ -sub stop_log () { - if ($Conf{'logfile'} eq 'syslog') { - closelog(); - } else { - close ($LogFileFH); - } -} - -################################################################################ -# Log a message to the agent logfile. -################################################################################ -sub log_message ($$;$) { - my ($source, $msg, $dest) = @_; - - if (defined ($dest)) { - print $dest strftime ('%Y/%m/%d %H:%M:%S', localtime ()) . " - [$source] - $msg\n"; - } elsif ($Conf{'logfile'} eq 'syslog') { - syslog('info', $msg); - } else { - #Trying to write into log file to test its writable - syswrite ($LogFileFH, ""); - - #If no error, the file is writable - if (!$!) { - print $LogFileFH strftime ('%Y/%m/%d %H:%M:%S', localtime ()) . " - [$source] - $msg\n"; - } else { - #If error then log into syslog! - `logger -i -t pandora_agent_daemon [ERROR] $msg 2>/dev/null`; - } - } -} - -################################################################################ -# Parse configuration file (modules, plugins and collections) -################################################################################ -sub parse_conf_modules($) { - my ($param) = @_; - - # Mark the start of a module definition - my $module_begin = 0; - - # Skeleton for modules - my $module = {}; - - foreach my $line (@{$param}) { - - next if ($line =~ m/^\s*#/) or ($line =~ m/^\s*$/); - # Module definition - if ($line =~ /^\s*module_begin\s*$/) { - $module_begin = 1; - init_module ($module); - } elsif ($line =~ /^\s*module_name\s+(.+)$/) { - $module->{'name'} = $1; - $module->{'name'} =~ s/\s+$//g; - $module->{'name'} =~ s/^\s+//g; - } elsif ($line =~ /^\s*module_description\s+(.+)$/) { - $module->{'description'} = $1; - } elsif ($line =~ /^\s*module_type\s+(\S+)\s*$/) { - $module->{'type'} = $1; - }elsif ($line =~ /^\s*module_precondition\s+(.*)$/) { - my $action = $1; - - # Numeric comparison - if ($action =~ /^\s*([<>!=]+)\s+(\d+(?:\.\d*)?)\s+(.*)$/) { - push (@{$module->{'precondition'}}, {'operator' => $1, 'value_1' => $2, 'command' => $3}); - # Interval - } elsif ($action =~ /^\s*[(]\s*(\d+(?:\.\d*)?)\s*,\s*(\d+(?:\.\d*)?)\s*[)]\s+(.*)$/) { - push (@{$module->{'precondition'}}, {'operator' => '()', 'value_1' => $1, 'value_2' => $2, 'command' => $3}); - # Regular expression - } elsif ($action =~ /^\s*=~\s+(\S*)\s+(.*)$/) { - if (valid_regexp ($1)) { - push (@{$module->{'precondition'}}, {'operator' => '=~', 'value_1' => $1, 'command' => $2}); - } else { - log_message ('setup', "Invalid regular expression in module precondition: $line"); - } - } - } elsif ($line =~ /^\s*module_exec\s+(.+)$/) { - $module->{'func'} = \&module_exec; - $module->{'params'} = $1; - } elsif ($line =~ /^\s*module_cpuusage\s+(.*)$/) { - $module->{'func'} = \&module_cpuusage; - $module->{'params'} = $1; - } elsif ($line =~ /^\s*module_freememory\s+(.*)$/) { - $module->{'func'} = \&module_freememory; - $module->{'params'} = $1; - } elsif ($line =~ /^\s*module_freepercentmemory\s+(.*)$/) { - $module->{'func'} = \&module_freepercentmemory; - $module->{'params'} = $1; - } elsif ($line =~ /^\s*(module_proc|module_service)\s+(.+)$/) { - $module->{'func'} = \&module_proc; - $module->{'params'} = $2; - } elsif ($line =~ /^\s*module_cpuproc\s+(.+)$/) { - $module->{'func'} = \&module_cpuproc; - $module->{'params'} = $1; - } elsif ($line =~ /^\s*module_memproc\s+(.+)$/) { - $module->{'func'} = \&module_memproc; - $module->{'params'} = $1; - } elsif ($line =~ /^\s*module_freedisk\s+(.*)$/) { - $module->{'func'} = \&module_freedisk; - $module->{'params'} = $1; - } elsif ($line =~ /^\s*module_freepercentdisk\s+(.*)$/) { - $module->{'func'} = \&module_freepercentdisk; - $module->{'params'} = $1; - } elsif ($line =~ /^\s*module_occupiedpercentdisk\s+(.*)$/) { - $module->{'func'} = \&module_occupiedpercentdisk; - $module->{'params'} = $1; - } elsif ($line =~ /^\s*module_max\s+(.*)\s*$/) { - $module->{'max'} = $1; - } elsif ($line =~ /^\s*module_min\s+(.*)\s*$/) { - $module->{'min'} = $1; - } elsif ($line =~ /^\s*module_postprocess\s+(.*)\s*$/) { - $module->{'post_process'} = $1; - } elsif ($line =~ /^\s*module_interval\s+(\d+)\s*$/) { - $module->{'interval'} = $1; - } elsif ($line =~ /^\s*module_timeout\s+(\d+)\s*$/) { - $module->{'timeout'} = $1; - } elsif ($line =~ /^\s*module_save\s+(\w+)$/) { - $module->{'save'} = $1; - } elsif ($line =~ /^\s*module_alert_template\s+(.*)$/) { - $module->{'alert_template'} = $1; - } elsif ($line =~ /^\s*module_condition\s+(.*)$/) { - my $action = $1; - # Numeric comparison - if ($action =~ /^\s*([<>!=]+)\s+(\d+(?:\.\d*)?)\s+(.*)$/) { - push (@{$module->{'conditions'}}, {'operator' => $1, 'value_1' => $2, 'command' => $3}); - # Interval - } elsif ($action =~ /^\s*[(]\s*(\d+(?:\.\d*)?)\s*,\s*(\d+(?:\.\d*)?)\s*[)]\s+(.*)$/) { - push (@{$module->{'conditions'}}, {'operator' => '()', 'value_1' => $1, 'value_2' => $2, 'command' => $3}); - # Regular expression - } elsif ($action =~ /^\s*=~\s+(\S*)\s+(.*)$/) { - if (valid_regexp ($1)) { - push (@{$module->{'conditions'}}, {'operator' => '=~', 'value_1' => $1, 'command' => $2}); - } else { - log_message ('setup', "Invalid regular expression in module condition: $line"); - } - } - } elsif ($line =~ /^\s*module_intensive_condition\s+(.*)$/) { - my $action = $1; - - $module->{'is_intensive'} = 1; - - # Numeric comparison - if ($action =~ /^\s*([<>!=]+)\s+(\d+(?:\.\d*)?)\s*$/) { - push (@{$module->{'intensive_conditions'}}, {'operator' => $1, 'value_1' => $2}); - # Interval - } elsif ($action =~ /^\s*[(]\s*(\d+(?:\.\d*)?)\s*,\s*(\d+(?:\.\d*)?)\s*[)]\s*$/) { - push (@{$module->{'intensive_conditions'}}, {'operator' => '()', 'value_1' => $1, 'value_2' => $2}); - # Regular expression - } elsif ($action =~ /^\s*=~\s+(\S*)\s*$/) { - if (valid_regexp ($1)) { - push (@{$module->{'intensive_conditions'}}, {'operator' => '=~', 'value_1' => $1}); - } else { - log_message ('setup', "Invalid regular expression in intensive condition: $line"); - } - } - } elsif ($line =~ /^\s*module_crontab\s+(((\*|(\d+(-\d+){0,1}))\s*){5}).*$/) { - $module->{'cron'} = $1; - chomp ($module->{'cron'}); - } elsif ($line =~ /^\s*module_cron_interval\s+(\d+).*$/) { - $module->{'cron_interval'} = $1; - } elsif ($line =~ /^\s*module_end\s*$/) { - - $module_begin = 0; - - # Check for invalid modules - next unless (($module->{'name'} ne '' && $module->{'func'} != 0) || $module->{'func'} == \&module_plugin); - - # Set the intensive interval - if ($module->{'is_intensive'} == 1) { - $module->{'intensive_interval'} = $module->{'interval'}; - } else { - $module->{'intensive_interval'} = $module->{'interval'} * ($Conf{'interval'} / $Conf{'intensive_interval'}); - } - - # Make the module run the first time - $module->{'counter'} = $module->{'intensive_interval'}; - - # Replace macros - replace_macros ($module); - - push (@Modules, {%{$module}}); - # Plugin - } elsif ($line =~ /^\s*module_plugin\s+(.+)$/) { - - # Single line plugin definition - if ($module_begin == 0) { - - # Set default values for the module configuration - init_module ($module); - - # Configure the plugin - $module->{'func'} = \&module_plugin; - $module->{'params'} = $1; - - # Set the intensive interval - if ($module->{'is_intensive'} == 1) { - $module->{'intensive_interval'} = $module->{'interval'}; - } else { - $module->{'intensive_interval'} = $module->{'interval'} * ($Conf{'interval'} / $Conf{'intensive_interval'}); - } - - # Make the module run the first time - $module->{'counter'} = $module->{'intensive_interval'}; - - # Replace macros - replace_macros ($module); - - push (@Modules, {%{$module}}); - } else { - $module->{'func'} = \&module_plugin; - $module->{'params'} = $1; - } - # Module proc command redefinition - } elsif ($line =~ /^\s*module_proc_cmd\s+(.+)$/) { - PROC_CMDS->{$OS} = $1; - # Module freedisk command redefinition - } elsif ($line =~ /^\s*module_freedisk_cmd\s+(.+)$/) { - PART_CMDS->{$OS} = $1; - # Collection - } elsif ($line =~ /^\s*file_collection\s+(.+)$/) { - my $collection = $1; - - # Prevent path traversal attacks - if ($collection !~ m/(\.\.)|\//) { - $Collections{$collection} = 0; - } - # Min critical - } elsif ($line =~ /^\s*module_min_critical\s+(.*)\s*$/) { - $module->{'min_critical'} = $1; - # Max critical - } elsif ($line =~ /^\s*module_max_critical\s+(.*)\s*$/) { - $module->{'max_critical'} = $1; - # Min warning - } elsif ($line =~ /^\s*module_min_warning\s+(.*)\s*$/) { - $module->{'min_warning'} = $1; - # Max warning - } elsif ($line =~ /^\s*module_max_warning\s+(.*)\s*$/) { - $module->{'max_warning'} = $1; - # Disabled - } elsif ($line =~ /^\s*module_disabled\s+(.*)\s*$/) { - $module->{'disabled'} = $1; - # Min ff event - } elsif ($line =~ /^\s*module_min_ff_event\s+(.*)\s*$/) { - $module->{'min_ff_event'} = $1; - # Unit - } elsif ($line =~ /^\s*module_unit\s+(.*)\s*$/) { - $module->{'unit'} = $1; - # Module_group - } elsif ($line =~ /^\s*module_group\s+(.*?)\s*$/) { - $module->{'module_group'} = $1; - # Custom id - } elsif ($line =~ /^\s*module_custom_id\s+(.*)\s*$/) { - $module->{'custom_id'} = $1; - # Str warning - } elsif ($line =~ /^\s*module_str_warning\s+(.*)\s*$/) { - $module->{'str_warning'} = $1; - # Str critical - } elsif ($line =~ /^\s*module_str_critical\s+(.*)\s*$/) { - $module->{'str_critical'} = $1; - # Critical instructions - } elsif ($line =~ /^\s*module_critical_instructions\s+(.*)\s*$/) { - $module->{'critical_instructions'} = $1; - # Warning instructions - } elsif ($line =~ /^\s*module_warning_instructions\s+(.*)\s*$/) { - $module->{'warning_instructions'} = $1; - # Unknown instructions - } elsif ($line =~ /^\s*module_unknown_instructions\s+(.*)\s*$/) { - $module->{'unknown_instructions'} = $1; - # Tags - } elsif ($line =~ /^\s*module_tags\s+(.*)\s*$/) { - $module->{'tags'} = $1; - # Critical inverse - } elsif ($line =~ /^\s*module_critical_inverse\s+(\S+)\s*$/) { - $module->{'critical_inverse'} = $1; - # Warning inverse - } elsif ($line =~ /^\s*module_warning_inverse\s+(\S+)\s*$/) { - $module->{'warning_inverse'} = $1; - # Quiet - } elsif ($line =~ /^\s*module_quiet\s+(\S+)\s*$/) { - $module->{'quiet'} = $1; - # FF interval - } elsif ($line =~ /^\s*module_ff_interval\s+(\S+)\s*$/) { - $module->{'module_ff_interval'} = $1; - } elsif ($line =~ /^\s*module_min_ff_event_normal\s+(\S+)\s*$/) { - $module->{'min_ff_event_normal'} = $1; - } elsif ($line =~ /^\s*module_min_ff_event_warning\s+(\S+)\s*$/) { - $module->{'min_ff_event_warning'} = $1; - } elsif ($line =~ /^\s*module_min_ff_event_critical\s+(\S+)\s*$/) { - $module->{'min_ff_event_critical'} = $1; - } elsif ($line =~ /^\s*module_ff_timeout\s+(\S+)\s*$/) { - $module->{'ff_timeout'} = $1; - } elsif ($line =~ /^\s*module_each_ff\s+(\S+)\s*$/) { - $module->{'each_ff'} = $1; - # Macros - } elsif ($line =~ /^\s*module_macro(\S+)\s+(.*)\s*$/) { - $module->{'macros'}{$1} = $2; - } - } - return; -} - -################################################################################ -# Create configuration file for broker agents. -################################################################################ -sub write_broker_conf($){ - my ($broker_agent) = @_; - my $content = ''; - - # I don't think the following should be copied either: proxy_* - my %ignored_tokens = ( - 'broker_agent' => 1, 'agent_name_cmd' => 1, 'udp_server' => 1, 'cron_mode' => 1 - ); - - open (CONF_FILE, "$ConfDir/$ConfFile") or error ("Could not open file '$ConfDir/$ConfFile': $!."); - open (BROKER_FILE, ">$ConfDir/${broker_agent}.conf") or error ("Could not write configuration file: $!"); - - while (my $line = ) { - - my ( $token ) = $line =~ m/^\s*(\S+)(\s.*)?$/; - # Skip tokens which should not be copied to broker configuration - next if defined $ignored_tokens{$token}; - - # Change the agent name - if ($line =~ m/^\s*#*\s*agent_name\s+/) { - $line = "agent_name $broker_agent\n"; - } - # Change the logfile - elsif ($line =~ m/^\s*logfile\s+(.*)/) { - $line = 'logfile ' . dirname ($1) . "/$broker_agent.log\n"; - } - - print BROKER_FILE $line; - } - close (BROKER_FILE); - close (CONF_FILE); -} - -################################################################################ -# Read configuration file. Exit on error. -################################################################################ -sub read_config (;$) { - my $token = shift; - my @found_tokens; - my $module; - - error ("File '$ConfDir/$ConfFile' not found.") unless (-e "$ConfDir/$ConfFile"); - open (CONF_FILE, "$ConfDir/$ConfFile") or error ("Could not open file '$ConfDir/$ConfFile': $!."); - - my @file = ; - close(CONF_FILE); - - foreach my $line (@file){ - # Skip comments and empty lines - next if ($line =~ m/^\s*#/) or ($line =~ m/^\s*$/); - - # Replace CRLF with LF - $line =~ s/\r\n/\n/g; - - # Token search - if (defined ($token)) { - if ($line =~ /^\s*(\S+)\s+(.*)$/ && $1 eq $token) { - - # Multiple value token - if (wantarray ()) { - push (@found_tokens, $2); - } - # Single value token - else { - return $2; - } - } - next; - } - - # Store the custom fields - - if (($line =~ m/^(custom_field\d+_name)\s+(.*)/) or ($line =~ m/^(custom_field\d+_value)\s+(.*)/)) { - $Customfields{$1} = $2; - next; - } - - # Save global macros - if ($line =~ m/^macro(\S+)\s+(.*)/) { - $Macros{$1} = $2; - next; - } - - next if ($line =~ /^module\s*\w*/); - - #Configuration token - if ($line =~ /^\s*(\S+)\s+(.*)$/) { - log_message ('setup', "$1 is $2"); - $Conf{$1} = $2; - - # Look for broker agents. - if ($1 eq 'broker_agent') { - $BrokerEnabled = 1; - } - - # Remove trailing spaces - $Conf{$1} =~ s/\s*$//; - } - } - - # Token search - if (defined ($token)) { - - # Multiple value token - if (wantarray ()) { - return @found_tokens; - } - - # Single value token not found. - return undef; - } - - # Set the intensive interval - if ($Conf{'intensive_interval'} == 0) { - $Conf{'intensive_interval'} = $Conf{'interval'}; - } - - # Search for includes after all other variables have been set - foreach my $line (@file) { - - # Skip comments and empty lines - next if ($line =~ m/^\s*#/) or ($line =~ m/^\s*$/); - - # Replace CRLF with LF - $line =~ s/\r\n/\n/g; - - # Additional configuration file - if ($line =~ /^include\s+(.*)\s*/) { - $Conf{'include'} = $Conf{'include'} ? "$Conf{'include'} $1" : $1; - - foreach my $file_name (glob("$1")) { - open (FILE, "$file_name") or next; - - log_message ('setup', "reading $file_name"); - my @file_conf = ; - parse_conf_modules(\@file_conf); - close (FILE); - } - next; - } - } - - # Module, plugin and collection definitions - parse_conf_modules(\@file); - - # If agent_name_cmd is defined, agent_name is set by command result. - if ($Conf{'agent_name'} eq '') { - if ($Conf{'agent_name_cmd'} eq '__rand__') { - $Conf{'agent_name'} = generate_agent_name(); - config_update('agent_name', $Conf{'agent_name'}); - } elsif ($Conf{'agent_name_cmd'} ne '') { - my $result = `$Conf{'agent_name_cmd'}`; - - # Use only the first line. - my ($temp_agent_name, $remain) = split(/\n/, $result); - chomp ($temp_agent_name); - - # Remove white spaces of the first and last. - $temp_agent_name =~ s/^ *(.*?) *$/$1/; - - $Conf{'agent_name'} = $temp_agent_name if ($temp_agent_name ne ''); - } else { - $Conf{'agent_name'} = hostname(); - } - } - - # Update the agent MD5 since agent_name may have changed - $AgentMD5 = md5 ($Conf{'agent_name'}); - $RemoteConfFile = "$AgentMD5.conf"; - $RemoteMD5File = "$AgentMD5.md5"; - - # Load thread support if agent_threads is greater than 1. - if ($Conf{'agent_threads'} > 1) { - eval { - local $SIG{__DIE__}; - require threads; - require threads::shared; - require Thread::Semaphore; - }; - if (!$@) { - $Sem = Thread::Semaphore->new; - $ThreadSem = Thread::Semaphore->new ($Conf{'agent_threads'}); - threads::shared::share (\$Xml); - threads::shared::share (\$Sem); - log_message ('log', 'Using thread library.'); - } else { - log_message ('log', 'Thread library is not available. agent_threads is set to 1 (disabled).'); - $Conf{'agent_threads'} = 1; - $Sem = undef; - $ThreadSem = undef; - } - } else { - $Sem = undef; - $ThreadSem = undef; - log_message ('log', 'Thread is disabled.'); - } - - # Accept 'yes' for backward compatibility - $Conf{'server_ssl'} = '1' if ($Conf{'server_ssl'} eq 'yes'); - $Conf{'secondary_server_ssl'} = '1' if ($Conf{'secondary_server_ssl'} eq 'yes'); - - # Set tentacle client options - if ($Conf{'transfer_mode'} eq 'tentacle') { - $Conf{'server_opts'} = '-x \'' . $Conf{'server_pwd'} . '\' ' . $Conf{'server_opts'} if ($Conf{'server_pwd'} ne ''); - $Conf{'server_opts'} = '-c ' . $Conf{'server_opts'} if ($Conf{'server_ssl'} eq '1'); - } - - # Set tentacle client options for secondary server - if ($Conf{'secondary_transfer_mode'} eq 'tentacle') { - $Conf{'secondary_server_opts'} = '-x \'' . $Conf{'secondary_server_pwd'} . '\' ' . $Conf{'secondary_server_opts'} if ($Conf{'secondary_server_pwd'} ne ''); - $Conf{'secondary_server_opts'} = '-c ' . $Conf{'secondary_server_opts'} if ($Conf{'secondary_server_ssl'} eq '1'); - } -} - -################################################################################# -## Remove any trailing / from directory names. -################################################################################# -sub fix_directory ($) { - my $dir = shift; - - my $char = chop ($dir); - return $dir if ($char eq '/'); - return $dir . $char; -} - - - -################################################################################ -# Sends a file to the server. -################################################################################ -#sub send_file ($;$) { -sub send_file { - my ($file, $secondary) = @_; - my $output; - - my $pid = fork(); - return 1 unless defined $pid; - - if ($pid == 0) { - # execute the transfer program by child process. - eval { - local $SIG{'ALRM'} = sub {die}; - alarm ($Conf{'transfer_timeout'}); - if ($Conf{'transfer_mode'} eq 'tentacle') { - $output = `tentacle_client -v -a $Conf{'server_ip'} -p $Conf{'server_port'} $Conf{'server_opts'} "$file" 2>&1 >$DevNull`; - } elsif ($Conf{'transfer_mode'} eq 'ssh') { - $output = `scp -P $Conf{'server_port'} "$file" pandora@"$Conf{'server_ip'}:$Conf{'server_path'}" 2>&1 >$DevNull`; - } elsif ($Conf{'transfer_mode'} eq 'ftp') { - my $base = basename ($file); - my $dir = dirname ($file); - - $output = `ftp -n $Conf{'server_opts'} $Conf{'server_ip'} $Conf{'server_port'} 2>&1 >$DevNull <&1 >$DevNull`; - } - alarm (0); - }; - - if ($@) { - log_message ('error', "Error sending file '$file': File transfer command is not responding."); - exit 1; - } - - # Get the errorlevel - my $rc = $? >> 8; - if ($rc != 0) { - log_message ('error', "Error sending file '$file': $output"); - } - exit $rc; - } - - # Wait the child process termination and get the errorlevel - waitpid ($pid, 0); - my $rc = $? >> 8; - - return $rc unless (defined ($secondary)); - - # Send the file to the secondary server - return $rc unless ($Conf{'secondary_mode'} eq 'always' || ($Conf{'secondary_mode'} eq 'on_error' && $rc != 0)); - - swap_servers (); - $rc = send_file ($file); - swap_servers (); - return $rc; -} - -################################################################################ -# Send buffered XML files. -################################################################################ -sub send_buffered_xml_files () { - - # Read XML files from the temporal directory - opendir(TEMPORAL, $Conf{'temporal'}) or return; - while (my $xml_file = readdir(TEMPORAL)) { - - # Skip non data files and symlinks - next if ($xml_file !~ m/^$Conf{'agent_name'}\.[0-9]+\.data$/ || -l "$Conf{'temporal'}/$xml_file"); - - my $rc = send_file ("$Conf{'temporal'}/$xml_file", 1); - - if ($rc == 0) { - if ($Conf{'debug'} eq '1') { - rename "$Conf{'temporal'}/$xml_file", "$Conf{'temporal'}/$xml_file". "sent"; - } else { - unlink ("$Conf{'temporal'}/$xml_file"); - } - } - } -} - -################################################################################ -# Swap primary and secondary servers. -################################################################################ -sub swap_servers () { - ($Conf{'server_ip'}, $Conf{'secondary_server_ip'}) = ($Conf{'secondary_server_ip'}, $Conf{'server_ip'}); - ($Conf{'server_path'}, $Conf{'secondary_server_path'}) = ($Conf{'secondary_server_path'}, $Conf{'server_path'}); - ($Conf{'server_port'}, $Conf{'secondary_server_port'}) = ($Conf{'secondary_server_port'}, $Conf{'server_port'}); - ($Conf{'transfer_mode'}, $Conf{'secondary_transfer_mode'}) = ($Conf{'secondary_transfer_mode'}, $Conf{'transfer_mode'}); - ($Conf{'transfer_timeout'}, $Conf{'secondary_transfer_timeout'}) = ($Conf{'secondary_transfer_timeout'}, $Conf{'transfer_timeout'}); - ($Conf{'server_user'}, $Conf{'secondary_server_user'}) = ($Conf{'secondary_server_user'}, $Conf{'server_user'}); - ($Conf{'server_pwd'}, $Conf{'secondary_server_pwd'}) = ($Conf{'secondary_server_pwd'}, $Conf{'server_pwd'}); - ($Conf{'server_ssl'}, $Conf{'secondary_server_ssl'}) = ($Conf{'secondary_server_ssl'}, $Conf{'server_ssl'}); - ($Conf{'server_opts'}, $Conf{'secondary_server_opts'}) = ($Conf{'secondary_server_opts'}, $Conf{'server_opts'}); -} - -################################################################################ -# Receive a file from the server. -################################################################################ -sub recv_file ($) { - my $file = shift; - my $output; - - my $pid = fork(); - return 1 unless defined $pid; - - if ($pid == 0) { - # execute the transfer program by child process. - eval { - local $SIG{'ALRM'} = sub {die}; - alarm ($Conf{'transfer_timeout'}); - if ($Conf{'transfer_mode'} eq 'tentacle') { - $output = `cd "$Conf{'temporal'}"$CmdSep tentacle_client -v -g -a $Conf{'server_ip'} -p $Conf{'server_port'} $Conf{'server_opts'} $file 2>&1 >$DevNull` - } elsif ($Conf{'transfer_mode'} eq 'ssh') { - $output = `scp -P $Conf{'server_port'} pandora@"$Conf{'server_ip'}:$Conf{'server_path'}/$file" $Conf{'temporal'} 2>&1 >$DevNull`; - } elsif ($Conf{'transfer_mode'} eq 'ftp') { - my $base = basename ($file); - my $dir = dirname ($file); - - $output = `ftp -n $Conf{'server_opts'} $Conf{'server_ip'} $Conf{'server_port'} 2>&1 >$DevNull <&1 >$DevNull`; - } - alarm (0); - }; - - if ($@) { - log_message ('error', "Error retrieving file: File transfer command is not responding."); - exit 1; - } - - # Get the errorlevel - my $rc = $? >> 8; - if ($rc != 0) { - log_message ('error', "Error retrieving file: $output"); - } - exit $rc; - } - - # Wait the child process termination and get the errorlevel - waitpid ($pid, 0); - my $rc = $? >> 8; - - return $rc; -} - -################################################################################ -# Check the server for a remote configuration. -################################################################################ -sub check_remote_config () { - - return unless ($Conf{'remote_config'} eq '1'); - - # Calculate the configuration file MD5 digest - open (CONF_FILE, "$ConfDir/$ConfFile") or error ("Could not open file '$ConfDir/$ConfFile': $!."); - binmode(CONF_FILE); - my $conf_md5 = md5 (join ('', )); - close (CONF_FILE); - - # Remove temporary files if they exist as symlink to avoid symlink attack - for my $file ("$Conf{'temporal'}/$RemoteMD5File", "$Conf{'temporal'}/$RemoteConfFile") { - error ("File '$file' already exists as a symlink and could not be removed: $!") if (-l $file && ! unlink($file)); - } - - # Get the remote MD5 file - if (recv_file ($RemoteMD5File) != 0) { - open (MD5_FILE, "> $Conf{'temporal'}/$RemoteMD5File") || error ("Could not open file '$ConfDir/$RemoteMD5File' for writing: $!."); - print MD5_FILE $conf_md5; - close (MD5_FILE); - copy ("$ConfDir/$ConfFile", "$Conf{'temporal'}/$RemoteConfFile"); - send_file ("$Conf{'temporal'}/$RemoteConfFile"); - send_file ("$Conf{'temporal'}/$RemoteMD5File"); - log_message ('remote config', 'Uploading configuration for the first time.'); - unlink ("$Conf{'temporal'}/$RemoteConfFile"); - unlink ("$Conf{'temporal'}/$RemoteMD5File"); - return; - } - - open (MD5_FILE, "< $Conf{'temporal'}/$RemoteMD5File") || error ("Could not open file '$ConfDir/$RemoteMD5File' for writing: $!."); - my $remote_conf_md5 = ; - close (MD5_FILE); - - # No changes - return if ($remote_conf_md5 eq $conf_md5); - - # Get the new configuration file - return if (recv_file ($RemoteConfFile) != 0); - log_message ('remote config', 'Configuration has changed!'); - - # Save the new configuration - move ("$Conf{'temporal'}/$RemoteConfFile", "$ConfDir/$ConfFile"); - - # Empty macros, modules, plugins and collections - %Macros = (); - @Modules = (); - %Collections = (); - %Conf = %DefaultConf; - - # Reload the new configuration - read_config (); - - # Log file may have changed - stop_log (); - start_log ('quiet'); - - #Set nice of the pandora_agent - my $PID = $$; - `renice "$Conf{'pandora_nice'}" "$PID"`; -} - -################################################################################ -# SUB launch_tentacle_proxy -# Launchs tentacle server in proxy mode. -################################################################################ -sub launch_tentacle_proxy () { - # Check if proxy server ip is right. - if ($Conf{'server_ip'} ne "localhost") { - - #Create a new process and launch tentacle. - $tentacle_pid = fork(); - - if ($tentacle_pid == 0) { - - #Execute tentacle server as a daemon - my $new_process = "tentacle_server -b ".$Conf{'server_ip'}." -g ".$Conf{'server_port'}." -c ".$Conf{'proxy_max_connection'}." -t ".$Conf{'proxy_timeout'}; - - $new_process .= ' -C' if ($Conf{'server_ssl'} eq '1'); - - log_message ('setup', 'Proxy mode enabled'); - exec ($new_process); - } - } else { - log_message ('error', 'You can not proxy to localhost'); - exit 1; - } -} - -################################################################################ -# Delete old collections and download new collections. -################################################################################ -sub check_collections () { - - # Delete old collections if there are no broker agents - if ($BrokerEnabled == 0) { - opendir (DIR, "$ConfDir/collections") || return; - while (defined (my $file_name = readdir(DIR))) { - next if ($file_name eq '.' || $file_name eq '..'); - - # Do not delete md5 files associated to a collection - $file_name =~ s/\.md5$//; - - if (! defined ($Collections{$file_name})) { - rmrf ("$ConfDir/collections/$file_name"); - unlink ("$ConfDir/collections/$file_name.md5"); - } - } - closedir (DIR); - } - - # Download new collections - while (my ($collection, $in_path) = each (%Collections)) { - my $collection_file = $collection . ".zip"; - my $collection_md5_file = $collection . ".md5"; - - # Add the collection directory to the PATH - if ($in_path == 0) { - $Collections{$collection} = 1; - $ENV{'PATH'} .= ":$ConfDir/collections/$collection"; - } - - # Get remote md5 - error ("File '$Conf{'temporal'}/$collection_md5_file' already exists as a symlink and could not be removed: $!.") if (-l "$Conf{'temporal'}/$collection_md5_file" && !unlink("$Conf{'temporal'}/$collection_md5_file")); - next unless (recv_file ($collection_md5_file) == 0); - open (MD5_FILE, "< $Conf{'temporal'}/$collection_md5_file") || error ("Could not open file '$Conf{'temporal'}/$collection_md5_file' for reading: $!."); - my $remote_collection_md5 = ; - close (MD5_FILE); - unlink ("$Conf{'temporal'}/$collection_md5_file"); - - # Read local md5 - my $local_collection_md5 = ''; - if (defined (open (MD5_FILE, "< $ConfDir/collections/$collection_md5_file"))) { - $local_collection_md5 = ; - close MD5_FILE; - } - - # Check for changes - $local_collection_md5 = $remote_collection_md5 unless defined ($local_collection_md5); - next if ($local_collection_md5 eq $remote_collection_md5); - - # Download and unzip - next unless (recv_file ($collection_file) == 0); - rmrf ("$ConfDir/collections/$collection"); - `unzip -d "$ConfDir/collections/$collection" "$Conf{'temporal'}/$collection_file" 2>$DevNull`; - unlink ("$Conf{'temporal'}/$collection_file"); - - # Save the new md5 - open (MD5_FILE, "> $ConfDir/collections/$collection_md5_file") || error ("Could not open file '$ConfDir/collections/$collection_md5_file' for writing: $!."); - print MD5_FILE "$remote_collection_md5"; - close (MD5_FILE); - - # Set proper file permissions - chmodr (0750, "$ConfDir/collections/$collection"); - } -} - -############################################################################### -# Return the MD5 checksum of the given string as a hex string. -# Pseudocode from: http://en.wikipedia.org/wiki/MD5#Pseudocode -############################################################################### -my @S = ( - 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, - 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, - 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, - 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21 -); -my @K = ( - 0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee, - 0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501, - 0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be, - 0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821, - 0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa, - 0xd62f105d, 0x02441453, 0xd8a1e681, 0xe7d3fbc8, - 0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed, - 0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a, - 0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c, - 0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70, - 0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x04881d05, - 0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665, - 0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039, - 0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1, - 0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1, - 0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391 -); -sub md5 { - my $str = shift; - - # No input! - if (!defined($str)) { - return ""; - } - - # Note: All variables are unsigned 32 bits and wrap modulo 2^32 when - # calculating. - - # Initialize variables. - my $h0 = 0x67452301; - my $h1 = 0xEFCDAB89; - my $h2 = 0x98BADCFE; - my $h3 = 0x10325476; - - # Pre-processing. - my $msg = unpack ("B*", pack ("A*", $str)); - my $bit_len = length ($msg); - - # Append "1" bit to message. - $msg .= '1'; - - # Append "0" bits until message length in bits ≡ 448 (mod 512). - $msg .= '0' while ((length ($msg) % 512) != 448); - - # Append bit /* bit, not byte */ length of unpadded message as 64-bit - # little-endian integer to message. - $msg .= unpack ("B32", pack ("V", $bit_len)); - $msg .= unpack ("B32", pack ("V", $bit_len >> 32)); - - # Process the message in successive 512-bit chunks. - for (my $i = 0; $i < length ($msg); $i += 512) { - - my @w; - my $chunk = substr ($msg, $i, 512); - - # Break chunk into sixteen 32-bit little-endian words w[i], 0 <= i <= - # 15. - for (my $j = 0; $j < length ($chunk); $j += 32) { - push (@w, unpack ("V", pack ("B32", substr ($chunk, $j, 32)))); - } - - # Initialize hash value for this chunk. - my $a = $h0; - my $b = $h1; - my $c = $h2; - my $d = $h3; - my $f; - my $g; - - # Main loop. - for (my $y = 0; $y < 64; $y++) { - if ($y <= 15) { - $f = $d ^ ($b & ($c ^ $d)); - $g = $y; - } - elsif ($y <= 31) { - $f = $c ^ ($d & ($b ^ $c)); - $g = (5 * $y + 1) % 16; - } - elsif ($y <= 47) { - $f = $b ^ $c ^ $d; - $g = (3 * $y + 5) % 16; - } - else { - $f = $c ^ ($b | (0xFFFFFFFF & (~ $d))); - $g = (7 * $y) % 16; - } - - my $temp = $d; - $d = $c; - $c = $b; - $b = ($b + leftrotate (($a + $f + $K[$y] + $w[$g]) % POW232, $S[$y])) % POW232; - $a = $temp; - } - - # Add this chunk's hash to result so far. - $h0 = ($h0 + $a) % POW232; - $h1 = ($h1 + $b) % POW232; - $h2 = ($h2 + $c) % POW232; - $h3 = ($h3 + $d) % POW232; - } - - # Digest := h0 append h1 append h2 append h3 #(expressed as little-endian) - return unpack ("H*", pack ("V", $h0)) . - unpack ("H*", pack ("V", $h1)) . - unpack ("H*", pack ("V", $h2)) . - unpack ("H*", pack ("V", $h3)); -} - -############################################################################### -# MD5 leftrotate function. See: http://en.wikipedia.org/wiki/MD5#Pseudocode -############################################################################### -sub leftrotate { - my ($x, $c) = @_; - - return (0xFFFFFFFF & ($x << $c)) | ($x >> (32 - $c)); -} - -############################################################################### -# Return the SHA256 checksum of the given string as a hex string. -# Pseudocode from: http://en.wikipedia.org/wiki/SHA-2#Pseudocode -############################################################################### -my @K2 = ( - 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, - 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, - 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, - 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, - 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, - 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, - 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, - 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, - 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, - 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, - 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 -); -sub sha256 { - my $str = shift; - - # No input! - if (!defined($str)) { - return ""; - } - - # Note: All variables are unsigned 32 bits and wrap modulo 2^32 when - # calculating. - - # First 32 bits of the fractional parts of the square roots of the first 8 - # primes. - my $h0 = 0x6a09e667; - my $h1 = 0xbb67ae85; - my $h2 = 0x3c6ef372; - my $h3 = 0xa54ff53a; - my $h4 = 0x510e527f; - my $h5 = 0x9b05688c; - my $h6 = 0x1f83d9ab; - my $h7 = 0x5be0cd19; - - # Pre-processing. - my $msg = unpack ("B*", pack ("A*", $str)); - my $bit_len = length ($msg); - - # Append "1" bit to message. - $msg .= '1'; - - # Append "0" bits until message length in bits = 448 (mod 512). - $msg .= '0' while ((length ($msg) % 512) != 448); - - # Append bit /* bit, not byte */ length of unpadded message as 64-bit - # big-endian integer to message. - $msg .= unpack ("B32", pack ("N", $bit_len >> 32)); - $msg .= unpack ("B32", pack ("N", $bit_len)); - - # Process the message in successive 512-bit chunks. - for (my $i = 0; $i < length ($msg); $i += 512) { - - my @w; - my $chunk = substr ($msg, $i, 512); - - # Break chunk into sixteen 32-bit big-endian words. - for (my $j = 0; $j < length ($chunk); $j += 32) { - push (@w, unpack ("N", pack ("B32", substr ($chunk, $j, 32)))); - } - - # Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array: - for (my $i = 16; $i < 64; $i++) { - my $s0 = rightrotate($w[$i - 15], 7) ^ rightrotate($w[$i - 15], 18) ^ ($w[$i - 15] >> 3); - my $s1 = rightrotate($w[$i - 2], 17) ^ rightrotate($w[$i - 2], 19) ^ ($w[$i - 2] >> 10); - $w[$i] = ($w[$i - 16] + $s0 + $w[$i - 7] + $s1) % POW232; - } - - # Initialize working variables to current hash value. - my $a = $h0; - my $b = $h1; - my $c = $h2; - my $d = $h3; - my $e = $h4; - my $f = $h5; - my $g = $h6; - my $h = $h7; - - # Compression function main loop. - for (my $i = 0; $i < 64; $i++) { - my $S1 = rightrotate($e, 6) ^ rightrotate($e, 11) ^ rightrotate($e, 25); - my $ch = ($e & $f) ^ ((0xFFFFFFFF & (~ $e)) & $g); - my $temp1 = ($h + $S1 + $ch + $K2[$i] + $w[$i]) % POW232; - my $S0 = rightrotate($a, 2) ^ rightrotate($a, 13) ^ rightrotate($a, 22); - my $maj = ($a & $b) ^ ($a & $c) ^ ($b & $c); - my $temp2 = ($S0 + $maj) % POW232; - - $h = $g; - $g = $f; - $f = $e; - $e = ($d + $temp1) % POW232; - $d = $c; - $c = $b; - $b = $a; - $a = ($temp1 + $temp2) % POW232; - } - - # Add the compressed chunk to the current hash value. - $h0 = ($h0 + $a) % POW232; - $h1 = ($h1 + $b) % POW232; - $h2 = ($h2 + $c) % POW232; - $h3 = ($h3 + $d) % POW232; - $h4 = ($h4 + $e) % POW232; - $h5 = ($h5 + $f) % POW232; - $h6 = ($h6 + $g) % POW232; - $h7 = ($h7 + $h) % POW232; - } - - # Produce the final hash value (big-endian). - return unpack ("H*", pack ("N", $h0)) . - unpack ("H*", pack ("N", $h1)) . - unpack ("H*", pack ("N", $h2)) . - unpack ("H*", pack ("N", $h3)) . - unpack ("H*", pack ("N", $h4)) . - unpack ("H*", pack ("N", $h5)) . - unpack ("H*", pack ("N", $h6)) . - unpack ("H*", pack ("N", $h7)); -} - -############################################################################### -# Rotate a 32-bit number a number of bits to the right. -############################################################################### -sub rightrotate { - my ($x, $c) = @_; - - return (0xFFFFFFFF & ($x << (32 - $c))) | ($x >> $c); -} - -################################################################################ -# Try to guess the OS version. -################################################################################ -sub guess_os_version ($) { - my $os = shift; - my $os_version; - - # Linux - if ($os eq 'linux') { - $os_version = `lsb_release -sd 2>$DevNull`; - # AIX - } elsif ($os eq 'aix') { - $os_version = "$2.$1" if (`uname -rv` =~ /\s*(\d)\s+(\d)\s*/); - # Windows - } elsif ($os =~ /win/i) { - $os_version = `ver`; - $DevNull = '/Nul'; - $CmdSep = '\&'; - $OS = "windows"; - - # Solaris, HP-UX, BSD and others - } else { - $os_version = `uname -r`; - } - - # Something went wrong - return '' unless defined ($os_version); - - # Remove any trailing new lines - chomp ($os_version); - - return $os_version; -} - -################################################################################ -# Execute the given module. -################################################################################ -sub exec_module ($) { - my $module = shift; - - # Need something to execute - if ($module->{'func'} == 0) { - $ThreadSem->up () if (defined ($ThreadSem) && $Conf{'agent_threads'} > 1); - return; - } - - # Check module interval - if (++($module->{'counter'}) < $module->{'intensive_interval'}) { - $ThreadSem->up () if (defined ($ThreadSem) && $Conf{'agent_threads'} > 1); - return; - } - - # Check module cron - if (check_module_cron ($module) != 1) { - $ThreadSem->up () if (defined ($ThreadSem) && $Conf{'agent_threads'} > 1); - return; - } - - # Check module preconditions - if (evaluate_module_preconditions ($module) == 0) { - return; - } - - # Reset module counter - $module->{'counter'} = 0; - - # Temporarily disable strict refs - no strict 'refs'; - - # Run - my @value = &{$module->{'func'}}($module); - if (defined ($value[0])) { - - # Evaluate intensive conditions - if ($module->{'is_intensive'} == 1) { - my $intensive_match = evaluate_module_intensive_conditions ($module, $value[0]); - if ($intensive_match == $module->{'intensive_match'} && $module->{'timestamp'} + $module->{'interval'} * $Conf{'interval'} > time ()) { - $ThreadSem->up () if (defined ($ThreadSem) && $Conf{'agent_threads'} > 1); - return; - } - - # Update the time reference - $module->{'timestamp'} = time () if ($module->{'timestamp'} + $module->{'interval'} * $Conf{'interval'} <= time ()); - - # Update the intensive match status - $module->{'intensive_match'} = $intensive_match; - } - - # Evaluate module conditions - evaluate_module_conditions ($module, $value[0]); - - # Write the module XML - write_module_xml ($module, @value); - } - - # Save the module value if needed (only works for the first returned value) - if ($module->{'save'} ne '') { - if (defined ($value[0])) { - $ENV{$module->{'save'}} = $value[0] ; - } else { - $ENV{$module->{'save'}} = ''; - } - } - - $ThreadSem->up () if (defined ($ThreadSem) && $Conf{'agent_threads'} > 1); -} - -################################################################################ -# Load process information. -################################################################################ -sub load_procs () { - my $utimestamp = time (); - - # Do we know hoy to get process information in this OS? - return unless defined (PROC_CMDS->{$OS}); - - # Update at most once every interval - return if ($Procs{'__utimestamp__'} > ($utimestamp - $Conf{'interval'})); - - # Get process information - my $cmd = PROC_CMDS->{$OS}; - my @procs = `$cmd`; - return undef unless ($? eq 0); - - # Clear past process infomation - %Procs = (); - - # Parse process information - foreach my $proc (@procs) { - - chomp ($proc); - my @proc_info = split (/\s+/, $proc); - next unless ($#proc_info >= 2); - - # Process command - my $proc_cmd = join (' ', @proc_info[2..$#proc_info]); - - # Process command - $Procs{$proc_cmd} = (); - - # Process CPU usage - $Procs{$proc_cmd}{'cpu'} = $proc_info[0]; - - # Process virtual size - $Procs{$proc_cmd}{'size'} = $proc_info[1]; - } - - $Procs{'__utimestamp__'} = $utimestamp; -} - -################################################################################ -# Load partition information. -################################################################################ -sub load_parts () { - my $utimestamp = time (); - - # Do we know hoy to get partition information in this OS? - return unless defined (PART_CMDS->{$OS}); - - # Update at most once every interval - return if ($Parts{'__utimestamp__'} > ($utimestamp - $Conf{'interval'})); - - # Get partition information - my $cmd = PART_CMDS->{$OS}; - my @parts = `$cmd`; - return undef unless ($? eq 0); - - # Parse partition information - foreach my $part (@parts) { - - chomp ($part); - my @part_info = split (/\s+/, $part); - next unless ($#part_info >= 2); - - my $part = join (' ', @part_info[2..$#part_info]); - - # Mount point - $Parts{$part} = (); - - # Total space in kB - $Parts{$part}{'total'} = $part_info[0]; - - # Available space in kB - $Parts{$part}{'avail'} = $part_info[1]; - } - - $Parts{'__utimestamp__'} = $utimestamp; -} - -################################################################################ -# Execute the given command. -################################################################################ -sub module_exec ($) { - my $module = shift; - my @data; - my $exe; - - # Check module parameters - return () unless ($module->{'params'} ne ''); - - my $params = $module->{'params'}; - - # Execute the command - if ($module->{'timeout'} == 0) { - @data = `$params 2> $DevNull`; - log_message ('debug', "Executing module " . $module->{'name'} . " ($params 2> $DevNull)") if ($Conf{'debug'} eq '1'); - } else { - my $cmd = quotemeta ($params); - @data = `$Conf{'pandora_exec'} $module->{'timeout'} $cmd 2> $DevNull`; - log_message ('debug', "Executing module " . $module->{'name'} . ' (' . $Conf{'pandora_exec'} . ' ' . $module->{'timeout'} . " $cmd 2> $DevNull)") if ($Conf{'debug'} eq '1'); - } - - # Something went wrong or no data - return () unless ($? eq 0 && defined ($data[0])); - - return @data; -} - -################################################################################ -# Get the status of a process. 1 running, 0 not running. -################################################################################ -sub module_proc ($) { - my $module = shift; - - # Check module parameters - return () unless ($module->{'params'} ne ''); - - # Data collection layer - load_procs (); - - return (1) if defined ($Procs{$module->{'params'}}); - return (0); -} - -################################################################################ -# Get the CPU usage of a process. -################################################################################ -sub module_cpuproc ($) { - my $module = shift; - - # Check module parameters - return () unless ($module->{'params'} ne ''); - - # Data collection layer - load_procs (); - - return () unless defined ($Procs{$module->{'params'}}) and defined ($Procs{$module->{'params'}}{'cpu'}); - return ($Procs{$module->{'params'}}{'cpu'}); -} - -################################################################################ -# Get the memory usage of a process in Mbytes. -################################################################################ -sub module_memproc ($) { - my $module = shift; - - # Check module parameters - return () unless ($module->{'params'} ne ''); - - # Data collection layer - load_procs (); - - return () unless defined ($Procs{$module->{'params'}}) and defined ($Procs{$module->{'params'}}{'size'}); - return (sprintf ("%d", $Procs{$module->{'params'}}{'size'} / 1024)); -} - -################################################################################ -# Get the free space in a partition in Mbytes. -################################################################################ -sub module_freedisk ($) { - my $module = shift; - - # Check module parameters - return () unless ($module->{'params'} ne ''); - - # Data collection layer - load_parts (); - - return () unless defined ($Parts{$module->{'params'}}) and defined ($Parts{$module->{'params'}}{'avail'}); - - my $avail = sprintf("%d", $Parts{$module->{'params'}}{'avail'} / 1024); - return ($avail); -} - -################################################################################ -# Get the free space in a partition in %. -################################################################################ -sub module_freepercentdisk ($) { - my $module = shift; - - # Check module parameters - return () unless ($module->{'params'} ne ''); - - # Data collection layer - load_parts (); - - return () unless defined ($Parts{$module->{'params'}}) and defined ($Parts{$module->{'params'}}{'avail'}); - - my $availp = sprintf("%d", $Parts{$module->{'params'}}{'avail'} * 100 / $Parts{$module->{'params'}}{'total'}); - return ($availp); -} - -################################################################################ -# Get the occupied space in a partition in %. -################################################################################ -sub module_occupiedpercentdisk ($) { - my $module = shift; - - # Check module parameters - return () unless ($module->{'params'} ne ''); - - # Data collection layer - load_parts (); - - return () unless defined ($Parts{$module->{'params'}}) and defined ($Parts{$module->{'params'}}{'avail'}); - - my $occupiedp = sprintf("%d", ($Parts{$module->{'params'}}{'total'} - $Parts{$module->{'params'}}{'avail'}) * 100 / $Parts{$module->{'params'}}{'total'}); - return ($occupiedp); -} - -################################################################################ -# Get the CPU usage %. -################################################################################ -sub module_cpuusage ($) { - my $module = shift; - - # Do we know hoy to get CPU usage in this OS? - return unless defined (CPUUSAGE_CMDS->{$OS}); - - # Get CPU usage - my $cmd = CPUUSAGE_CMDS->{$OS}; - my @data = `$cmd 2> $DevNull`; - - # Something went wrong or no data - return () unless ($? eq 0 && defined ($data[0])); - - return ($data[0]); -} - -################################################################################ -# Get the free space in a partition in Mbytes. -################################################################################ -sub module_freememory ($) { - my $module = shift; - - # Do we know hoy to get memory information in this OS? - return () unless defined (FREEMEMORY_CMDS->{$OS}); - - # Get available memory - my $cmd = FREEMEMORY_CMDS->{$OS}; - my @data = `$cmd 2> $DevNull`; - - # Something went wrong or no data - return () unless ($? eq 0 && defined ($data[0])); - - return (sprintf ("%d", $data[0] / 1024)); -} - -################################################################################ -# Get the free space in a partition in %. -################################################################################ -sub module_freepercentmemory ($) { - my $module = shift; - - # Do we know hoy to get memory information in this OS? - return unless defined (TOTALMEMORY_CMDS->{$OS}); - - # Get CPU usage - my $cmd = TOTALMEMORY_CMDS->{$OS}; - my @data = `$cmd 2> $DevNull`; - - # Something went wrong or no data - return () unless ($? eq 0 && defined ($data[0])); - - # Get total memory in MB - my $total = sprintf ("%d", $data[0] / 1024); - - # Get available memory in MB - my ($avail) = module_freememory ($module); - return () unless defined ($avail); - - return sprintf (("%d", $avail * 100 / $total)); -} - -################################################################################ -# Evaluate and execute module preconditions. -################################################################################ -sub evaluate_module_preconditions ($) { - my ($module) = @_; - - # Evaluate preconditions - foreach my $precondition (@{$module->{'precondition'}}) { - my $data = `$precondition->{'command'} 2> $DevNull`; - return 0 if (evaluate_condition ($precondition, $data) == 0); - } - - return 1; -} - -################################################################################ -# Evaluate a module condition. Returns 1 if the condition matches, 0 otherwise. -################################################################################ -sub evaluate_condition ($$) { - my ($condition, $data) = @_; - - { - no warnings; - if (($condition->{'operator'} eq '>' && $data > $condition->{'value_1'}) || - ($condition->{'operator'} eq '<' && $data < $condition->{'value_1'}) || - ($condition->{'operator'} eq '=' && $data == $condition->{'value_1'}) || - ($condition->{'operator'} eq '!=' && $data != $condition->{'value_1'}) || - ($condition->{'operator'} eq '=~' && $data =~ /$condition->{'value_1'}/) || - ($condition->{'operator'} eq '()' && $data > $condition->{'value_1'} && $data < $condition->{'value_2'})) { - return 1; - } - } - - return 0; -} - - -################################################################################ -# Evaluate and execute module conditions. -################################################################################ -sub evaluate_module_conditions ($$) { - my ($module, $data) = @_; - - # Evaluate conditions - foreach my $condition (@{$module->{'conditions'}}) { - if (evaluate_condition ($condition, $data) == 1) { - `$condition->{'command'} 2> $DevNull`; - } - } -} - -################################################################################ -# Evaluate intensive conditions. -################################################################################ -sub evaluate_module_intensive_conditions ($$) { - my ($module, $data) = @_; - - # Evaluate conditions - foreach my $condition (@{$module->{'intensive_conditions'}}) { - return 0 if (evaluate_condition ($condition, $data) == 0); - } - - return 1; -} - -################################################################################ -# Checks the module's cron string. Returns 1 if the module should be run, 0 if -# not. -################################################################################ -sub check_module_cron ($) { - my $module = shift; - - # No cron string defined - return 1 unless ($module->{'cron'} ne ''); - - # Check if the module was already executed - return 0 unless (time() >= $module->{'cron_utimestamp'}); - - # Get cron configuration - my @cron_params = split (/\s/, $module->{'cron'}); - - # Get current time - my $current_time = time(); - my @time = localtime($current_time); - - # Minutes, hours, day of the month, month and day of the week - my @time_params = @time[1, 2, 3, 4, 6]; - - # Fix month (localtime retuns 0..11 and we need 1..12) - $time_params[3] += 1; - - # Check cron parameters - for (my $i = 0; $i < 5; $i++) { - - # Wildcard - next if ($cron_params[$i] eq '*'); - - # Get interval - my ($bottom, $top) = split (/-/, $cron_params[$i]); - $top = $bottom unless defined ($top); - - # Check if next execution will overflow the cron (only minutes overflow) - # If overflow, execute the module - my $overflow_cron = 0; - if ($i == 0) { - my $start_cron_seconds = $bottom*60; - my $current_exec_seconds = $time_params[$i]*60; - my $next_exec_seconds = $time_params[$i]*60 + $module->{'interval'}*$Conf{'interval'}; - if ($current_exec_seconds > $start_cron_seconds && $current_exec_seconds > $next_exec_seconds) { - $start_cron_seconds += 3600; - } - if (($current_exec_seconds <= $start_cron_seconds) && ($start_cron_seconds <= $next_exec_seconds)) { - $overflow_cron = 1 - } - } - - # Check interval - if ($bottom <= $top) { - return 0 if (($time_params[$i] < $bottom || $time_params[$i] > $top) && !$overflow_cron); - } else { - return 0 if (($time_params[$i] < $bottom && $time_params[$i] > $top) && !$overflow_cron); - } - } - - # Do not check in the next minute, hour, day or month. - my $offset = 0; - if ($module->{'cron_interval'} >= 0) { - $offset = $module->{'cron_interval'}; - } elsif($cron_params[0] ne '*') { - # 1 minute - $offset = 60; - } elsif($cron_params[1] ne '*') { - # 1 hour - $offset = 3600; - } elsif($cron_params[2] ne '*' || $cron_params[4] ne '*') { - # 1 day - $offset = 86400; - } elsif($cron_params[3] ne '*') { - # 31 days - $offset = 2678400; - } - - $module->{'cron_utimestamp'} = $current_time + $offset; - return 1; -} - -################################################################################ -# Write module data in XML format. -################################################################################ -sub write_module_xml ($@) { - my ($module, @data) = @_; - - # No data - return unless (defined $data[0]); - - # Is it a plugin? - if ($module->{'func'} == \&module_plugin) { - $Sem->down () if (defined ($Sem)); - $Xml .= $data[0]; - $Sem->up () if (defined ($Sem)); - return; - } - - # Critical section - $Sem->down () if (defined ($Sem)); - - $Xml .= "\n" . - " {'name'} . "]]>\n" . - " {'description'} . "]]>\n" . - " " . $module->{'type'} . "\n"; - - # Interval - $Xml .= " " . $module->{'interval'} . "\n"; - - # Min - $Xml .= " " . $module->{'min'} . "\n" if (defined ($module->{'min'})); - - # Max - $Xml .= " " . $module->{'max'} . "\n" if (defined ($module->{'max'})); - - # Post process - $Xml .= " " . $module->{'post_process'} . "\n" if (defined ($module->{'post_process'})); - - # Min critical - $Xml .= " " . $module->{'min_critical'} . "\n" if (defined ($module->{'min_critical'})); - - # Max critical - $Xml .= " " . $module->{'max_critical'} . "\n" if (defined ($module->{'max_critical'})); - - # Min warning - $Xml .= " " . $module->{'min_warning'} . "\n" if (defined ($module->{'min_warning'})); - - # Max warning - $Xml .= " " . $module->{'max_warning'} . "\n" if (defined ($module->{'max_warning'})); - - # Disabled - $Xml .= " " . $module->{'disabled'} . "\n" if (defined ($module->{'disabled'})); - - # Min ff event - $Xml .= " " . $module->{'min_ff_event'} . "\n" if (defined ($module->{'min_ff_event'})); - - # Unit - $Xml .= " {'unit'} . "]]>\n" if (defined ($module->{'unit'})); - - # Module group - $Xml .= " " . $module->{'module_group'} . "\n" if (defined ($module->{'module_group'})); - - # Custom ID - $Xml .= " {'custom_id'} . "]]>\n" if (defined ($module->{'custom_id'})); - - # Str warning - $Xml .= " {'str_warning'} . "]]>\n" if (defined ($module->{'str_warning'})); - - # Str critical - $Xml .= " {'str_critical'} . "]]>\n" if (defined ($module->{'str_critical'})); - - # Critical instructions - $Xml .= " {'critical_instructions'} . "]]>\n" if (defined ($module->{'critical_instructions'})); - - # Warning instructions - $Xml .= " {'warning_instructions'} . "]]>\n" if (defined ($module->{'warning_instructions'})); - - # Unknown instructions - $Xml .= " {'unknown_instructions'} . "]]>\n" if (defined ($module->{'unknown_instructions'})); - - # Tags - $Xml .= " {'tags'} . "]]>\n" if (defined ($module->{'tags'})); - - # Critical inverse - $Xml .= " " . $module->{'critical_inverse'} . "\n" if (defined ($module->{'critical_inverse'})); - - # Warning inverse - $Xml .= " " . $module->{'warning_inverse'} . "\n" if (defined ($module->{'warning_inverse'})); - - # Quiet - $Xml .= " " . $module->{'quiet'} . "\n" if (defined ($module->{'quiet'})); - - # Module FF interval - $Xml .= " " . $module->{'module_ff_interval'} . "\n" if (defined ($module->{'module_ff_interval'})); - - # Module Alert template - $Xml .= " " . $module->{'alert_template'} . "\n" if (defined ($module->{'alert_template'})); - - # Module Alert template - $Xml .= " " . $module->{'cron'} . "\n" if (defined ($module->{'cron'}) and ($module->{'cron'} ne "")); - - # FF threshold configuration - $Xml .= " " . $module->{'min_ff_event_normal'} . "\n" if (defined ($module->{'min_ff_event_normal'})); - $Xml .= " " . $module->{'min_ff_event_warning'} . "\n" if (defined ($module->{'min_ff_event_warning'})); - $Xml .= " " . $module->{'min_ff_event_critical'} . "\n" if (defined ($module->{'min_ff_event_critical'})); - $Xml .= " " . $module->{'ff_timeout'} . "\n" if (defined ($module->{'ff_timeout'})); - $Xml .= " " . $module->{'each_ff'} . "\n" if (defined ($module->{'each_ff'})); - - # Data list - if ($#data > 0) { - $Xml .= " \n"; - # Single data - } else { - chomp ($data[0]); - $Xml .= " \n"; - } - $Xml .= "\n"; - - $Sem->up () if (defined ($Sem)); -} - -################################################################################ -# Receive a UDP server signal to restart agent -################################################################################ -sub udp_server_signal () { - log_message ('udp server', 'Received signal to restart the agent.'); -} - -################################################################################ -# Basic UDP server to restart agent on UDP signal received -################################################################################ -sub udp_server ($$) { - - my $udp_port = shift; - my $udp_auth_address = shift; - my $parent_pid = getppid(); - my @udp_auth_list = split(',', $udp_auth_address); - - my($sock, $oldmsg, $newmsg, $hisaddr, $hishost, $MAXLEN); - $MAXLEN = 1024; - - log_message ('udp server', 'Starting UDP server listening on '.$udp_auth_address.":".$udp_port); - $sock = IO::Socket::INET->new(LocalPort => $udp_port, Proto => 'udp') or die "socket: $@"; - - while ($sock->recv($newmsg, $MAXLEN)) { - my $hishost = $sock->peerhost(); - my $address_found = 0; - foreach my $single_address (@udp_auth_list) { - $address_found = $address_found || ($hishost eq $single_address); - } - if (($udp_auth_address eq "0.0.0.0") || $address_found){ - if ($newmsg =~ /REFRESH AGENT/){ - # Send signal to restart agent - log_message ('udp server', 'Received signal from '.$hishost); - kill 'SIGINT' , $parent_pid; - } - elsif ($newmsg =~ /START PROCESS (.*)/){ - my $process_name = $1; - $process_name =~ s/^\s*//g; - $process_name =~ s/\s*$//g; - if (defined($Conf{"process_${process_name}_start"})) { - log_message ('udp server', "Process $process_name started from $hishost"); - system "$Conf{\"process_${process_name}_start\"} 2>$DevNull &"; - } else { - log_message ('udp server', "Attempt to start unknown process $process_name from $hishost"); - } - } - elsif ($newmsg =~ /STOP PROCESS (.*)/){ - my $process_name = $1; - $process_name =~ s/^\s*//g; - $process_name =~ s/\s*$//g; - if (defined($Conf{"process_${process_name}_stop"})) { - log_message ('udp server', "Process $process_name stopped from $hishost"); - system "$Conf{\"process_${process_name}_stop\"} 2>$DevNull &"; - } else { - log_message ('udp server', "Attempt to stop unknown process $process_name from $hishost"); - } - } - } - } -} - -################################################################################ -# Execute the given plugin. -################################################################################ -sub module_plugin ($) { - my $plugin = shift; - - my $command = $plugin->{'params'}; - - # Empty plugin - return () if ($command eq ''); - - # Execute the plugin - - my $output = ""; - if ($plugin->{'timeout'} == 0) { - $output = `$command 2>$DevNull`; - log_message ('debug', "Executing plugin: " . $command) if ($Conf{'debug'} eq '1'); - } else { - $output = `$Conf{'pandora_exec'} $plugin->{'timeout'} $command 2> $DevNull`; - log_message ('debug', "Executing plugin: (" . $command . ") with timeout: " . $plugin->{'timeout'} . "s") if ($Conf{'debug'} eq '1'); - } - - # Do not save the output if there was an error - if ($? != 0) { - return (); - } - - return ($output); -} - -################################################################################ -# TERM Handler -################################################################################ -sub kill_signal_handler (){ - # Kill tentacle server if it was launched - - if (defined ($tentacle_pid)) { - print "kill -9 $tentacle_pid\n"; - `kill -9 $tentacle_pid`; - } - - # Kill udp_server if it was forked. - if (defined ($udp_server_pid) && $udp_server_pid) { - kill 'TERM', $udp_server_pid; - log_message ('udp server', 'terminated.'); - } - - exit (0); -} - -################################################################################ -# Get the free disk space in the temporal directory (in bytes). -################################################################################ -sub temporal_freedisk () { - - # Call df - return 0 unless defined (DF_CMDS->{$OS}); - my $cmd = DF_CMDS->{$OS} . ' ' . $Conf{'temporal'} . ' | awk \'NR > 1 {print $4}\''; - my $temporal_freedisk = `$cmd`; - - # Check for errors - return 0 unless ($? eq 0); - - # Convert to bytes - return 1024 * int ($temporal_freedisk); -} - -################################################################################ -# Replace module macros. -################################################################################ -sub replace_macros ($) { - my $module = shift; - - # Replace macros - foreach my $token (keys (%{$module})) { - - # No need to skip macros for now, since it's a hash ref and only array refs - # are searched for macros. - #if ($token eq 'macros') { - # next; - #} - - # No defined value for conf token - if (! defined ($module->{$token})) { - next; - } - - # Simple configuration token - if(ref($module->{$token}) eq ''){ - # Module macros - while (my ($macro, $subst) = each (%{$module->{'macros'}})) { - eval { - $module->{$token} =~ s/$macro/$subst/g; - }; - } - # Global macros - while (my ($macro, $subst) = each (%Macros)) { - eval { - $module->{$token} =~ s/$macro/$subst/g; - }; - } - } - # Hash array - elsif (ref($module->{$token}) eq 'ARRAY'){ - for (my $i = 0; $i <= $#{$module->{$token}}; $i++) { - - # Array of configuration tokens - foreach my $key (keys (%{$module->{$token}->[$i]})) { - - # Module macros (each configuration token is a hash) - while (my ($macro, $subst) = each (%{$module->{'macros'}})) { - eval { - $module->{$token}->[$i]->{$key} =~ s/$macro/$subst/g; - } - } - - # Global macros (each configuration token is a hash) - while (my ($macro, $subst) = each (%Macros)) { - eval { - $module->{$token}->[$i]->{$key} =~ s/$macro/$subst/g; - } - } - } - } - } - } -} - -################################################################################ -# Initialize a module with default values. -################################################################################ -sub init_module ($) { - my $module = shift; - - $module->{'name'} = ''; - $module->{'type'} = 'generic_data'; - $module->{'description'} = ''; - $module->{'func'} = 0; - $module->{'params'} = ''; - $module->{'interval'} = 1; - $module->{'timeout'} = 0; - $module->{'counter'} = 0; - $module->{'max'} = undef; - $module->{'min'} = undef; - $module->{'post_process'} = undef; - $module->{'min_critical'} = undef; - $module->{'max_critical'} = undef; - $module->{'min_warning'} = undef; - $module->{'max_warning'} = undef; - $module->{'disabled'} = undef; - $module->{'min_ff_event'} = undef; - $module->{'save'} = ''; - $module->{'conditions'} = []; - $module->{'cron'} = ''; - $module->{'cron_utimestamp'} = 0; - $module->{'cron_interval'} = -1; - $module->{'precondition'} = []; - $module->{'is_intensive'} = 0; - $module->{'intensive_conditions'} = []; - $module->{'intensive_match'} = 0; - $module->{'timestamp'} = 0; - $module->{'unit'} = undef; - $module->{'module_group'} = undef; - $module->{'custom_id'} = undef; - $module->{'str_warning'} = undef; - $module->{'str_critical'} = undef; - $module->{'critical_instructions'} = undef; - $module->{'warning_instructions'} = undef; - $module->{'unknown_instructions'} = undef; - $module->{'tags'} = undef; - $module->{'critical_inverse'} = undef; - $module->{'warning_inverse'} = undef; - $module->{'quiet'} = undef; - $module->{'module_ff_interval'} = undef; - $module->{'macros'} = {}; - $module->{'alert_template'} = undef; -} - -################################################################################ -# Generate a unique agent name. -################################################################################ -sub generate_agent_name { - return sha256(join('|', ($Conf{'agent_alias'}, $Conf{server_ip}, time(), sprintf("%04d", rand(10000))))); -} - -################################################################################ -# Set the value of a token in the configuration file. If the token does not -# exist, it is appended to the end of the file. -################################################################################ -sub config_update ($$) { - my ($token, $value) = @_; - - # Read the original configuration file. - open(my $fh, '<', "$ConfDir/$ConfFile") or die($!); - my @lines = <$fh>; - close ($fh); - - # Set the new value for the configuration token. - my $found = 0; - for(my $i = 0; $i < $#lines; $i++) { - if ($lines[$i] =~ m/[#\s]*$token/) { - $lines[$i] = "$token $value\n"; - $found = 1; - last; - } - } - - # Append the token to the end if it was not found in the file. - if ($found == 0) { - push(@lines, "$token $value\n"); - } - - # Write the changes to the configuration file. - open($fh, '>', "$ConfDir/$ConfFile") or die($!); - print $fh @lines; - close($fh); -} - -################################################################################ -# Get the eHorus key from the eHorus agent configuration file. -################################################################################ -sub get_ehkey { - my $fh; - - return '' unless defined($Conf{'ehorus_conf'}); - - # Open the eHorus configuration file. - if (!open($fh, '<', $Conf{'ehorus_conf'})) { - # Do not write to the log, since ehorus_conf points to the default eHorus configuration file by default. - return ''; - } - - # Look for the eHorus key. - while (my $line = <$fh>) { - - # Skip comments. - next if ($line =~ m/^\s*#/); - - if ($line =~ m/\s*eh_key\s+(\S+)/) { - my $eh_key = $1; - close($fh); - - return $eh_key; - } - } - - # Not found. - close($fh); - return ''; -} - -################################################################################ -# Main. -################################################################################ - -#Handler TERM signal. -$SIG{'TERM'} = \&kill_signal_handler; - -# Check command line arguments -print_usage unless ($#ARGV == 0); -$ConfDir = fix_directory ($ARGV[0]); -error ("Directory '$ConfDir' does not exist.") unless (-d "$ConfDir"); - -#Pandora home path -$ENV{'PANDORA_HOME'}=$ConfDir; - -# Get user to run as -my $pandora_user = read_config ('pandora_user'); -if (defined ($pandora_user)) { - # Change the EUID - my $pandora_user_uid = getpwnam ($pandora_user); - if (!defined ($pandora_user_uid)) { - error ("Cannot get uid for user $pandora_user. Does the user exist and can we read /etc/passwd?"); - } - $> = $pandora_user_uid; - if ($> != $pandora_user_uid) { - error ("Cannot run as $pandora_user: Insufficient permissions."); - } -} - -# Guess the OS version -$OS_VERSION = guess_os_version ($OS); - -# Start logging -start_log (); -log_message ('log', 'Running as user ' . getpwuid ($>)); - -# Read configuration file -read_config (); - -$ENV{'PANDORA_AGENT'}=$Conf{'agent_name'}; - -# Fix directory names -$Conf{'temporal'} = fix_directory ($Conf{'temporal'}); -error ("Temporal directory '" . $Conf{'temporal'} . "' does not exist.") unless (-d "$Conf{'temporal'}"); -$Conf{'server_path'} = fix_directory ($Conf{'server_path'}); -$Conf{'secondary_server_path'} = fix_directory ($Conf{'secondary_server_path'}); - -# Startup delay -log_message ('log', 'Sleeping for ' . $Conf{'delayed_startup'} . ' seconds.') if ($Conf{'delayed_startup'} > 0); -sleep ($Conf{'delayed_startup'}); - -#Set nice of the pandora_agent -my $PID = $$; -`renice "$Conf{'pandora_nice'}" "$PID"`; - -#Launch tentacle server in proxy mode if configured -if ($Conf{'proxy_mode'}) { - - #Check if user is root - if ($> != 0) { - launch_tentacle_proxy(); - } else { - log_message ('error', 'Proxy mode can not be launched as root'); - exit 1; - } -} - -# Add the plugins directory to the PATH -$ENV{'PATH'} .= ":$ConfDir/plugins"; - -# Start UDP server if configured -if ($Conf{'udp_server'} == 1){ - $udp_server_pid = fork(); - - if ($udp_server_pid == 0){ - $0 = 'udp_server (pandora_agent)'; - udp_server ($Conf{'udp_server_port'}, $Conf{'udp_server_auth_address'}); - exit; - } -} - -# Must be set to 0 if the agent is a broker agent -my $main_agent = -1; - -# base time to start eatch iteration with the same interval. -my $iter_base_time = time(); -$LogFileIdx = -1; -# Loop -while (1) { - if (-e $Conf{'logfile'} && (stat($Conf{'logfile'}))[7] > $Conf{'logsize'}) { - rotate_log(); - } - # Ignore signals from UDP and Tentacle server while processing execution - if ($Conf{'udp_server'} == 1 || $Conf{'proxy_mode'}){ - $SIG{'INT'} = 'DEFAULT'; - } - - # Check for a new configuration - check_remote_config () unless ($Conf{'debug'} eq '1'); - - # Check file collections - check_collections () unless ($Conf{'debug'} eq '1'); - - # Launch broker agents - @BrokerPid = (); - my @broker_agents = read_config ('broker_agent'); - foreach my $broker_agent (@broker_agents) { - - # Create broker conf file if it does not exist - if (! -e "$ConfDir/${broker_agent}.conf") { - write_broker_conf($broker_agent); - } - - $main_agent = fork (); - - # Broker agent - if ($main_agent == 0) { - - # Set the configuration file - $ConfFile = "${broker_agent}.conf"; - - # Log to a new file - stop_log (); - start_log ('quiet'); - - # Read configuration file - %Macros = (); - @Modules = (); - %Collections = (); - %Conf = %DefaultConf; - read_config (); - - $Conf{'agent_alias'} = $broker_agent; - # Check for a new configuration - check_remote_config () unless ($Conf{'debug'} eq '1'); - - # Check file collections - check_collections () unless ($Conf{'debug'} eq '1'); - - # Execute - last; - } else { - push (@BrokerPid, $main_agent); - } - } - - my $address; - - if(defined($Conf{'address'})) { - # Check if address is auto to get the local ip - if ($Conf{'address'} eq 'auto') { - my @address_list; - - if( -x "/bin/ip" || -x "/sbin/ip" || -x "/usr/sbin/ip" ) { - @address_list = `ip addr show 2>$DevNull | sed -e '/127.0.0/d' -e '/[0-9]*\\.[0-9]*\\.[0-9]*/!d' -e 's/^[ \\t]*\\([^ \\t]*\\)[ \\t]*\\([^ \\t]*\\)[ \\t].*/\\2/' -e 's/\\/.*//'`; - } - else { - @address_list = `ifconfig -a 2>$DevNull | sed -e '/127.0.0/d' -e '/[0-9]*\\.[0-9]*\\.[0-9]*/!d' -e 's/^[ \\t]*\\([^ \\t]*\\)[ \\t]*\\([^ \\t]*\\)[ \\t].*/\\2/' -e 's/.*://'`; - } - - for (my $i = 0; $i <= $#address_list; $i++) { - chomp($address_list[$i]); - if ($i > 0) { - $address .= ','; - } - - $address .= $address_list[$i]; - } - } - else { - $address = $Conf{'address'}; - } - } - - # Clear the XML - $Xml = ""; - - # Get the eHorus key. - my $eh_key = get_ehkey(); - - # Custom fields - my @customfieldskeys = keys(%Customfields); - if ($#customfieldskeys > -1 || $eh_key ne '') { - $Xml .= "\n"; - - foreach my $customfieldkey (@customfieldskeys) { - if($customfieldkey =~ m/^(custom_field\d+_)name/) { - if(defined($Customfields{$1."value"})) { - $Xml .= " \n"; - $Xml .= " \n"; - $Xml .= " \n"; - $Xml .= " \n"; - } - } - } - - # Add the eHorus key as a custom field. - if ($eh_key ne '') { - $Xml .= " \n"; - $Xml .= " eHorusID\n"; - $Xml .= " \n"; - $Xml .= " \n"; - } - - $Xml .= "\n"; - } - - # Execute modules - foreach my $module (@Modules) { - - # Execute the module in a separate thread - if (defined ($ThreadSem) && $Conf{'agent_threads'} > 1) { - $ThreadSem->down (); - my $thr = threads->create (\&exec_module, $module); - if (! defined ($thr)) { - $ThreadSem->up (); - } else { - $thr->detach(); - } - # Execute the module - } else { - exec_module($module); - } - } - - # Wait for all the threads - $ThreadSem->down ($Conf{'agent_threads'}) if (defined ($ThreadSem) && $Conf{'agent_threads'} > 1); - $ThreadSem->up ($Conf{'agent_threads'}) if (defined ($ThreadSem) && $Conf{'agent_threads'} > 1); - - if ($Xml ne "" || $Conf{'timestamp'} + $Conf{'interval'} <= time ()) { - - # Update the time reference - $Conf{'timestamp'} = time () if ($Conf{'timestamp'} + $Conf{'interval'} <= time ()); - - # Compose the XML - my $xml_header = "\n" . - ""; - - # Save XML data file - my $temp_file = $Conf{'temporal'} . '/' . $Conf{'agent_name'} . '.' . time () . '.data'; - error ("File '$temp_file' already exists as a symlink and could not be removed: $!") if (-l $temp_file && !unlink($temp_file)); - open (TEMP_FILE, "> $temp_file") || error ("Could not write XML data file: $!"); - print TEMP_FILE $Xml; - close (TEMP_FILE); - - # Debug mode - if ($Conf{'debug'} eq '1') { - log_message ('debug', "Wrote XML data file '$temp_file'"); - log_message ('debug', "Wrote XML data file '$temp_file'", *STDOUT); - } - - # Send the XML data file - my $rc = send_file ($temp_file, 1); - if ($rc == 0 || $Conf{'xml_buffer'} == 0 || temporal_freedisk () < $Conf{'temporal_min_size'}) { - if ($Conf{'debug'} eq '1') { - rename $temp_file, $temp_file . "sent"; - } else { - unlink ($temp_file); - } - } - - # Send buffered XML data files - if ($Conf{'xml_buffer'} == 1) { - send_buffered_xml_files (); - } - } - - # Enable signal capture to break the Sleep interval on UDP signal - if ($Conf{'udp_server'} == 1) { - $SIG{'INT'} = \&udp_server_signal; - } - - # Sleep if main agent - if ($main_agent != 0) { - foreach my $broker_pid (@BrokerPid) { - waitpid ($broker_pid, 0); - } - - # Cron mode - last if ($Conf{'cron_mode'} == 1); - - $iter_base_time += $Conf{'intensive_interval'}; - my $now = time(); - - my $interval_remain = $iter_base_time - $now; - - if ($interval_remain >= 0) { - sleep ($interval_remain); - } else { - # don't sleep if iteraion took more than "intensive_interval" seconds - $iter_base_time = $now; # use current time as base time - } - } - # Finish if broker agent - else { - exit (0); - } -} - -__END__ - -=head1 EXIT STATUS - -=over - -=item 0 on Success - -=item 1 on Error - -=back - -=head1 CONFIGURATION - -By default pandora_agent uses F as B. There is the F file with all the configuration of the agent. - -=head1 DEPENDENCIES - - -=head1 LICENSE - -This is released under the GNU Lesser General Public License. - -=head1 SEE ALSO - - -=head1 COPYRIGHT - -Copyright (c) 2005-2010 Artica Soluciones Tecnologicas S.L - -=cut diff --git a/pandora_agents/unix/pandora_agent.redhat.spec.orig b/pandora_agents/unix/pandora_agent.redhat.spec.orig deleted file mode 100644 index 1c9bc88435..0000000000 --- a/pandora_agents/unix/pandora_agent.redhat.spec.orig +++ /dev/null @@ -1,145 +0,0 @@ -# -#Pandora FMS Linux Agent -# -%define name pandorafms_agent_unix -%define version 7.0NG -<<<<<<< HEAD -%define release 170406 -======= -%define release 170418 ->>>>>>> develop - -Summary: Pandora FMS Linux agent, PERL version -Name: %{name} -Version: %{version} -Release: %{release} -License: GPL -Vendor: ArticaST -Source0: %{name}-%{version}.tar.gz -URL: http://pandorafms.org -Group: System/Monitoring -Packager: Sancho Lerena -Prefix: /usr/share -BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot -BuildArch: noarch -Requires(pre): shadow-utils -Requires(post): chkconfig /bin/ln -Requires(preun): chkconfig /bin/rm /usr/sbin/userdel -Requires: fileutils textutils unzip -Requires: util-linux procps grep -Requires: /sbin/ip /bin/awk -Requires: perl perl(Sys::Syslog) perl(IO::Socket::SSL) -# Required by plugins -#Requires: sh-utils sed passwd net-tools rpm -AutoReq: 0 -Provides: %{name}-%{version} - -%description -Pandora FMS agent for unix. Pandora FMS is an OpenSource full-featured monitoring software. - -%prep -rm -rf $RPM_BUILD_ROOT - -%setup -q -n unix - -%build - -%install -rm -rf $RPM_BUILD_ROOT -mkdir -p $RPM_BUILD_ROOT%{prefix}/pandora_agent/ -mkdir -p $RPM_BUILD_ROOT/usr/bin/ -mkdir -p $RPM_BUILD_ROOT/usr/sbin/ -mkdir -p $RPM_BUILD_ROOT/etc/pandora/ -mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d/ -mkdir -p $RPM_BUILD_ROOT/var/log/pandora/ -mkdir -p $RPM_BUILD_ROOT/usr/share/man/man1/ -mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/ -cp -aRf * $RPM_BUILD_ROOT%{prefix}/pandora_agent/ -cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/tentacle_client $RPM_BUILD_ROOT/usr/bin/ -cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent $RPM_BUILD_ROOT/usr/bin/ -cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_exec $RPM_BUILD_ROOT/usr/bin/ -cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_daemon $RPM_BUILD_ROOT/etc/rc.d/init.d/pandora_agent_daemon -cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/pandora_agent.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/ -cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/tentacle_client.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/ - -cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/Linux/pandora_agent.conf $RPM_BUILD_ROOT/usr/share/pandora_agent/pandora_agent.conf.rpmnew - -install -m 0644 pandora_agent_logrotate $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/pandora_agent - -if [ -f $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent.spec ] ; then - rm $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent.spec -fi - -%clean -rm -Rf $RPM_BUILD_ROOT - -%pre -getent passwd pandora >/dev/null || \ - /usr/sbin/useradd -d %{prefix}/pandora -s /bin/false -M -g 0 pandora -exit 0 -chown pandora:root /var/log/pandora - -%post -if [ ! -d /etc/pandora ] ; then - mkdir -p /etc/pandora -fi - -if [ ! -f /usr/share/pandora_agent/pandora_agent.conf ] ; then - cp /usr/share/pandora_agent/pandora_agent.conf.rpmnew /usr/share/pandora_agent/pandora_agent.conf -fi - -if [ ! -f /etc/pandora/pandora_agent.conf ] ; then - ln -s /usr/share/pandora_agent/pandora_agent.conf /etc/pandora/pandora_agent.conf -else - ln -s /usr/share/pandora_agent/pandora_agent.conf.rpmnew /etc/pandora/pandora_agent.conf.rpmnew -fi - -if [ ! -e /etc/pandora/plugins ]; then - ln -s /usr/share/pandora_agent/plugins /etc/pandora -fi - -if [ ! -e /etc/pandora/collections ]; then - ln -s /usr/share/pandora_agent/collections /etc/pandora -fi - -mkdir -p /var/spool/pandora/data_out -if [ ! -d /var/log/pandora ]; then - mkdir -p /var/log/pandora -fi -/sbin/chkconfig --add pandora_agent_daemon -/sbin/chkconfig pandora_agent_daemon on - -%preun - -# Upgrading -if [ "$1" = "1" ]; then - exit 0 -fi - -/sbin/chkconfig --del pandora_agent_daemon -/etc/rc.d/init.d/pandora_agent_daemon stop >/dev/null 2>&1 || : - -# Remove symbolic links -pushd /etc/pandora -for f in pandora_agent.conf plugins collections -do - [ -L $f ] && rm -f $f -done -exit 0 - -%files -%defattr(750,root,root) -/usr/bin/pandora_agent - -%defattr(755,pandora,root) -%{prefix}/pandora_agent - -%defattr(755,root,root) -/usr/bin/pandora_agent_exec -/usr/bin/tentacle_client -/etc/rc.d/init.d/pandora_agent_daemon - -%defattr(644,root,root) -/usr/share/man/man1/pandora_agent.1.gz -/usr/share/man/man1/tentacle_client.1.gz -%config(noreplace) %{_sysconfdir}/logrotate.d/pandora_agent diff --git a/pandora_agents/unix/pandora_agent.spec.orig b/pandora_agents/unix/pandora_agent.spec.orig deleted file mode 100644 index 9fa4f46e9d..0000000000 --- a/pandora_agents/unix/pandora_agent.spec.orig +++ /dev/null @@ -1,142 +0,0 @@ -# -#Pandora FMS Linux Agent -# -%define name pandorafms_agent_unix -%define version 7.0NG -<<<<<<< HEAD -%define release 170406 -======= -%define release 170418 ->>>>>>> develop - -Summary: Pandora FMS Linux agent, PERL version -Name: %{name} -Version: %{version} -Release: %{release} -License: GPL -Vendor: ArticaST -Source0: %{name}-%{version}.tar.gz -URL: http://pandorafms.org -Group: System/Monitoring -Packager: Sancho Lerena -Prefix: /usr/share -BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot -BuildArch: noarch -PreReq: %fillup_prereq %insserv_prereq /usr/bin/sed /usr/bin/grep /usr/sbin/useradd -Requires: coreutils unzip perl -AutoReq: 0 -Provides: %{name}-%{version} - -%description -Pandora FMS agent for unix. Pandora FMS is an OpenSource full-featured monitoring software. - -%prep -rm -rf $RPM_BUILD_ROOT - -%setup -q -n unix - -%build - -%install -rm -rf $RPM_BUILD_ROOT -mkdir -p $RPM_BUILD_ROOT%{prefix}/pandora_agent/ -mkdir -p $RPM_BUILD_ROOT/usr/bin/ -mkdir -p $RPM_BUILD_ROOT/usr/sbin/ -mkdir -p $RPM_BUILD_ROOT/etc/pandora/ -mkdir -p $RPM_BUILD_ROOT/etc/init.d/ -mkdir -p $RPM_BUILD_ROOT/var/log/pandora/ -mkdir -p $RPM_BUILD_ROOT/usr/share/man/man1/ -cp -aRf * $RPM_BUILD_ROOT%{prefix}/pandora_agent/ -cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/tentacle_client $RPM_BUILD_ROOT/usr/bin/ -cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent $RPM_BUILD_ROOT/usr/bin/ -cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_exec $RPM_BUILD_ROOT/usr/bin/ -cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_daemon $RPM_BUILD_ROOT/etc/init.d/pandora_agent_daemon -cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_daemon $RPM_BUILD_ROOT/etc/init.d/pandora_agent_daemon -cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/pandora_agent.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/ -cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/tentacle_client.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/ - -cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/Linux/pandora_agent.conf $RPM_BUILD_ROOT/usr/share/pandora_agent/pandora_agent.conf.rpmnew - -#if [ -f $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent.spec ] ; then -# rm $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent.spec -#fi - -%clean -rm -Rf $RPM_BUILD_ROOT - -%pre -if [ "`id pandora | grep uid | wc -l`" = 0 ] -then - /usr/sbin/useradd -d %{prefix}/pandora -s /bin/false -M -g 0 pandora -fi - -%post -chown pandora:root /var/log/pandora -if [ ! -d /etc/pandora ] ; then - mkdir -p /etc/pandora -fi - -if [ ! -f /usr/share/pandora_agent/pandora_agent.conf ] ; then - cp /usr/share/pandora_agent/pandora_agent.conf.rpmnew /usr/share/pandora_agent/pandora_agent.conf -fi - -if [ ! -f /etc/pandora/pandora_agent.conf ] ; then - ln -s /usr/share/pandora_agent/pandora_agent.conf /etc/pandora/pandora_agent.conf -else - ln -s /usr/share/pandora_agent/pandora_agent.conf.rpmnew /etc/pandora/pandora_agent.conf.rpmnew -fi - -if [ ! -e /etc/pandora/plugins ]; then - ln -s /usr/share/pandora_agent/plugins /etc/pandora -fi - -if [ ! -e /etc/pandora/collections ]; then - ln -s /usr/share/pandora_agent/collections /etc/pandora -fi -cp -aRf /usr/share/pandora_agent/pandora_agent_logrotate /etc/logrotate.d/pandora_agent - -mkdir -p /var/spool/pandora/data_out -chkconfig pandora_agent_daemon on - -%preun - -# Upgrading -if [ "$1" = "1" ]; then - exit 0 -fi - -chkconfig --del pandora_agent_daemon -/etc/init.d/pandora_agent_daemon stop -rm /etc/init.d/pandora_agent_daemon -/usr/sbin/userdel pandora -rm -Rf /etc/pandora/pandora_agent.conf -rm -Rf /var/log/pandora/pandora_agent* 2> /dev/null -rm -Rf /usr/share/pandora_agent -rm -Rf /usr/share/man/man1/pandora_agent.1.gz -rm -Rf /usr/share/man/man1/tentacle_client.1.gz -exit 0 - -%postun - -# Upgrading -if [ "$1" = "1" ]; then - exit 0 -fi - -rm -Rf /etc/logrotate.d/pandora_agent - -%files -%defattr(750,pandora,root) -/usr/bin/pandora_agent -/usr/bin/pandora_agent_exec - -%defattr(755,pandora,root) -/usr/bin/tentacle_client -/etc/init.d/pandora_agent_daemon -%docdir %{prefix}/pandora_agents/docs -%{prefix}/pandora_agent - -%defattr(644,pandora,root) -/usr/share/man/man1/pandora_agent.1.gz -/usr/share/man/man1/tentacle_client.1.gz - diff --git a/pandora_agents/unix/pandora_agent_installer.orig b/pandora_agents/unix/pandora_agent_installer.orig deleted file mode 100755 index 580adf06dc..0000000000 --- a/pandora_agents/unix/pandora_agent_installer.orig +++ /dev/null @@ -1,557 +0,0 @@ -#!/bin/sh - -# ********************************************************************** -# Pandora FMS Agent Installer for Unix (generic installer) -# (c) 2008-2015 Artica ST -# (c) 2008-2010 Sancho Lerena -# -# This is a generic installer for all Unix-like systems.(AIX, HP-UX, SunOS, Linux, FreeBSD, NetBSD) -# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license. -# ********************************************************************** - -PI_VERSION="7.0NG" -<<<<<<< HEAD -PI_BUILD="170406" -======= -PI_BUILD="170418" ->>>>>>> develop -OS_NAME=`uname -s` - -FORCE=0 -LOG_TIMESTAMP=`date +"%Y/%m/%d %H:%M:%S"` - -PREFIX=/usr -if [ "$OS_NAME" = "FreeBSD" ] || [ "$OS_NAME" = "NetBSD" ] -then - PREFIX=/usr/local -fi -PANDORA_HOME=$PREFIX/share/pandora_agent -PANDORA_BIN=$PREFIX/bin/pandora_agent -PANDORA_EXEC_BIN=$PREFIX/bin/pandora_agent_exec -PANDORA_REVENT_BIN=$PREFIX/bin/pandora_revent -PANDORA_TEMP=/var/spool/pandora -PANDORA_CFG=/etc/pandora -PANDORA_LOG_DIR=/var/log/pandora -PANDORA_LOG=pandora_agent.log -TENTACLE=$PREFIX/bin/tentacle_client -TENTACLE_SERVER=$PREFIX/bin/tentacle_server -PANDORA_MAN=$PREFIX/share/man -PANDORA_STARTUP=/etc/init.d/pandora_agent_daemon -DAEMON_SCRIPT=pandora_agent_daemon -PANDORA_USER="root" -PANDORA_PERL_PATH="perl" -WITHOUT_TENTACLE_SERVER=0 -FAKEROOT=0 - -# defaults for each platforms -case $OS_NAME in -AIX) - PANDORA_STARTUP=/etc/rc.pandora_agent_daemon - ;; -HP-UX) - PANDORA_STARTUP=/sbin/init.d/pandora_agent_daemon - ;; -FreeBSD) - PANDORA_CFG=$PREFIX/etc/pandora - PANDORA_MAN=$PREFIX/man - PANDORA_STARTUP=$PREFIX/etc/rc.d/pandora_agent - DAEMON_SCRIPT=$OS_NAME/pandora_agent - PANDORA_PERL_PATH=/usr/local/bin/perl - ;; -NetBSD) - PANDORA_CFG=/usr/local/etc/pandora - PANDORA_STARTUP=/etc/rc.d/pandora_agent - DAEMON_SCRIPT=$OS_NAME/pandora_agent - PANDORA_PERL_PATH=/usr/pkg/bin/perl - ;; -esac - -MODE=$1 - -# options -while : -do - case "$2" in - "--no-tentacle-server") WITHOUT_TENTACLE_SERVER=1;; - "--fakeroot") FAKEROOT=1;; - *) break;; - esac - shift -done - -PANDORA_BASE=`echo $2 | sed -e 's|/$||'` -if [ "$3" != "" ] -then - PANDORA_USER=$3 - if [ -z "$PANDORA_BASE" ] - then - echo "When specifying a custom user the agent must be installed to a custom location where that user has write permissions!" - exit 1 - fi -fi - -[ "$4" ] && PANDORA_PERL_PATH=$4 - -# Check for Perl 5.6.x or higher available -PERL_VERSION=`$PANDORA_PERL_PATH -v | egrep 'v5.[6-9]|v5.[12][0-9]' | grep perl` - -if [ -z "$PERL_VERSION" ] -then - echo "Perl 5.6.x or higher is not detected. This is required for Pandora FMS" - echo "Detected: $PERL_VERSION " - echo "Aborting install..." - exit 2 -fi - -if [ -z "`echo Linux HP-UX SunOS AIX Solaris Darwin BSD bsd FreeBSD NetBSD | grep \"$OS_NAME\"`" ] -then - echo "This system: '$OS_NAME' is not supported by this script" - echo "Please make the install yourself as it's described in documentation" - exit 1 -fi - - -# check for root to do the install -if [ $FAKEROOT -ne 1 ] && [ -z "`id | grep \"uid=0(root)\"`" ] -then - echo "You need to be root to do the install. Please made a manual install" - echo "if you want to install Pandora FMS agent without root" - echo " " - echo "Aborting install" - exit 2 -fi - -help () { - echo "Syntax": - echo " " - echo " ./pandora_agent_installer < --mode > [ --option ] [ destination_path ] [ user_to_run_as ] [custom_perl_path]" - echo " " - echo "Modes:" - echo " " - echo " --force-install To force installation if already installed on system" - echo " --install To install Pandora FMS Agent on this system" - echo " --uninstall To uninstall/remove Pandora FMS Agent on this System" - echo " " - echo "Option:" - echo " " - echo " --no-tentacle-server Skip tentacle server installation (by default tentalce server installed)" - echo " --fakeroot treate \"destination_path\" as root directory" - echo " " - echo "Some exaples of how to use the installer:" - echo " " - echo " ./pandora_agent_installer --install" - echo " ./pandora_agent_installer --install /opt/pandora" - echo " ./pandora_agent_installer --install \"\" pandora" - echo " ./pandora_agent_installer --install /opt/pandora root /opt/pandora/perl5/usr/local/bin/perl" - echo " ./pandora_agent_installer --uninstall /opt/pandora" - echo " " -} - -uninstall () { - if [ "$OS_NAME" = "Darwin" ] - then - launchctl remove com.pandorafms.pandorafms - rm /Library/LaunchDaemons/com.pandorafms.pandorafms.plist 2> /dev/null - fi - - echo "Removing Pandora FMS Agent..." - rm -Rf $PANDORA_BASE$PANDORA_BIN 2> /dev/null - rm -Rf $PANDORA_BASE$PANDORA_EXEC_BIN 2> /dev/null - rm -Rf $PANDORA_BASE$PANDORA_REVENT_BIN 2> /dev/null - rm -f $DESTDIR/etc/logrotate.d/pandora_agent - - #Test if exist Pandora Server in this machine - if [ -d $PANDORA_BASE$PANDORA_TEMP/data_in ] - then - echo "You have a Pandora Server in this machine. Then don't delete "$PANDORA_TEMP - rm -Rf $PANDORA_BASE$PANDORA_TEMP/data_out 2> /dev/null - else - rm -Rf $PANDORA_BASE$PANDORA_TEMP 2> /dev/null - rm -Rf $PANDORA_BASE$TENTACLE_SERVER 2> /dev/null - fi - rm -Rf $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf 2> /dev/null - - rm -Rf $PANDORA_BASE/etc/init.d/pandora_agent_daemon 2> /dev/null - rm -Rf $PANDORA_BASE/sbin/init.d/pandora_agent_daemon 2> /dev/null - rm -Rf $PANDORA_BASE/etc/rc.pandora_agent_daemon 2> /dev/null - rm -Rf $PANDORA_BASE/etc/rc?.d/S90pandora_agent_daemon 2> /dev/null - rm -Rf $PANDORA_BASE/sbin/rc?.d/S90pandora_agent_daemon 2> /dev/null - rm -Rf $PANDORA_BASE/etc/rc?.d/S90pandora_agent 2> /dev/null - rm -Rf $PANDORA_BASE/sbin/rc?.d/S90pandora_agent 2> /dev/null - rm -Rf $PANDORA_BASE/etc/rc.d/rc?.d/S90pandora_agent_daemon 2> /dev/null - rm -Rf $PANDORA_BASE/etc/rc.d/rc?.d/S90pandora_agent 2> /dev/null - rm -Rf $PANDORA_BASE/usr/local/etc/rc.d/pandora_agent 2> /dev/null - if [ $FAKEROOT -ne 1 ] - then - rm -Rf /etc/init.d/pandora_agent_daemon 2> /dev/null - rm -Rf /sbin/init.d/pandora_agent_daemon 2> /dev/null - rm -Rf /etc/rc.pandora_agent_daemon 2> /dev/null - rm -Rf /etc/rc?.d/S90pandora_agent_daemon 2> /dev/null - rm -Rf /sbin/rc?.d/S90pandora_agent_daemon 2> /dev/null - rm -Rf /etc/rc?.d/S90pandora_agent 2> /dev/null - rm -Rf /sbin/rc?.d/S90pandora_agent 2> /dev/null - rm -Rf /etc/rc.d/rc?.d/S90pandora_agent_daemon 2> /dev/null - rm -Rf /etc/rc.d/rc?.d/S90pandora_agent 2> /dev/null - rm -Rf /usr/local/etc/rc.d/pandora_agent 2> /dev/null - fi - - rm -Rf $PANDORA_BASE$PANDORA_HOME 2> /dev/null - rm -Rf $PANDORA_BASE$PANDORA_LOG_DIR/$PANDORA_LOG 2> /dev/null - rm -Rf $PANDORA_BASE$TENTACLE 2> /dev/null - - rm -Rf $PANDORA_BASE$PANDORA_MAN/{man1,cat1}/tentacle_client.1.gz 2> /dev/null - rm -Rf $PANDORA_BASE$PANDORA_MAN/{man1,cat1}/pandora_agent.1.gz 2> /dev/null - - # Skip delete of /etc/pandora if exists configuration of a server or satellite - if [ ! -f $PANDORA_BASE/$PANDORA_CFG/pandora_server.conf -a ! -f $PANDORA_BASE/$PANDORA_CFG/satellite_server.conf ] - then - rm -Rf $PANDORA_BASE/$PANDORA_CFG 2> /dev/null - fi - - if [ ! -z "$PANDORA_BASE" ] - then - echo "Please delete manually $PANDORA_BASE for complete uninstall" - fi - - echo " " - echo "Done" -} - -# -# install_perl_script [OPTIONS] SRCFILE DESTFILE -# Install perl script. If PANDORA_PERL_DECODED_PATH is set, path of the perl -# in shebang line is replaced with PANDORA_PERL_DECODED_PATH value. -# OPTIONS: -# -o OWNER owner of the installed script -# -g GROUP group of the installed script -# -m PREM mode of the installed script -# -install_perl_script () { - OWNER=""; GROUP=""; PERM="" - while : - do - case $1 in - -o) OWNER=$2;; - -g) GROUP=$2;; - -m) PERM=$2;; - *) break;; - esac - shift;shift - done - SRC="$1" - DEST="$2" - - # do install - if echo $PANDORA_PERL_PATH | grep "/" > /dev/null && [ "$PANDORA_PERL_PATH" != "/usr/bin/perl" ] - then - sed -e "s:^#\!.*:#\!$PANDORA_PERL_PATH:g" $SRC > $DEST - else - cp $SRC $DEST - fi - - # set owner, group and permissions - [ "$OWNER" ] && chown $OWNER $DEST 2>/dev/null - [ "$GROUP" ] && chgrp $GROUP $DEST 2>/dev/null - [ "$PERM" ] && chmod $PERM $DEST -} - -install () { - OS_VERSION=`uname -r` - OLDFILENAMETMP=`date +"%Y-%m-%d"` - - echo "Detecting Unix distribution: $OS_NAME version $OS_VERSION" - if [ -f $PANDORA_BASE$PANDORA_HOME ] && [ "$FORCE" = "0" ] - then - echo "Seems that default dir already exists. Please use --force-install to" - echo "force installer to install on $PANDORA_BASE$PANDORA_HOME" - exit - else - echo "Checking default dir $PANDORA_BASE$PANDORA_HOME..." - fi - - if [ -f $PANDORA_BASE$PANDORA_BIN ] && [ "$FORCE" = "0" ] - then - echo "Seems that $PANDORA_BASE$PANDORA_BIN already exists. Please use --force-install to" - echo "force installer to reinstall overwriting it" - echo " " - exit - else - echo "Checking Pandora FMS Agent on $PANDORA_BASE$PANDORA_BIN...." - fi - - # Alter dynamically the daemon launcher and setup the new path - # if PANDORA_BASE is customized. - if [ "$PANDORA_BASE" ] && [ $FAKEROOT -ne 1 ] - then - DAEMON_TEMP=pandora_agent_daemon_temp - - # Backup the daemon script - cp -f "$DAEMON_SCRIPT" "${DAEMON_SCRIPT}.bak" - - AGENT_CFG=$OS_NAME/pandora_agent.conf - AGENT_CFG_TEMP=$OS_NAME/pandora_agent.conf.temp - - # Backup the configuration file - cp -f "$AGENT_CFG" "${AGENT_CFG}.bak" - - if [ "$OS_NAME" = "FreeBSD" ] || [ "$OS_NAME" = "NetBSD" ] - then - sed -e "\|^PATH=|s|=|=$PANDORA_BASE$PREFIX/bin:|" \ - -e "s|/usr/local/etc/pandora|$PANDORA_BASE$PANDORA_CFG|g" \ - -e "s|/usr/local/bin/pandora_agent|$PANDORA_BASE$PANDORA_BIN|g" \ - $DAEMON_SCRIPT > $DAEMON_TEMP - mv $DAEMON_TEMP $DAEMON_SCRIPT - else - sed -e "\|^PATH=|s|=|=$PANDORA_BASE/usr/bin:|" \ - -e "\|^PANDORA_PATH=|s|=|=$PANDORA_BASE|" \ - -e "\|^LOGFILE=|s|=|=$PANDORA_BASE|" \ - -e "\|^DAEMON=|s|=|=$PANDORA_BASE|" \ - -e "\|^DAEMON_TENTACLE=|s|=|=$PANDORA_BASE|" \ - -e "s/^PANDORA_USER=.*/PANDORA_USER=$PANDORA_USER/" \ - $DAEMON_SCRIPT > $DAEMON_TEMP - mv $DAEMON_TEMP $DAEMON_SCRIPT - fi - - sed -e "s|^temporal[ \t][ \t]*|temporal $PANDORA_BASE|" \ - -e "s|^logfile[ \t][ \t]*|logfile $PANDORA_BASE|" \ - $AGENT_CFG > $AGENT_CFG_TEMP - mv $AGENT_CFG_TEMP $AGENT_CFG - fi - echo "Creating Pandora FMS Agent home directory at $PANDORA_BASE$PANDORA_HOME" - if [ "$PANDORA_BASE" ] - then - mkdir -p $PANDORA_BASE 2> /dev/null - mkdir -p $PANDORA_BASE/var/log 2> /dev/null - mkdir -p $PANDORA_BASE/$PANDORA_MAN/man1 2> /dev/null - mkdir -p $PANDORA_BASE$PREFIX/bin 2> /dev/null - fi - - mkdir -p $PANDORA_BASE$PANDORA_HOME 2> /dev/null - - # Create directories based on PANDORA_BASE - - mkdir -p $PANDORA_BASE/tmp 2> /dev/null - mkdir -p $PANDORA_BASE$PANDORA_TEMP/data_out 2> /dev/null - mkdir -p $PANDORA_BASE$PANDORA_CFG 2> /dev/null - mkdir -p $PANDORA_BASE$PANDORA_LOG_DIR 2> /dev/null - - # Set the user the agent will run as - if [ "$PANDORA_USER" != "root" ] - then - sed -e "s/.*pandora_user .*/pandora_user $PANDORA_USER/" $AGENT_CFG > $AGENT_CFG_TEMP 2> /dev/null && \ - mv $AGENT_CFG_TEMP $AGENT_CFG - chmod 755 pandora_agent_daemon - chown -R $PANDORA_USER $PANDORA_BASE 2>/dev/null - fi - - # Create logfile - if [ ! -z "`touch $PANDORA_BASE$PANDORA_LOG_DIR/$PANDORA_LOG`" ] - then - echo "Seems to be a problem generating logfile ($PANDORA_BASE$PANDORA_LOG_DIR/$PANDORA_LOG) please check it"; - else - echo "Created logfile at $PANDORA_BASE$PANDORA_LOG_DIR/$PANDORA_LOG..." - fi - echo "$LOG_TIMESTAMP Pandora FMS installer has created this file at startup" > $PANDORA_BASE$PANDORA_LOG_DIR/$PANDORA_LOG - - # Copying agent and securing it - echo "Copying Pandora FMS Agent to $PANDORA_BASE$PANDORA_BIN..." - install_perl_script -m 755 -o $PANDORA_USER -g 0 pandora_agent $PANDORA_BASE$PANDORA_BIN - install_perl_script -m 755 -o $PANDORA_USER -g 0 pandora_agent_exec $PANDORA_BASE$PANDORA_EXEC_BIN - install_perl_script -m 755 -o $PANDORA_USER -g 0 pandora_revent $PANDORA_BASE$PANDORA_REVENT_BIN - - echo "Copying Pandora FMS Agent configuration file to $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf..." - if [ -f $PANDORA_BASE/$PANDORA_CFG/pandora_agent.conf ] - then - cp $PANDORA_BASE/$PANDORA_CFG/pandora_agent.conf $PANDORA_BASE/$PANDORA_CFG/pandora_agent.conf.$OLDFILENAMETMP - echo "Backing up old configuration file to $PANDORA_BASE/$PANDORA_CFG/pandora_agent.conf.$OLDFILENAMETMP" - fi - - echo "Copying Pandora FMS Agent plugins to $PANDORA_BASE$PANDORA_HOME/plugins..." - - [ -d $PANDORA_BASE$PANDORA_HOME/plugins ] || mkdir -p $PANDORA_BASE$PANDORA_HOME/plugins >/dev/null 2>&1 - for PLUGIN in plugins/* - do - if grep '^#!.*/perl' $PLUGIN >/dev/null 2>&1 - then - install_perl_script $PLUGIN $PANDORA_BASE$PANDORA_HOME/$PLUGIN - else - cp $PLUGIN $PANDORA_BASE$PANDORA_HOME/plugins - fi - done - chmod -R 700 $PANDORA_BASE$PANDORA_HOME/plugins - - PANDORA_BASE_REAL="$PANDORA_BASE" - [ $FAKEROOT -eq 1 ] && PANDORA_BASE_REAL="" - - ln -s $PANDORA_BASE_REAL$PANDORA_HOME/plugins $PANDORA_BASE$PANDORA_CFG - - echo "Copying Pandora FMS Agent collections to $PANDORA_BASE$PANDORA_HOME/collections..." - cp -r collections $PANDORA_BASE$PANDORA_HOME - chmod -R 700 $PANDORA_BASE$PANDORA_HOME/collections - ln -s $PANDORA_BASE_REAL$PANDORA_HOME/collections $PANDORA_BASE$PANDORA_CFG - - if [ $WITHOUT_TENTACLE_SERVER -eq 0 ] - then - echo "Copying tentacle server to $PANDORA_BASE$TENTACLE_SERVER" - install_perl_script -m 755 -o $PANDORA_USER -g 0 tentacle_server $PANDORA_BASE$TENTACLE_SERVER - fi - - echo "Copying tentacle client to $PANDORA_BASE$TENTACLE" - install_perl_script -m 755 -o $PANDORA_USER -g 0 tentacle_client $PANDORA_BASE$TENTACLE - - echo "Installing the Pandora Agent and Tentacle Client manuals" - cp man/man1/tentacle_client.1.gz $PANDORA_BASE/$PANDORA_MAN/man1 - chmod 644 $PANDORA_BASE/$PANDORA_MAN/man1/tentacle_client.1.gz - cp man/man1/pandora_agent.1.gz $PANDORA_BASE/$PANDORA_MAN/man1 - chmod 644 $PANDORA_BASE/$PANDORA_MAN/man1/pandora_agent.1.gz - - echo "Setting secure permissions and ownership for all Pandora FMS Agent files..." - chown -R $PANDORA_USER $PANDORA_BASE$PANDORA_HOME 2>/dev/null - chmod -R 700 $PANDORA_BASE$PANDORA_TEMP/data_out - chmod 711 $PANDORA_BASE$PANDORA_LOG_DIR - chmod 640 $PANDORA_BASE$PANDORA_LOG_DIR/$PANDORA_LOG - chown $PANDORA_USER:0 $PANDORA_BASE$PANDORA_LOG_DIR/$PANDORA_LOG 2>/dev/null - if [ "$OS_NAME" = "FreeBSD" ] || [ "$OS_NAME" = "NetBSD" ] - then - chown $PANDORA_USER:daemon $PANDORA_BASE$PANDORA_TEMP 2>/dev/null - chmod -R 770 $PANDORA_BASE$PANDORA_TEMP - chmod 775 $PANDORA_BASE$PANDORA_TEMP - fi - - echo "Copying default agent configuration to $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf" - - cp $OS_NAME/pandora_agent.conf $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf - chmod 600 $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf - chown $PANDORA_USER $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf 2>/dev/null - - echo "Linking start-up daemon script '$DAEMON_SCRIPT' on $OS_NAME"; - - if [ "$OS_NAME" = "Darwin" ] - then - # Specific service install on Darwin/macOSX - launchctl load -F Darwin/com.pandorafms.pandorafms.plist - echo "Start Pandora FMS service with 'launchctl start com.pandorafms.pandorafms'" - echo "This service has been scheduled to launch on each system startup" - else - DESTDIR="" - [ "$PANDORA_BASE" ] && [ $FAKEROOT -eq 1 ] && DESTDIR=$PANDORA_BASE - - cp $DAEMON_SCRIPT $DESTDIR$PANDORA_STARTUP - chmod 755 $DESTDIR$PANDORA_STARTUP - chown root:0 $DESTDIR$PANDORA_STARTUP 2>/dev/null - - RCDIRS="" - MSG="" - if [ "$OS_NAME" = "AIX" ] - then - RCDIRS=/etc/rc.d/rc2.d - MSG="Pandora FMS agent has been included in $DESTDIR/etc/rc.d/rc2.d/S90pandora_agent_daemon" - elif [ "$OS_NAME" = "HP-UX" ] - then - RCDIRS="/sbin/rc2.d /sbin/rc3.d" - MSG="Pandora FMS agent has been included in $DESTDIR/sbin/rcX.d/S90pandora_agent_daemon" - elif [ "$OS_NAME" = "SunOS" ] - then - RCDIRS=/etc/rc2.d - MSG="Pandora FMS agent has been included in $DESTDIR/etc/rc2.d/S90pandora_agent_daemon" - elif [ "$OS_NAME" = "Linux" ] - then - if [ -d /etc/rc.d/ ] - then - RCDIRS="/etc/rc.d/rc2.d /etc/rc.d/rc3.d" - else - RCDIRS="/etc/rc2.d /etc/rc3.d" - fi - fi - [ "$RCDIRS" ] && for RCDIR in $RCDIRS - do - [ $FAKEROOT -eq 1 ] && [ ! -d $DESTDIR$RCDIR ] && mkdir -p $DESTDIR$RCDIR >/dev/null 2>&1 - ln -s $PANDORA_STARTUP $DESTDIR$RCDIR/S90pandora_agent 2> /dev/null - done - [ "$MSG" ] && echo "$MSG" - fi - - if [ -d /etc/logrotate.d ] - then - [ -d $DESTDIR/etc/logrotate.d ] && mkdir -p $DESTDIR/etc/logrotate.d - echo "Creating logrotate.d entry for Pandora FMS log management" - sed -e "s|^/var/log/pandora/pandora_agent.log|$PANDORA_BASE_REAL$PANDORA_LOG_DIR/$PANDORA_LOG|" pandora_agent_logrotate \ - > $DESTDIR/etc/logrotate.d/pandora_agent - else - echo "Please add a log rotation schedule manually to your log rotation daemon (if any)" - fi - - echo "Done." - echo " " - echo "You have your startup script ready at $PANDORA_STARTUP" - echo " " - echo "Tentacle is the default transfer mode since 2.0 version." - echo " " - echo "If you want to use SSH, firstly you need to copy your public SSH keys " - echo " ($HOME/.ssh/id_dsa) under /home/pandora/.ssh/authorized_keys " - echo "on your Pandora FMS Server host" - echo " " - echo "You may need to install manually some additional required dependencies:" - echo "perl-Sys-Syslog" - echo " " - echo "You also need to setup your $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf config file" - echo " " - if [ "$OS_NAME" = "FreeBSD" ] - then - echo "Define 'pandora_agent_enable=\"YES\"' in /etc/rc.conf to enable the daemon." - elif [ "$OS_NAME" = "NetBSD" ] - then - echo "Define 'pandora_agent=\"YES\"' in /etc/rc.conf to enable the daemon." - else - echo "Check your startup configuration to be sure Pandora FMS Agent is ready " - echo "to start automatically when system restarts": - fi - - # Restore the daemon script - cp -f "$DAEMON_SCRIPT.bak" "$DAEMON_SCRIPT" >/dev/null 2>&1 - rm -f "$DAEMON_SCRIPT.bak" >/dev/null 2>&1 - - # Restore the configuration file - cp -f "$AGENT_CFG.bak" "$AGENT_CFG" >/dev/null 2>&1 - rm -f "$AGENT_CFG.bak" >/dev/null 2>&1 - -} - -if [ ! -f "pandora_agent" ] -then - echo " " - echo "Execute installer from the directory where you have your files. " - help - exit 1 -fi - -# Script banner at start -echo " " -echo "Pandora FMS Agent UNIX Installer $PI_VERSION $PI_BUILD (c) 2008-2015 ArticaST" -echo "This program is licensed under GPL2 Terms. http://pandorafms.com" -echo " " - - -case "$MODE" in - -'--force-install') - FORCE=1 - install - exit - ;; - -'--install') - install - exit - ;; - -'--uninstall') - uninstall - exit - ;; - -*) - help - ;; -esac - diff --git a/pandora_agents/win32/installer/pandora.mpi.orig b/pandora_agents/win32/installer/pandora.mpi.orig deleted file mode 100644 index cc5c4e6b56..0000000000 --- a/pandora_agents/win32/installer/pandora.mpi.orig +++ /dev/null @@ -1,3561 +0,0 @@ -array set info { -AllowLanguageSelection -{Yes} - -AppName -{Pandora FMS Windows Agent v7.0NG} - -ApplicationID -{17E3D2CF-CA02-406B-8A80-9D31C17BD08F} - -ApplicationURL -{http://pandorafms.org} - -AutoRefreshFiles -{Yes} - -BuildFailureAction -{Fail (recommended)} - -CancelledInstallAction -{Rollback and Stop} - -CleanupCancelledInstall -{Yes} - -CommandLineFailureAction -{Fail (recommended)} - -Company -{Artica ST http://www.artica.es} - -CompressionLevel -{9} - -CompressionMethod -{zlib} - -Copyright -{2004-2011} - -DefaultDirectoryLocation -{} - -DefaultLanguage -{English} - -DefaultToSystemLanguage -{Yes} - -EnableResponseFiles -{Yes} - -Ext -{.exe} - -ExtractSolidArchivesOnStartup -{No} - -Icon -{logo.png} - -IgnoreDirectories -{} - -IgnoreFiles -{} - -Image -{logo.png} - -IncludeDebugging -{0} - -InstallPassword -{} - -InstallVersion -{7.0.0.0} - -Language,ca -{No} - -Language,cs -{No} - -Language,de -{No} - -Language,en -{Yes} - -Language,es -{Yes} - -Language,fr -{No} - -Language,hu -{No} - -Language,it -{No} - -Language,lt -{No} - -Language,nl -{No} - -Language,pl -{No} - -Language,pt_br -{No} - -Language,ru -{No} - -LastIgnoreDirectories -{} - -LastIgnoreFiles -{} - -PackageDescription -{Pandora FMS Windows Agent} - -PackageLicense -{Gnu Public Licence v2 (GPL2)} - -PackageMaintainer -{Ramon Novoa } - -PackageName -{<%ShortAppName%>} - -PackagePackager -{Raul Mateos , Sancho Lerena , Ramon Novoa } - -PackageRelease -{<%PatchVersion%>} - -PackageSummary -{This is the installer for Pandora FMS agent for all Microsoft Windows platforms } - -PackageVersion -{<%MajorVersion%>.<%MinorVersion%>} - -PreserveFileAttributes -{Yes} - -PreserveFilePermissions -{No} - -ProjectID -{0EA13B96-1BB2-4238-B248-101B4F906C15} - -ProjectVersion -{1.2.15.2} - -SaveOnlyToplevelDirs -{No} - -ScriptExt -{.bat} - -ShortAppName -{Pandora FMS} - -SkipUnusedFileGroups -{No} - -SystemLanguage -{es} - -Theme -{Modern_Wizard} - -ThemeDir -{Modern_Wizard} - -ThemeVersion -{1} - -UpgradeApplicationID -{} - -Version -<<<<<<< HEAD -{170406} -======= -{170418} ->>>>>>> develop - -ViewReadme -{Yes} - -WizardHeight -{365} - -WizardWidth -{500} - -} - -array set ::InstallJammer::InstallCommandLineOptions { -mode -{InstallMode Choice No No {Silent Standard} {Set the mode to run the installer in}} - -prefix -{InstallDir String No No {} {Set the installation directory}} - -} -array set ::InstallJammer::UninstallCommandLineOptions { -debugconsole -{ShowConsole Switch Yes No {} {run uninstaller with a debug console open}} - -mode -{UninstallMode Choice No No {Silent Standard} {set the mode to run the uninstaller in}} - -test -{Testing Switch Yes No {} {run uninstaller without uninstalling any files}} - -} -FileGroup ::946FC43B-0E32-4C38-86EF-4F9252C67E16 -setup Install -active Yes -platforms {Windows MacOS-X FreeBSD-5-x86 FreeBSD-6-x86 FreeBSD-7-x86 Linux-x86_64 Solaris-x86} -name {Program Files} -parent FileGroups -File ::7003FDCA-0EDA-4431-93E2-6FEA7E8660D6 -type dir -name ../bin/key -parent 946FC43B-0E32-4C38-86EF-4F9252C67E16 -File ::B33B08D0-C80C-49CB-9431-44C6B4E7858E -name id_dsa -parent 7003FDCA-0EDA-4431-93E2-6FEA7E8660D6 -File ::7E8B4918-C894-4FCE-98F0-1DDDBF9818F8 -name id_dsa.pub -parent 7003FDCA-0EDA-4431-93E2-6FEA7E8660D6 -File ::D2362133-1FE1-4D75-8607-083C08CFDE94 -name PUT_SSH_KEYS_HERE -parent 7003FDCA-0EDA-4431-93E2-6FEA7E8660D6 -File ::A2DBFC3C-AC45-DAE1-0F04-D279DDC1EB36 -type dir -name .svn -active 0 -parent 7003FDCA-0EDA-4431-93E2-6FEA7E8660D6 -File ::9AF0652D-DF48-17E1-CAC6-C7A95749BF39 -name all-wcprops -active 0 -parent A2DBFC3C-AC45-DAE1-0F04-D279DDC1EB36 -File ::1752E819-4309-7363-EE84-9F995878B58A -name entries -active 0 -parent A2DBFC3C-AC45-DAE1-0F04-D279DDC1EB36 -File ::B2A5618C-97E8-618A-F575-AF5111A86436 -name format -active 0 -parent A2DBFC3C-AC45-DAE1-0F04-D279DDC1EB36 -File ::EC823A02-66E1-E5D0-222D-50EC848E935D -type dir -name prop-base -active 0 -parent A2DBFC3C-AC45-DAE1-0F04-D279DDC1EB36 -File ::CDE9655C-0BB8-862F-BC70-81E68E4E780B -name id_dsa.pub.svn-base -active 0 -parent EC823A02-66E1-E5D0-222D-50EC848E935D -File ::0A68C64D-C7FD-BEAD-710C-15A33BF42394 -name id_dsa.svn-base -active 0 -parent EC823A02-66E1-E5D0-222D-50EC848E935D -File ::412B52E5-5FC9-6C45-AAA8-61E792250F0C -type dir -name props -active 0 -parent A2DBFC3C-AC45-DAE1-0F04-D279DDC1EB36 -File ::AC4C1CD4-E4E5-CED0-C4F8-8F72C3BD5C99 -type dir -name text-base -active 0 -parent A2DBFC3C-AC45-DAE1-0F04-D279DDC1EB36 -File ::69B9D8E8-AA25-F6BA-D556-6601B1679C11 -name id_dsa.pub.svn-base -active 0 -parent AC4C1CD4-E4E5-CED0-C4F8-8F72C3BD5C99 -File ::73569099-F7B9-CC82-A469-52F721A70B61 -name id_dsa.svn-base -active 0 -parent AC4C1CD4-E4E5-CED0-C4F8-8F72C3BD5C99 -File ::3A083CE1-9577-2E23-60B6-B4628E3AFF7A -name PUT_SSH_KEYS_HERE.svn-base -active 0 -parent AC4C1CD4-E4E5-CED0-C4F8-8F72C3BD5C99 -File ::A3D31F9A-9C90-6019-0D36-2BF7D54FBAFC -type dir -name tmp -active 0 -parent A2DBFC3C-AC45-DAE1-0F04-D279DDC1EB36 -File ::8E51353E-6421-44F0-866E-FA3A75AF303E -type dir -name prop-base -active 0 -parent A3D31F9A-9C90-6019-0D36-2BF7D54FBAFC -File ::685ECBDE-3A87-4D92-4954-BC35E4768E42 -type dir -name props -active 0 -parent A3D31F9A-9C90-6019-0D36-2BF7D54FBAFC -File ::42CF5A97-A991-05CF-E5F7-7F78D5D52CEE -type dir -name text-base -active 0 -parent A3D31F9A-9C90-6019-0D36-2BF7D54FBAFC -File ::6E5B73B7-8B81-48D7-BF49-59D8D92FB830 -type dir -name ../bin/util -parent 946FC43B-0E32-4C38-86EF-4F9252C67E16 -File ::C410E57A-3F3E-4622-AB1B-DB6A0EBCED01 -name cut.exe -parent 6E5B73B7-8B81-48D7-BF49-59D8D92FB830 -File ::9EB6D55B-F596-4486-9A5A-6A374A3E6CDA -name date.exe -parent 6E5B73B7-8B81-48D7-BF49-59D8D92FB830 -File ::0F0DB1A3-D6CA-4ADF-87A3-A0ED76C60C6B -name expr.exe -parent 6E5B73B7-8B81-48D7-BF49-59D8D92FB830 -File ::E9117E64-E7B3-48A3-8B57-5D9F20852EAB -name gawk.exe -parent 6E5B73B7-8B81-48D7-BF49-59D8D92FB830 -File ::96EE4F8B-1EC7-46E0-869A-88D14CBD82F0 -name grep.exe -parent 6E5B73B7-8B81-48D7-BF49-59D8D92FB830 -File ::CFC44D73-74F7-4D14-8FC8-62255B115551 -name head.exe -parent 6E5B73B7-8B81-48D7-BF49-59D8D92FB830 -File ::44B21832-6BF6-4277-9B8C-077E49F53AD2 -name ls.exe -parent 6E5B73B7-8B81-48D7-BF49-59D8D92FB830 -File ::5E41B886-FEFD-4648-B151-71195C2E04DE -name md5.exe -parent 6E5B73B7-8B81-48D7-BF49-59D8D92FB830 -File ::B47EAE44-63B4-4B6F-86A0-00089DDB2437 -name puttygen.exe -parent 6E5B73B7-8B81-48D7-BF49-59D8D92FB830 -File ::F792F4E1-B3E9-43AB-A17B-44E2B3013093 -name tail.exe -parent 6E5B73B7-8B81-48D7-BF49-59D8D92FB830 -File ::306C9DF0-CC33-48DC-8AFC-2B99ED4E00A0 -name tr.exe -parent 6E5B73B7-8B81-48D7-BF49-59D8D92FB830 -File ::1900A2B4-09F5-468A-90AD-75CBE17C727B -name wc.exe -parent 6E5B73B7-8B81-48D7-BF49-59D8D92FB830 -File ::B3D9FD4E-6021-45E6-B9B8-F81CC940540E -name tentacle_client.exe -parent 6E5B73B7-8B81-48D7-BF49-59D8D92FB830 -File ::AD36A2E6-370D-E5CF-3A6A-56AC4137E60C -type dir -name .svn -active 0 -parent 6E5B73B7-8B81-48D7-BF49-59D8D92FB830 -File ::A57FA3AE-443F-FC25-F777-70CAE8FB0892 -name all-wcprops -active 0 -parent AD36A2E6-370D-E5CF-3A6A-56AC4137E60C -File ::5CAE2970-9FA4-CDA6-6156-C0FB81206C93 -name entries -active 0 -parent AD36A2E6-370D-E5CF-3A6A-56AC4137E60C -File ::0C863D99-65DA-2CA7-9CA8-70FBB30A4F02 -name format -active 0 -parent AD36A2E6-370D-E5CF-3A6A-56AC4137E60C -File ::F4812143-55ED-3C48-3FC3-23D8C1456058 -type dir -name prop-base -active 0 -parent AD36A2E6-370D-E5CF-3A6A-56AC4137E60C -File ::5A577337-9685-8CD3-7666-54E6BD51D70C -name cut.exe.svn-base -active 0 -parent F4812143-55ED-3C48-3FC3-23D8C1456058 -File ::14D86BD8-85DE-A53C-34F9-FD6EAF3AC3E6 -name date.exe.svn-base -active 0 -parent F4812143-55ED-3C48-3FC3-23D8C1456058 -File ::B5474580-9B89-F881-AF0F-D89DFE27B74B -name expr.exe.svn-base -active 0 -parent F4812143-55ED-3C48-3FC3-23D8C1456058 -File ::2B1C2B5B-187C-8566-8EDF-0E908A20DBEE -name gawk.exe.svn-base -active 0 -parent F4812143-55ED-3C48-3FC3-23D8C1456058 -File ::346E0DB7-627C-DB73-C59E-B11DB7C3324A -name grep.exe.svn-base -active 0 -parent F4812143-55ED-3C48-3FC3-23D8C1456058 -File ::2360BC3D-5346-2B9A-0707-397F033D6385 -name head.exe.svn-base -active 0 -parent F4812143-55ED-3C48-3FC3-23D8C1456058 -File ::C1F38550-393D-79E1-6C1D-D7AEFA932F01 -name ls.exe.svn-base -active 0 -parent F4812143-55ED-3C48-3FC3-23D8C1456058 -File ::F56EAD1E-60C0-B1F2-F01D-4887B9D0FF0B -name md5.exe.svn-base -active 0 -parent F4812143-55ED-3C48-3FC3-23D8C1456058 -File ::BC5CBC91-43CB-BAB7-622D-A2F93E566458 -name puttygen.exe.svn-base -active 0 -parent F4812143-55ED-3C48-3FC3-23D8C1456058 -File ::D4510D67-0DA2-F7F1-E6A1-924452FA9E74 -name tail.exe.svn-base -active 0 -parent F4812143-55ED-3C48-3FC3-23D8C1456058 -File ::7AE3F476-020E-BA1A-626B-C631F1D6DEBC -name tr.exe.svn-base -active 0 -parent F4812143-55ED-3C48-3FC3-23D8C1456058 -File ::BB01F71B-2DA6-A63E-C112-542974B20C30 -name wc.exe.svn-base -active 0 -parent F4812143-55ED-3C48-3FC3-23D8C1456058 -File ::1867308F-F69E-2BE3-9DF6-A5ECD58AA2CE -type dir -name props -active 0 -parent AD36A2E6-370D-E5CF-3A6A-56AC4137E60C -File ::D7C4B924-B3CE-BE13-A62B-9EB256F73AB4 -name tentacle_client.exe.svn-work -active 0 -parent 1867308F-F69E-2BE3-9DF6-A5ECD58AA2CE -File ::13FFC58B-812B-624A-170C-B8954D13574D -type dir -name text-base -active 0 -parent AD36A2E6-370D-E5CF-3A6A-56AC4137E60C -File ::9BD4AAF6-4D9F-0D52-21FC-388AE4C148C4 -name cut.exe.svn-base -active 0 -parent 13FFC58B-812B-624A-170C-B8954D13574D -File ::CFC49473-239A-EDC9-EAC3-74282513DFAF -name date.exe.svn-base -active 0 -parent 13FFC58B-812B-624A-170C-B8954D13574D -File ::9F8DF1C5-531E-EDC6-E477-F49C063F927C -name expr.exe.svn-base -active 0 -parent 13FFC58B-812B-624A-170C-B8954D13574D -File ::783FD37D-8F07-6991-E37D-22A2706716CB -name gawk.exe.svn-base -active 0 -parent 13FFC58B-812B-624A-170C-B8954D13574D -File ::2305CCBD-4447-BAF4-0E7F-E38133567DB4 -name grep.exe.svn-base -active 0 -parent 13FFC58B-812B-624A-170C-B8954D13574D -File ::B1E1E90B-9A96-2526-9583-E31A370A15C9 -name head.exe.svn-base -active 0 -parent 13FFC58B-812B-624A-170C-B8954D13574D -File ::BA9586FF-BA3E-2E73-B262-CF7AF48AB4DC -name ls.exe.svn-base -active 0 -parent 13FFC58B-812B-624A-170C-B8954D13574D -File ::732C7A8A-3FC1-172E-B943-0CF1BFADA5F2 -name md5.exe.svn-base -active 0 -parent 13FFC58B-812B-624A-170C-B8954D13574D -File ::8021D8AA-4F3C-0B5D-61D1-610F3616572B -name puttygen.exe.svn-base -active 0 -parent 13FFC58B-812B-624A-170C-B8954D13574D -File ::139033A0-D9E6-870A-5BFF-2261D1D707D1 -name tail.exe.svn-base -active 0 -parent 13FFC58B-812B-624A-170C-B8954D13574D -File ::D25CAB78-44B6-9998-7B56-1E6DE957ED78 -name tr.exe.svn-base -active 0 -parent 13FFC58B-812B-624A-170C-B8954D13574D -File ::2E2CE748-D169-27FE-DC76-13933FA60A6D -name wc.exe.svn-base -active 0 -parent 13FFC58B-812B-624A-170C-B8954D13574D -File ::FC2CF695-F050-712A-EAC4-B57D19D00C77 -type dir -name tmp -active 0 -parent AD36A2E6-370D-E5CF-3A6A-56AC4137E60C -File ::17DD23ED-CFF6-4E2E-AE99-2AA03F4DC4C4 -type dir -name prop-base -active 0 -parent FC2CF695-F050-712A-EAC4-B57D19D00C77 -File ::7FFC041E-C253-BA7D-D890-3D88CDBA434C -type dir -name props -active 0 -parent FC2CF695-F050-712A-EAC4-B57D19D00C77 -File ::955A9B5D-775D-4C4B-07C6-1E457A3AEF04 -type dir -name text-base -active 0 -parent FC2CF695-F050-712A-EAC4-B57D19D00C77 -File ::57A504DC-687C-F126-8B39-6A70F43C156A -name cmp.exe -parent 6E5B73B7-8B81-48D7-BF49-59D8D92FB830 -File ::B71D3B59-A60B-6C21-76D4-292FA73C1613 -name getreg.exe -parent 6E5B73B7-8B81-48D7-BF49-59D8D92FB830 -File ::DB77AA43-D4B7-239C-0F48-52502E17D4DC -name sort.exe -parent 6E5B73B7-8B81-48D7-BF49-59D8D92FB830 -File ::7B1652FD-0C02-13A8-BAA8-1B6F8BB257A5 -name df.vbs -parent 6E5B73B7-8B81-48D7-BF49-59D8D92FB830 -File ::558D0D7E-2D41-EA8A-325D-27FA08CE8B69 -name ps.vbs -parent 6E5B73B7-8B81-48D7-BF49-59D8D92FB830 -File ::92375EEB-039A-EAF0-C1AC-B91B00CD1DD6 -name logevent_log4x.vbs -parent 6E5B73B7-8B81-48D7-BF49-59D8D92FB830 -File ::0A9C1B7E-7F5C-84E0-55F9-0224A97F3CD2 -name unzip.exe -parent 6E5B73B7-8B81-48D7-BF49-59D8D92FB830 -File ::8B69786B-B84F-22AC-B466-C84617B1330A -type dir -name mibs -parent 6E5B73B7-8B81-48D7-BF49-59D8D92FB830 -File ::10C3DFEB-75EC-B329-9CCB-F96223B326C2 -name SNMP-USER-BASED-SM-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::F7ECC5A7-160D-BA30-5C90-16128275160C -name IPV6-TCP-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::CA57A40B-EAF2-C3FF-0266-4849D92307F3 -name IPV6-UDP-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::A4AE302D-4B1F-1B96-D1AF-63647EE43060 -name UCD-IPFWACC-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::4894E284-5E13-99E3-1CAE-F90BF9006641 -name Makefile.mib -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::CDBCA051-ABF8-586B-EEA2-2738E8B839C7 -name RFC1155-SMI.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::8D3FC0D8-3E89-AA48-8AC1-0E2ABA206413 -name NET-SNMP-MONITOR-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::9E24308A-6C93-A14B-4054-B98C8855B3E7 -name DISMAN-TRACEROUTE-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::104C6B91-8D0A-1830-50F0-85B29FDFA7A4 -name SNMPv2-SMI.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::1CEF1B2C-F75C-9439-260A-940E0B6BDF34 -name RFC1213-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::1737EB19-488D-CC18-8B5B-1118C9868A2C -name HOST-RESOURCES-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::E3CCE554-B504-5F5F-7F74-FF9C7B31BF4D -name NETWORK-SERVICES-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::5C1CE0DF-685D-8D71-7E6E-A2DFAAAF3AB9 -name UCD-SNMP-MIB-OLD.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::E603538F-D5D1-6EDF-CE46-CB9C4DC718F1 -name AGENTX-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::471A4833-F9C7-0E6A-FF2D-159AB861F958 -name SNMP-VIEW-BASED-ACM-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::797C81CC-9E82-ACFC-8D45-A94DC430755D -name HOST-RESOURCES-TYPES.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::45BFFEA9-B757-1464-8F91-A07A03BA229C -name ianalist -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::88C873FE-F358-1FBC-608F-4273AD8391E4 -name RMON-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::0AC17338-9F54-9B51-00A1-9FB655FE5A8F -name HCNUM-TC.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::4B3D7FA9-0633-0969-0D48-86E9714EDDB7 -name UCD-DLMOD-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::71E96358-3EC9-3FF2-DE0F-24713B0BE65B -name EtherLike-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::0AC34548-4415-39F5-F75E-3E54611FBEA1 -name NET-SNMP-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::F3A8B2CF-374D-D5F1-AAAD-675F04ECF107 -name LM-SENSORS-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::7EE2B7C3-913B-A889-EEFB-8FD7D5B36D3D -name IANA-ADDRESS-FAMILY-NUMBERS-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::DFD52E2F-6DE4-5176-C430-683C42915D68 -name rfcmibs.diff -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::77DAD413-0D51-0043-DAB1-959155FA1584 -name SMUX-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::42EEFE3A-A534-4FDD-2D98-EDE92C9D56D5 -name IANA-RTPROTO-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::2DB878B1-5A00-3949-E1EB-6C5FFEE1BB6E -name README.mibs -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::EBC9F917-BDA1-5E9E-70A2-939E85145E96 -name UCD-IPFWACC-MIB.inc -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::8DA0A3E3-5D3A-493A-30B3-86A81D35C077 -name rfclist -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::414F8D04-D7F8-8E4B-8B9C-34C9CEEAE990 -name RFC-1215.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::3DECE776-AE57-4B11-1B00-C1E5D6E680F5 -name TUNNEL-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::316FEA16-1105-B2F9-1D64-0F94F07451DB -name makehtml.pl -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::98D3387E-6994-71AD-5E68-EC53C256BF89 -name Makefile.in -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::DD5BA10C-D728-E267-CC3C-6BFBDB0FD0F4 -name INET-ADDRESS-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::787BF3D9-F3D8-AEDC-C0A8-4539892510B3 -name DISMAN-EVENT-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::40A38693-383D-E70D-2D0B-97F14FC06A25 -name SNMPv2-TM.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::B172ABC4-5B10-6800-1C26-B5E4E7DCB3BE -name NET-SNMP-TC.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::029D3EFA-AA5D-FE7D-9B70-CB162B8731BC -name SNMP-MPD-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::C69A3E3F-602D-B85A-AD84-CD3FF7163906 -name SNMP-TARGET-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::8CDCB12A-2544-A5C7-A6F0-6C5A9D0C061D -name NET-SNMP-SYSTEM-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::A9026441-0B6F-D92B-1A07-ED3DD99BD501 -name smistrip -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::48CA671F-9217-EDAF-4196-9D9AF61A699B -name DISMAN-NSLOOKUP-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::CB1B4307-0998-D9C3-AB12-4F0367B9BC50 -name NET-SNMP-EXAMPLES-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::37418DC6-CB58-F6D6-C221-FE20835BA5B6 -name TCP-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::74E4DAD6-E267-4FBD-C7E2-FCBEF64BF132 -name DISMAN-PING-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::0A4E3D96-62B4-0244-A2C3-3E8CA564EDE0 -name NET-SNMP-AGENT-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::6620F423-865F-91B1-4C0E-93D483092228 -name NET-SNMP-EXTEND-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::8049FBBB-1C36-02C7-8690-5C24686D9CD2 -name IP-FORWARD-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::183ED813-65AD-F929-5041-715D4FD09737 -name DISMAN-SCHEDULE-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::51842E62-465C-E1B4-2DEA-871C045AF913 -name UCD-DISKIO-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::569B4E77-0B32-E95A-8540-2C97C2B2A354 -name SNMPv2-TC.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::DA1819A0-F1C0-B6BD-3C5D-FC02602ABDB2 -name SNMP-NOTIFICATION-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::C90B00DD-3DF9-5A10-80A4-F173C81E267B -name IANAifType-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::4CDDD873-7C7B-DDF1-0547-C716FA2EE6B8 -name UCD-DISKIO-MIB.inc -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::56603234-865E-B851-B55A-9A620209A198 -name SNMPv2-CONF.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::1112D09B-33C9-483A-E700-C85832FC6C69 -name IPV6-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::AF86F856-6A36-299A-5ADA-5CC9E3B14BA1 -name SNMPv2-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::605BCDB3-C411-8D49-BF90-B0D3E29288C9 -name DISMAN-EXPRESSION-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::DB106B45-CA94-21A2-F638-19EEC4BB84B6 -name IANA-LANGUAGE-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::B2FE8CE3-716F-A393-D0D3-FAAF748EFAB0 -name UCD-DEMO-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::D4295B27-BEDC-FDF3-48B1-2A58B7CF306D -name SNMP-PROXY-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::9DB499F2-F384-C5AA-E496-CA7F859FF8C8 -name IPV6-ICMP-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::B8B3D274-B94B-809E-5ABC-E2B0488B51B5 -name DISMAN-SCRIPT-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::00F9ECA3-E979-9343-7F94-9D8F349EF579 -name mibfetch -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::9430EE3D-3EF2-5CE9-BA36-02A3C0680C37 -name SNMP-FRAMEWORK-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::5A093FFD-6A05-1693-6A29-F5D68054DF46 -name UDP-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::73AD77A4-08F4-8A7D-D52B-6151D11FF33F -name UCD-DEMO-MIB.inc -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::C0B97EE6-9A3C-2EF0-22ED-082B40EE910F -name UCD-SNMP-MIB.inc -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::02DE3F78-ED9A-5A73-D283-0CD205B7BE58 -name TRANSPORT-ADDRESS-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::09203A02-1DA2-BDE3-175B-15043E2ACAE0 -name SNMP-USM-DH-OBJECTS-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::BEEFE984-6F00-376D-7BCE-812B945AEDBD -name SNMP-USM-AES-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::3D1E7967-95A3-E9B8-3579-6FFDF0D1E5AF -name UCD-DLMOD-MIB.inc -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::1A4D4BF6-FF57-559E-251B-F63BB6D9FA94 -name UCD-IPFILTER-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::31EC3141-C348-56FF-16E2-75C2FFA65413 -name MTA-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::17D117A5-B736-A21C-AAC1-C6B017A644D5 -name IPV6-TC.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::E1FDBB74-8D12-9843-B4D3-40385D91CDF5 -name SNMP-COMMUNITY-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::8CD8FE57-2B98-7814-258B-1D4FB03B144E -name IF-INVERTED-STACK-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::4A727B8A-ED01-A5C4-BFF3-F7E632E1F056 -name NOTIFICATION-LOG-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::074CBF5A-7246-A35C-EBD7-DAECBDFA8044 -name IF-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::69610A79-5EA4-6111-2946-D870A009B4FD -name UCD-SNMP-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::2285B4E9-C139-D5EC-DCF4-F0943BBB0FE1 -name nodemap -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::CC5A58CA-2719-7E75-7DC9-178C4A7AB956 -name UCD-IPFILTER-MIB.inc -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::4AF37C51-C6F6-71AB-BA2A-759CCF9EE297 -name IP-MIB.txt -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::1D9B106C-A0A0-4989-645B-0A1AFDC44138 -name .index -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::75B2C5A2-5AA7-FD10-9FF9-65820B3199E3 -type dir -name .svn -active 0 -parent 8B69786B-B84F-22AC-B466-C84617B1330A -File ::D5FFCDEA-B30C-90E1-1B2C-49DB89A2D90F -name all-wcprops -active 0 -parent 75B2C5A2-5AA7-FD10-9FF9-65820B3199E3 -File ::55BD2C4F-212D-947D-4CE5-7A1A6463AF3A -name entries -active 0 -parent 75B2C5A2-5AA7-FD10-9FF9-65820B3199E3 -File ::7BB33BC9-F34E-ACAC-5D2E-D8CE67590378 -type dir -name prop-base -active 0 -parent 75B2C5A2-5AA7-FD10-9FF9-65820B3199E3 -File ::6A15022F-5512-B5CE-287B-9FD87C8D4D61 -type dir -name props -active 0 -parent 75B2C5A2-5AA7-FD10-9FF9-65820B3199E3 -File ::CC1D7221-8233-5190-029D-9F0AF2B73225 -type dir -name text-base -active 0 -parent 75B2C5A2-5AA7-FD10-9FF9-65820B3199E3 -File ::2D8DAE81-C0D0-DEA9-0E71-DCF7CA54127F -name .index.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::DFCFD8E2-0B13-19E0-CACA-B729EB6717B3 -name AGENTX-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::1EE676C1-0749-31CE-7BA6-3B28862BA05B -name DISMAN-EVENT-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::32A01452-C5B3-A36A-9343-2473FF0EF86B -name DISMAN-EXPRESSION-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::2B2D0A95-26A6-F27D-1129-FC227D045DD3 -name DISMAN-NSLOOKUP-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::DCEFFC46-98EA-5B9D-5DBF-2A912D9998C0 -name DISMAN-PING-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::392AA770-335C-6B27-8B56-F309A8E78251 -name DISMAN-SCHEDULE-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::FFB1354A-B5E7-4A95-8755-CC5A435BE297 -name DISMAN-SCRIPT-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::C25E27F3-CE18-1B9A-D285-3D3F6A7BD2AE -name DISMAN-TRACEROUTE-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::427CB562-066F-C2E6-9264-E462AE38854E -name EtherLike-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::1B50866C-5C89-EF5A-FEE7-0EEA3C1A523D -name HCNUM-TC.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::B351A78A-038D-57FB-7CAA-FE00C2843AD6 -name HOST-RESOURCES-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::C91B3BFF-0FA4-3A20-83E9-688B9CA4A7D4 -name HOST-RESOURCES-TYPES.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::E7882D39-8A22-B573-33CF-54D2417E5AF1 -name IANA-ADDRESS-FAMILY-NUMBERS-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::6D6BC24F-6F51-E69E-EFCF-83CD3CF8F567 -name IANA-LANGUAGE-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::EF828668-6C7B-A51B-8140-D84F9AB9760C -name IANA-RTPROTO-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::7AE6382F-49F2-4D61-5124-1E4F083CB2E4 -name IANAifType-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::2291B1C0-3660-0D31-44D9-25BE27886AC2 -name ianalist.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::ED8393C4-0988-2F37-6362-82741C8BEF18 -name IF-INVERTED-STACK-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::72FBD6F5-473A-C962-6879-35015BA8D5C9 -name IF-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::AF3EA403-49CC-511E-75F2-1365816200CA -name INET-ADDRESS-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::C2B56606-E28D-EF6A-F28D-CA81B1AB67A7 -name IP-FORWARD-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::11332249-7CE3-2A37-AA1F-48925709668F -name IP-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::F9F74BD2-5DB1-52AF-E0F2-F83FBF978E48 -name IPV6-ICMP-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::1F3DED36-1DCF-21F3-7AF7-60BF0B8E490D -name IPV6-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::03762ED4-7F88-4853-2E89-2FD018A9BFF4 -name IPV6-TC.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::D0BBA9CA-701B-22C1-BB15-0D7C94C40D49 -name IPV6-TCP-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::9623E8DC-ABB6-3FE9-467C-977F1FC8D0C8 -name IPV6-UDP-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::B18EC413-4AA0-2161-0416-1B7EAF5B8587 -name LM-SENSORS-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::4FACC844-DC8A-3778-4E4F-9A4D3FE935B7 -name Makefile.in.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::5E65F151-1031-98D3-07DD-40A01F1081D9 -name Makefile.mib.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::79B81A40-00D4-397A-B228-BB4EE6006FCD -name makehtml.pl.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::729BAE35-6BD2-7C45-498A-678218DFF994 -name mibfetch.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::CD1D4E0D-3220-D888-225C-B09A2AF69D47 -name MTA-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::A1F3C16D-E3E7-8D4B-A0FA-5EA3DDC5C3E7 -name NET-SNMP-AGENT-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::6E5845C0-2470-FD92-3388-832E9EA5E41D -name NET-SNMP-EXAMPLES-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::07B57915-D30A-9B31-0F00-B4051EA17FDF -name NET-SNMP-EXTEND-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::1B9F5B34-1BCC-14B4-649E-646E703AAC42 -name NET-SNMP-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::57059FFB-1AD1-0C53-DB25-556CF56EBC55 -name NET-SNMP-MONITOR-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::9334F7D7-CAD8-756E-A495-E8A1B72C3C65 -name NET-SNMP-SYSTEM-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::979000C2-2CAA-422A-BFFA-B6E2618DF99F -name NET-SNMP-TC.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::4C34E0F6-1878-3624-E7DB-9C6B80440D24 -name NETWORK-SERVICES-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::89E5C74E-1C3F-D63C-57F8-FCB8CF2FCCC4 -name nodemap.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::B13201FB-7A83-9639-A999-9F330EA3A849 -name NOTIFICATION-LOG-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::B86561D3-9423-E3B7-4233-ADD4A4D26866 -name README.mibs.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::631AF3AA-FBAD-A007-3063-D0417A00AD25 -name RFC-1215.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::2781ED42-0D91-233F-6F51-0C14E04FCA28 -name RFC1155-SMI.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::4946D7B9-05D4-520B-C842-07CAC8C92DB2 -name RFC1213-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::A1564F0D-7F18-6256-927D-9494240F853B -name rfclist.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::D332BAD1-6058-BEF6-7CDD-3503E8DC07B6 -name rfcmibs.diff.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::41972A3C-4B83-3DC4-C18C-708B13422B13 -name RMON-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::81C1DDBE-CBDE-FE8A-83D2-13C99D113762 -name smistrip.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::BB7554E3-04DA-E5BE-D502-1001B803E565 -name SMUX-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::F27B00AA-549A-E044-EB78-369A84AF6CB8 -name SNMP-COMMUNITY-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::26E15926-97FB-CEEC-4157-B94FE7E83765 -name SNMP-FRAMEWORK-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::287047DE-53D8-D514-4E13-121FFAD31A0F -name SNMP-MPD-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::E0109AEF-812E-CF43-83C4-EB3CD4C00C8B -name SNMP-NOTIFICATION-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::B7F3BA89-6757-A82E-8DC8-CE1EA8048686 -name SNMP-PROXY-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::4D7D18CF-0E14-59C5-518F-7C0CD0B2CB4D -name SNMP-TARGET-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::FB47BE7F-2B32-CC30-2CA1-83D4CDF00215 -name SNMP-USER-BASED-SM-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::FC1443BA-24F6-9C83-630D-BB8F957BE52E -name SNMP-USM-AES-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::AC046AA3-A8D4-C3E2-C3E5-E7B68A501089 -name SNMP-USM-DH-OBJECTS-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::38691298-28A8-81F6-F1FC-00ECE21205D7 -name SNMP-VIEW-BASED-ACM-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::DFF8B0D9-907E-B263-9F23-48216BB2D058 -name SNMPv2-CONF.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::5CCFF16F-2A94-EB09-9E3E-519A3A1FE805 -name SNMPv2-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::6FFEF5BF-6508-2A40-811D-3863399E9D59 -name SNMPv2-SMI.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::97565931-8C89-F029-99A1-6DFC1979A3E8 -name SNMPv2-TC.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::3F15A49F-6BEC-F45F-DDF9-CC50CD4CC21E -name SNMPv2-TM.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::E01ACDF9-4DCE-C415-DC49-3BC213F23B10 -name TCP-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::9992E720-1A2F-2198-C236-DAA92181721A -name TRANSPORT-ADDRESS-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::479EA0FB-98E3-8710-E883-BBB9C667066A -name TUNNEL-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::7D605D50-615C-B0F9-567D-6246A313851F -name UCD-DEMO-MIB.inc.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::4FDA6897-97C5-F7E6-0AFA-52E362F9E84A -name UCD-DEMO-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::AB270B18-95CB-F42F-CA15-11359EAD35B0 -name UCD-DISKIO-MIB.inc.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::AC27DF3F-F522-2A06-BDF1-4645C9F942AE -name UCD-DISKIO-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::B3E11B2E-35C4-0B97-4408-74167C185C22 -name UCD-DLMOD-MIB.inc.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::73CFF637-FBBB-7D64-B498-2FBEAD83AADA -name UCD-DLMOD-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::569CD04F-9E6E-06E4-1B1F-4B58E0EE441A -name UCD-IPFILTER-MIB.inc.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::81EA4416-1E6D-2557-FAF6-1D4E768069C0 -name UCD-IPFILTER-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::7A6CA16A-B3E1-702B-6860-5580B12030AB -name UCD-IPFWACC-MIB.inc.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::C85A4B0A-C307-8DD6-FF88-31738AEE4BEE -name UCD-IPFWACC-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::AFDF3F9B-A060-F8C6-5B4C-208AFE2176B2 -name UCD-SNMP-MIB-OLD.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::424B0ACB-B435-1C68-47EF-88A3E9546523 -name UCD-SNMP-MIB.inc.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::855032CB-FC6E-DFA1-BC63-E5D4FD29F185 -name UCD-SNMP-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::94CA96D2-F700-B1A8-A825-6729707FF6A6 -name UDP-MIB.txt.svn-base -active 0 -parent CC1D7221-8233-5190-029D-9F0AF2B73225 -File ::8BED0534-84A0-E7A1-104A-7AB6FF964C31 -type dir -name tmp -active 0 -parent 75B2C5A2-5AA7-FD10-9FF9-65820B3199E3 -File ::FCD8F7DA-CA57-B939-BE6D-7582A8AC2EA5 -type dir -name prop-base -active 0 -parent 8BED0534-84A0-E7A1-104A-7AB6FF964C31 -File ::A549C9BC-62C4-F94D-5195-28EA21C4F48E -type dir -name props -active 0 -parent 8BED0534-84A0-E7A1-104A-7AB6FF964C31 -File ::A26BD65A-2404-4564-6D36-8FD8EBECA57C -type dir -name text-base -active 0 -parent 8BED0534-84A0-E7A1-104A-7AB6FF964C31 -File ::3A6A9726-7944-6766-FE7A-45E11E8324EC -name df_percent.vbs -parent 6E5B73B7-8B81-48D7-BF49-59D8D92FB830 -File ::DC4E6C4D-0CAC-9299-7F7E-715C90CA2655 -name getsnmp.bat -parent 6E5B73B7-8B81-48D7-BF49-59D8D92FB830 -File ::1DD45A3E-D828-38FB-3715-D9DA537EDCAA -name snmpget.exe -parent 6E5B73B7-8B81-48D7-BF49-59D8D92FB830 -File ::F054DB92-ED3C-63C1-3907-9C1350C0EC25 -name pandora_update.exe -parent 6E5B73B7-8B81-48D7-BF49-59D8D92FB830 -File ::F9A7539E-8E6F-05A5-18D4-3E366C257AE5 -name tentacle_server.exe -parent 6E5B73B7-8B81-48D7-BF49-59D8D92FB830 -File ::45D372F1-229D-5318-5AF0-84BF65848E79 -name curl.exe -parent 6E5B73B7-8B81-48D7-BF49-59D8D92FB830 -File ::6B032FAE-541E-EC63-8EB9-3407BE28B665 -name pandora_revent.exe -parent 6E5B73B7-8B81-48D7-BF49-59D8D92FB830 -File ::03A7EA5A-D6FC-4427-B35C-0288C07813B6 -filemethod {Never overwrite files} -name ../bin/pandora_agent.conf -parent 946FC43B-0E32-4C38-86EF-4F9252C67E16 -File ::71EFB181-1BAE-4749-B7E7-7837E378BA3D -name ../bin/PandoraAgent.exe -parent 946FC43B-0E32-4C38-86EF-4F9252C67E16 -File ::50980131-CDA1-4F32-86E0-FD53B1097F67 -name ../installer/pandora.ico -parent 946FC43B-0E32-4C38-86EF-4F9252C67E16 -File ::3267E440-2104-4BA2-BDEB-DFDA32441FC2 -name ../installer/LICENSE.txt -parent 946FC43B-0E32-4C38-86EF-4F9252C67E16 -File ::423325D1-5C33-41ED-965A-F7E1F2A2C32E -name ../installer/README.txt -parent 946FC43B-0E32-4C38-86EF-4F9252C67E16 -File ::9F4D1B79-C9AE-4F1F-AC50-876657B3361C -type dir -name ../installer/scripts -parent 946FC43B-0E32-4C38-86EF-4F9252C67E16 -File ::8C09E6D4-4B09-4AA5-B025-441389C76F70 -name start_pandora_agent.bat -parent 9F4D1B79-C9AE-4F1F-AC50-876657B3361C -File ::BA05415F-E246-45AE-A0B1-21C7AB400402 -name stop_pandora_agent.bat -parent 9F4D1B79-C9AE-4F1F-AC50-876657B3361C -File ::F9332D6C-1AB8-5657-0FD3-02D1B30B6EC2 -type dir -name .svn -active 0 -parent 9F4D1B79-C9AE-4F1F-AC50-876657B3361C -File ::FCD8D912-5FEE-9260-43B9-AAC4A3D97A74 -name all-wcprops -active 0 -parent F9332D6C-1AB8-5657-0FD3-02D1B30B6EC2 -File ::B52ADC0B-DDFE-19EA-217D-A9879FDB0ED0 -name entries -active 0 -parent F9332D6C-1AB8-5657-0FD3-02D1B30B6EC2 -File ::F1C08FA0-FC7D-A314-A3ED-79CABF0D6691 -name format -active 0 -parent F9332D6C-1AB8-5657-0FD3-02D1B30B6EC2 -File ::7C00D02E-E023-12F5-37DB-99EF5C139127 -type dir -name prop-base -active 0 -parent F9332D6C-1AB8-5657-0FD3-02D1B30B6EC2 -File ::9D70EC00-D797-99F7-D436-A245939366E9 -type dir -name props -active 0 -parent F9332D6C-1AB8-5657-0FD3-02D1B30B6EC2 -File ::916998A8-1F74-A5B7-EF97-4576BF4640EE -type dir -name text-base -active 0 -parent F9332D6C-1AB8-5657-0FD3-02D1B30B6EC2 -File ::022AD27A-A285-F9D4-6374-56A6DCB382DA -name start_pandora_agent.bat.svn-base -active 0 -parent 916998A8-1F74-A5B7-EF97-4576BF4640EE -File ::5F1E6560-AEB6-9C49-4A34-9D0410B1BB5D -name stop_pandora_agent.bat.svn-base -active 0 -parent 916998A8-1F74-A5B7-EF97-4576BF4640EE -File ::23F0FBAE-5849-2617-4616-D50FE1FCB137 -type dir -name tmp -active 0 -parent F9332D6C-1AB8-5657-0FD3-02D1B30B6EC2 -File ::9513C1EE-B08B-2ABE-38EF-C153696EFCD6 -type dir -name prop-base -active 0 -parent 23F0FBAE-5849-2617-4616-D50FE1FCB137 -File ::2BBBE1D9-BA80-E6CA-835E-9D958A4CF3C3 -type dir -name props -active 0 -parent 23F0FBAE-5849-2617-4616-D50FE1FCB137 -File ::486CB634-5092-8E3B-7621-5B3A044ACCCC -type dir -name text-base -active 0 -parent 23F0FBAE-5849-2617-4616-D50FE1FCB137 -File ::012BFA02-7F3D-897C-072A-877021FDC7D7 -name restart_pandora_agent.bat -parent 9F4D1B79-C9AE-4F1F-AC50-876657B3361C -File ::02213E74-8E86-E4AC-58D0-B70412A05656 -name install_service_restart.bat -parent 9F4D1B79-C9AE-4F1F-AC50-876657B3361C -File ::BAF0FDDB-F0D7-1326-D3CE-7C6676636B83 -name delete_at_job.bat -parent 9F4D1B79-C9AE-4F1F-AC50-876657B3361C -File ::94EE5172-C243-4F11-80CE-C356D9055323 -type dir -name ../bin/help -parent 946FC43B-0E32-4C38-86EF-4F9252C67E16 -File ::38108568-E397-4360-9FDD-BBD7574607E0 -name how_to_keys.html -parent 94EE5172-C243-4F11-80CE-C356D9055323 -File ::096DCAC9-2E8F-4765-9EC5-E40DAFC26B36 -name how_to_keys_es.html -parent 94EE5172-C243-4F11-80CE-C356D9055323 -File ::550F286E-2409-4221-A51A-CA980C9EA9DC -type dir -name images -parent 94EE5172-C243-4F11-80CE-C356D9055323 -File ::6FDE9DD9-ADE8-455A-B864-FA7C2B903604 -name 1.jpg -parent 550F286E-2409-4221-A51A-CA980C9EA9DC -File ::0AFE05E1-E200-4650-8F9E-ED83C9E9ADD4 -name 2.jpg -parent 550F286E-2409-4221-A51A-CA980C9EA9DC -File ::46E928DC-6919-4EC1-86EA-F161C098449D -name 3.jpg -parent 550F286E-2409-4221-A51A-CA980C9EA9DC -File ::5EA49A68-6952-43BF-9A54-1CDF8E48C3D8 -name 4.jpg -parent 550F286E-2409-4221-A51A-CA980C9EA9DC -File ::0C33AC8D-503A-4A9C-801F-2FDEF9FA98C0 -name 5.jpg -parent 550F286E-2409-4221-A51A-CA980C9EA9DC -File ::1B81E274-2375-4287-90D7-953BE3F71FA7 -name 6.jpg -parent 550F286E-2409-4221-A51A-CA980C9EA9DC -File ::C2E02994-9B4E-430C-B399-E93986DD9B0F -name logo.png -parent 550F286E-2409-4221-A51A-CA980C9EA9DC -File ::9D2B9A51-22B6-A99C-5081-FA2019F25C7C -type dir -name .svn -active 0 -parent 550F286E-2409-4221-A51A-CA980C9EA9DC -File ::EE4C4794-AF1B-9B38-C3F3-4A0F30414237 -name all-wcprops -active 0 -parent 9D2B9A51-22B6-A99C-5081-FA2019F25C7C -File ::CDEFB24E-78EC-D33D-C03B-1BF69F9D7240 -name entries -active 0 -parent 9D2B9A51-22B6-A99C-5081-FA2019F25C7C -File ::AE60977B-1615-C577-177E-5B7D25BC1B9D -name format -active 0 -parent 9D2B9A51-22B6-A99C-5081-FA2019F25C7C -File ::2FF9A303-F999-58D0-3FBA-14DBDCCDA37B -type dir -name prop-base -active 0 -parent 9D2B9A51-22B6-A99C-5081-FA2019F25C7C -File ::A315BDD0-BFAC-9951-DBA9-9C0069787C3C -name 1.jpg.svn-base -active 0 -parent 2FF9A303-F999-58D0-3FBA-14DBDCCDA37B -File ::F6039348-9850-F462-2574-1E5E891BF3E6 -name 2.jpg.svn-base -active 0 -parent 2FF9A303-F999-58D0-3FBA-14DBDCCDA37B -File ::FC2B37A3-0080-541B-9966-57C1D1C1E1D6 -name 3.jpg.svn-base -active 0 -parent 2FF9A303-F999-58D0-3FBA-14DBDCCDA37B -File ::298ED0DB-1234-5BD8-18B8-518B5FB6D496 -name 4.jpg.svn-base -active 0 -parent 2FF9A303-F999-58D0-3FBA-14DBDCCDA37B -File ::053EB4AF-E3D2-3585-97C5-74101DE38A5A -name 5.jpg.svn-base -active 0 -parent 2FF9A303-F999-58D0-3FBA-14DBDCCDA37B -File ::205526D5-AB41-59CD-4E93-921AB6B2C76D -name 6.jpg.svn-base -active 0 -parent 2FF9A303-F999-58D0-3FBA-14DBDCCDA37B -File ::14581560-7252-5709-FDFF-633B5A3E280A -name logo.png.svn-base -active 0 -parent 2FF9A303-F999-58D0-3FBA-14DBDCCDA37B -File ::6F85271E-257E-557C-FAC2-F49C1EDC2096 -type dir -name props -active 0 -parent 9D2B9A51-22B6-A99C-5081-FA2019F25C7C -File ::93B66474-8BCC-512F-7745-93C6A7363B6C -type dir -name text-base -active 0 -parent 9D2B9A51-22B6-A99C-5081-FA2019F25C7C -File ::63801B7E-91F6-27E3-6B1E-FAE252743DB2 -name 1.jpg.svn-base -active 0 -parent 93B66474-8BCC-512F-7745-93C6A7363B6C -File ::69C1BE32-1589-926A-57A7-8CF8462EE436 -name 2.jpg.svn-base -active 0 -parent 93B66474-8BCC-512F-7745-93C6A7363B6C -File ::AB5F3408-BEB6-43EB-BB36-01C2099CDA73 -name 3.jpg.svn-base -active 0 -parent 93B66474-8BCC-512F-7745-93C6A7363B6C -File ::E3C5F440-0EA5-B02E-E0CA-914C0D752579 -name 4.jpg.svn-base -active 0 -parent 93B66474-8BCC-512F-7745-93C6A7363B6C -File ::9FFDE5CB-2B86-E099-0A6D-A963C5DACFED -name 5.jpg.svn-base -active 0 -parent 93B66474-8BCC-512F-7745-93C6A7363B6C -File ::01DD93C8-FC8F-F04F-41E2-4CCE23B17446 -name 6.jpg.svn-base -active 0 -parent 93B66474-8BCC-512F-7745-93C6A7363B6C -File ::47103393-BF3D-73AA-DF55-6EC06D168B87 -name logo.png.svn-base -active 0 -parent 93B66474-8BCC-512F-7745-93C6A7363B6C -File ::AF12F531-ADF4-4FFA-AD4E-51E147AC2AB3 -type dir -name tmp -active 0 -parent 9D2B9A51-22B6-A99C-5081-FA2019F25C7C -File ::E74367AD-B33C-C7BC-29EA-1DD751790525 -type dir -name prop-base -active 0 -parent AF12F531-ADF4-4FFA-AD4E-51E147AC2AB3 -File ::03BE7202-3CE6-912B-55BD-C83BE24DE78D -type dir -name props -active 0 -parent AF12F531-ADF4-4FFA-AD4E-51E147AC2AB3 -File ::C298402E-C607-9ECB-3868-3EC497EE76E9 -type dir -name text-base -active 0 -parent AF12F531-ADF4-4FFA-AD4E-51E147AC2AB3 -File ::ECEC7A07-7C36-C3CD-BFF1-53DD1B27A949 -type dir -name .svn -active 0 -parent 94EE5172-C243-4F11-80CE-C356D9055323 -File ::1F6E3F35-3360-B6DF-DE07-FC8D97EDA429 -name all-wcprops -active 0 -parent ECEC7A07-7C36-C3CD-BFF1-53DD1B27A949 -File ::92DE54C3-70E3-54B0-6ACA-C4AB3ED414C5 -name entries -active 0 -parent ECEC7A07-7C36-C3CD-BFF1-53DD1B27A949 -File ::09CCD851-4F46-30C3-CEDF-3CF15F2F4725 -name format -active 0 -parent ECEC7A07-7C36-C3CD-BFF1-53DD1B27A949 -File ::4B269A0F-E9EF-8E24-DA33-EF312CB9366A -type dir -name prop-base -active 0 -parent ECEC7A07-7C36-C3CD-BFF1-53DD1B27A949 -File ::171423D2-828C-A2F0-6460-817D86D6AEC6 -type dir -name props -active 0 -parent ECEC7A07-7C36-C3CD-BFF1-53DD1B27A949 -File ::A95B27E3-0731-5350-09F6-A20ED47C3DBC -type dir -name text-base -active 0 -parent ECEC7A07-7C36-C3CD-BFF1-53DD1B27A949 -File ::72957FF3-D51C-5F57-9A6A-188E7DF551A3 -name how_to_keys.html.svn-base -active 0 -parent A95B27E3-0731-5350-09F6-A20ED47C3DBC -File ::2ACB40DB-9D1D-97DD-6889-E63A89437823 -name how_to_keys_es.html.svn-base -active 0 -parent A95B27E3-0731-5350-09F6-A20ED47C3DBC -File ::33B94DB4-C180-92CA-28A9-8E748747A201 -type dir -name tmp -active 0 -parent ECEC7A07-7C36-C3CD-BFF1-53DD1B27A949 -File ::9A553712-B42A-6A8F-00B1-4E8933B83D00 -type dir -name prop-base -active 0 -parent 33B94DB4-C180-92CA-28A9-8E748747A201 -File ::9376A1BB-540D-AF99-82D1-DEEDB5621B31 -type dir -name props -active 0 -parent 33B94DB4-C180-92CA-28A9-8E748747A201 -File ::FDE18B19-66AE-E8C6-38A9-FB675E103E81 -type dir -name text-base -active 0 -parent 33B94DB4-C180-92CA-28A9-8E748747A201 -File ::8DC9C5E7-7957-7E7A-5603-F78DACBDE9C2 -type dir -name ../bin/collections -parent 946FC43B-0E32-4C38-86EF-4F9252C67E16 -File ::DC2682C5-68A1-8249-6160-9B1896DAECB9 -type dir -name .svn -active 0 -parent 8DC9C5E7-7957-7E7A-5603-F78DACBDE9C2 -File ::F253AE0D-A56D-F650-C7C7-0FC69D2EA3B8 -type dir -name props -active 0 -parent DC2682C5-68A1-8249-6160-9B1896DAECB9 -File ::A90AA2E8-3EEF-A991-CE94-75B3008A53F7 -type dir -name prop-base -active 0 -parent DC2682C5-68A1-8249-6160-9B1896DAECB9 -File ::EEA6B667-6883-7666-FFFC-E7701DCDBD81 -type dir -name tmp -active 0 -parent DC2682C5-68A1-8249-6160-9B1896DAECB9 -File ::5AF5F713-EEB1-AF49-EAFD-8AB218895F2F -type dir -name prop-base -active 0 -parent EEA6B667-6883-7666-FFFC-E7701DCDBD81 -File ::D98D0A8F-FA65-BECC-B972-AF8E0713F31B -type dir -name text-base -active 0 -parent EEA6B667-6883-7666-FFFC-E7701DCDBD81 -File ::3527B202-4B84-5ECD-EDF6-E1817D90434C -type dir -name props -active 0 -parent EEA6B667-6883-7666-FFFC-E7701DCDBD81 -File ::4D77EDB1-1EE5-72EA-9495-48A48F5F926C -type dir -name text-base -active 0 -parent DC2682C5-68A1-8249-6160-9B1896DAECB9 -File ::B7F88BC0-DD0F-510C-D701-C809345CB1BF -name all-wcprops -active 0 -parent DC2682C5-68A1-8249-6160-9B1896DAECB9 -File ::626C46DF-B711-6026-CA4C-2D0C7FAB64CD -name entries -active 0 -parent DC2682C5-68A1-8249-6160-9B1896DAECB9 -Component ::FB96078B-BA3C-498C-8C20-B01C1F28ACA9 -setup Install -active Yes -platforms {Windows FreeBSD-5-x86 FreeBSD-6-x86 FreeBSD-7-x86 Linux-x86_64 Solaris-x86} -name {Default Component} -parent Components -SetupType ::A87C1A6B-ED26-4B07-8736-750725FF34E4 -setup Install -active Yes -platforms {Windows FreeBSD-5-x86 FreeBSD-6-x86 FreeBSD-7-x86 Linux-x86_64 Solaris-x86} -name Typical -parent SetupTypes - -InstallComponent 1957048E-B498-4FFF-A8BA-F2DF640463B1 -setup Install -type pane -title {Welcome Screen} -component Welcome -active Yes -parent StandardInstall -InstallComponent DE1D4DF7-A35C-4228-8A25-07106AD77C9E -setup Install -type pane -title {License Agreement} -component License -active Yes -parent StandardInstall -InstallComponent EAB473BD-3ECC-4FDE-AF62-B80B89DCAE38 -setup Install -type action -conditions {354871D2-65BD-4414-BB04-F466798FA027 0F1370DF-FF15-4CE7-ADF6-CA74BC642334} -title {Modify Widget} -component ModifyWidget -active Yes -parent DE1D4DF7-A35C-4228-8A25-07106AD77C9E -Condition 354871D2-65BD-4414-BB04-F466798FA027 -active Yes -parent EAB473BD-3ECC-4FDE-AF62-B80B89DCAE38 -title {String Is Condition} -component StringIsCondition -TreeObject::id 354871D2-65BD-4414-BB04-F466798FA027 -Condition 0F1370DF-FF15-4CE7-ADF6-CA74BC642334 -active Yes -parent EAB473BD-3ECC-4FDE-AF62-B80B89DCAE38 -title {String Is Condition} -component StringIsCondition -TreeObject::id 0F1370DF-FF15-4CE7-ADF6-CA74BC642334 -InstallComponent B2E20690-C57D-4286-9977-F2541E04D71F -setup Install -type pane -conditions {F6A6DB43-C89D-4A19-98D3-1E24284260AE E8952A0A-82A0-4AD0-8FA8-8902870AF848} -title {Select Destination} -component SelectDestination -active Yes -parent StandardInstall -Condition F6A6DB43-C89D-4A19-98D3-1E24284260AE -active Yes -parent B2E20690-C57D-4286-9977-F2541E04D71F -title {Script Condition} -component ScriptCondition -TreeObject::id F6A6DB43-C89D-4A19-98D3-1E24284260AE -Condition E8952A0A-82A0-4AD0-8FA8-8902870AF848 -active Yes -parent B2E20690-C57D-4286-9977-F2541E04D71F -title {File Permission Condition} -component FilePermissionCondition -TreeObject::id E8952A0A-82A0-4AD0-8FA8-8902870AF848 -InstallComponent C862BDC0-8F67-4546-B658-4A9A8ADCE385 -setup Install -type pane -title {Start Copying Files} -component StartCopyingFiles -active Yes -parent StandardInstall -InstallComponent 268B55D8-DE61-421A-AB68-A5D4821D981F -setup Install -type pane -title {Copying Files} -component CopyFiles -active Yes -parent StandardInstall -InstallComponent 57BABE6F-717F-4D6A-8A66-921B404862F5 -setup Install -type action -title {Disable Buttons} -component ModifyWidget -active Yes -parent 268B55D8-DE61-421A-AB68-A5D4821D981F -InstallComponent 9F763EAB-21A4-41E7-B51B-EDC4ACF4C5C8 -setup Install -type action -title {Execute Action} -component ExecuteAction -active Yes -parent 268B55D8-DE61-421A-AB68-A5D4821D981F -InstallComponent 8A1B144A-F5F6-430F-A334-C31494182599 -setup Install -type action -title {Move Forward} -component MoveForward -active Yes -parent 268B55D8-DE61-421A-AB68-A5D4821D981F -InstallComponent 22E3617C-DE0E-D452-41DC-8278EA3F9D76 -setup Install -type pane -title {Custom Blank Pane 2} -component CustomBlankPane2 -active Yes -parent StandardInstall -InstallComponent 0464C461-3BD5-93CE-C3BA-C59CA84AD70D -setup Install -type action -title {Add Widget} -component AddWidget -active Yes -parent 22E3617C-DE0E-D452-41DC-8278EA3F9D76 -InstallComponent 2D8098DC-CDEA-32BE-83A6-A5AF95CC583E -setup Install -type action -title {Replace Text In File} -component ReplaceTextInFile -active Yes -parent 22E3617C-DE0E-D452-41DC-8278EA3F9D76 -InstallComponent 68A06F1C-625E-4BF0-AE3B-8BFBD37824C1 -setup Install -type pane -title {Custom Blank Pane 2} -component CustomBlankPane2 -active Yes -parent StandardInstall -InstallComponent 75288342-4CEB-473C-B242-450642503F74 -setup Install -type action -title {Add Widget} -component AddWidget -active Yes -parent 68A06F1C-625E-4BF0-AE3B-8BFBD37824C1 -InstallComponent 0C4A17DA-7867-40CC-81B4-0D1F170581AC -setup Install -type action -title {Replace Text In File} -component ReplaceTextInFile -active Yes -parent 68A06F1C-625E-4BF0-AE3B-8BFBD37824C1 -InstallComponent 1F7BE720-7885-4150-9550-F25FB1C69423 -setup Install -type pane -title {Setup Complete} -component SetupComplete -active Yes -parent StandardInstall -InstallComponent 10D62EB5-B108-461C-91D4-1D18A9CB5B08 -setup Install -type action -conditions {8112E00E-C24D-458F-9C19-03E63937E908 29B86DFA-93EA-4584-A9CF-DE823F4787F2} -title {Start Windows Service} -component StartWindowsService -active Yes -parent 1F7BE720-7885-4150-9550-F25FB1C69423 -Condition 8112E00E-C24D-458F-9C19-03E63937E908 -active Yes -parent 10D62EB5-B108-461C-91D4-1D18A9CB5B08 -title {Ask Yes or No} -component AskYesOrNo -TreeObject::id 8112E00E-C24D-458F-9C19-03E63937E908 -Condition 29B86DFA-93EA-4584-A9CF-DE823F4787F2 -active Yes -parent 10D62EB5-B108-461C-91D4-1D18A9CB5B08 -title {String Is Condition} -component StringIsCondition -TreeObject::id 29B86DFA-93EA-4584-A9CF-DE823F4787F2 -InstallComponent 60CAEDF4-53E9-46C5-9A0F-5873E12F2328 -setup Install -type action -conditions {D8C1E7BD-813A-43ED-95A4-4F5DA45D5886 3AEDBF26-DF24-4328-B5AE-E93AA5F0617B} -title {View Readme Checkbutton} -component AddWidget -active Yes -parent 1F7BE720-7885-4150-9550-F25FB1C69423 -Condition D8C1E7BD-813A-43ED-95A4-4F5DA45D5886 -active Yes -parent 60CAEDF4-53E9-46C5-9A0F-5873E12F2328 -title {File Exists Condition} -component FileExistsCondition -TreeObject::id D8C1E7BD-813A-43ED-95A4-4F5DA45D5886 -Condition 3AEDBF26-DF24-4328-B5AE-E93AA5F0617B -active Yes -parent 60CAEDF4-53E9-46C5-9A0F-5873E12F2328 -title {String Is Condition} -component StringIsCondition -TreeObject::id 3AEDBF26-DF24-4328-B5AE-E93AA5F0617B -InstallComponent 6059F771-3AA1-491C-8B84-788812912E73 -setup Install -type pane -title {Copying Files} -component CopyFiles -active Yes -parent DefaultInstall -InstallComponent 63A986C1-609D-430F-8119-EBEDFC8315EF -setup Install -type action -title {Disable Buttons} -component ModifyWidget -active Yes -parent 6059F771-3AA1-491C-8B84-788812912E73 -InstallComponent D05D0C20-4972-455A-885D-69F24E9AF177 -setup Install -type action -title {Execute Action} -component ExecuteAction -active Yes -parent 6059F771-3AA1-491C-8B84-788812912E73 -InstallComponent 13C83B15-ECEF-9C00-F46C-6E799ABF2157 -setup Install -type action -title {Replace Text In File} -component ReplaceTextInFile -active Yes -parent 6059F771-3AA1-491C-8B84-788812912E73 -InstallComponent 66412B02-0460-4B2B-9D89-57A6BBF1328D -setup Install -type action -title {Move Forward} -component MoveForward -active Yes -parent 6059F771-3AA1-491C-8B84-788812912E73 -InstallComponent 6B06C7C2-97A8-4642-B286-3B089943F359 -setup Install -type pane -title {Setup Complete} -component SetupComplete -active Yes -parent DefaultInstall -InstallComponent D945ADEC-CFCF-87DD-B8EC-480E6A87F4AF -setup Install -type action -title {Install Everything} -component ExecuteAction -active Yes -parent ConsoleInstall -InstallComponent 4F41161A-813F-4BE4-F776-3ED4F26B0CF3 -setup Install -type action -title {Replace Text In File} -component ReplaceTextInFile -active Yes -parent ConsoleInstall -InstallComponent B5904821-3970-1701-002C-0318B8BECA06 -setup Install -type action -title {Console Message} -component ConsoleMessage -active Yes -parent ConsoleInstall -InstallComponent 613FA629-E245-7370-9591-3648E0F25E00 -setup Install -type action -title {Start Windows Service} -component StartWindowsService -active Yes -parent ConsoleInstall -InstallComponent 4D9FB66C-1A02-271A-B6C3-7C88498D1A57 -setup Install -type action -title Exit -component Exit -active Yes -parent ConsoleInstall -InstallComponent 811B66F7-9751-FF4C-8189-5AB5F50E19FC -setup Install -type action -title {Install Everything} -component ExecuteAction -active Yes -parent SilentInstall -InstallComponent A2D703B9-395E-59F4-B03C-1655F2690FB7 -setup Install -type action -title {Replace Text In File} -component ReplaceTextInFile -active Yes -parent SilentInstall -InstallComponent 6EF6AADF-D373-CE5A-2D2C-26FB5BA9154D -setup Install -type action -title {Start Windows Service} -component StartWindowsService -active Yes -parent SilentInstall -InstallComponent 466DC16E-3453-409B-999C-CCDF853AA03D -setup Install -type action -title Exit -component Exit -active Yes -parent SilentInstall -InstallComponent D567240B-2A30-47FD-97AA-3EDA09B64E9F -setup Install -type actiongroup -title {Setup Actions} -active Yes -parent ActionGroupsInstall -InstallComponent 61B40FBC-EADB-4F4C-A49F-81B35B3774BB -setup Install -type actiongroup -title {Startup Actions} -active Yes -parent ActionGroupsInstall -InstallComponent 65546717-3D31-4931-B445-220199767639 -setup Install -type action -title {Create Install Panes} -component CreateInstallPanes -active Yes -parent 61B40FBC-EADB-4F4C-A49F-81B35B3774BB -InstallComponent 9C96DF15-FD21-468D-9996-76D96466D335 -setup Install -type actiongroup -title {Install Actions} -active Yes -parent ActionGroupsInstall -InstallComponent 7FB76BFF-92E4-4210-9CFA-D6CDDB7C2288 -setup Install -type action -title {Install Selected Files} -component InstallSelectedFiles -active Yes -parent 9C96DF15-FD21-468D-9996-76D96466D335 -InstallComponent F0BC8450-668B-41B2-A442-F1BE095D1BFB -setup Install -type action -title {Install Uninstaller} -component InstallUninstaller -active Yes -parent 9C96DF15-FD21-468D-9996-76D96466D335 -InstallComponent B26D8DB4-B899-384A-DA80-782EDCBC98D6 -setup Install -type action -title {Create Folder} -component CreateFolder -active Yes -parent 9C96DF15-FD21-468D-9996-76D96466D335 -InstallComponent BC8CE18E-2121-7ECF-9CA3-FE3E7FC329A1 -setup Install -type action -title {Add Directory To Path} -component AddDirectoryToPath -active Yes -parent 9C96DF15-FD21-468D-9996-76D96466D335 -InstallComponent CAA5BD76-A403-3277-17F9-2E88C8EC540E -setup Install -type action -title {Execute External Program} -component ExecuteExternalProgram -active Yes -parent 9C96DF15-FD21-468D-9996-76D96466D335 -InstallComponent 697B7934-4664-A4A2-1467-26B285C39ABC -setup Install -type action -title {Install Program Folder Shortcut} -component InstallProgramFolderShortcut -active Yes -parent 9C96DF15-FD21-468D-9996-76D96466D335 -InstallComponent EC33B744-E0BD-BCCA-7695-F6D12FBE74E6 -setup Install -type action -title {Install Program Folder Shortcut} -component InstallProgramFolderShortcut -active Yes -parent 9C96DF15-FD21-468D-9996-76D96466D335 -InstallComponent 81001CE5-6E0D-FAC5-A8BE-D7D06ADA70B2 -setup Install -type action -title {Install Program Folder Shortcut} -component InstallProgramFolderShortcut -active Yes -parent 9C96DF15-FD21-468D-9996-76D96466D335 -InstallComponent 2C6197E2-968E-F2D8-7805-E67A43EC5BB5 -setup Install -type action -title {Install Program Folder Shortcut} -component InstallProgramFolderShortcut -active Yes -parent 9C96DF15-FD21-468D-9996-76D96466D335 -InstallComponent 06959B7F-380D-DEF6-431A-1894BF9A367C -setup Install -type action -title {Install Program Folder Shortcut} -component InstallProgramFolderShortcut -active Yes -parent 9C96DF15-FD21-468D-9996-76D96466D335 -InstallComponent EC0536AE-91F2-712A-DDBD-E6DF378335EA -setup Install -type action -title {Execute External Program} -component ExecuteExternalProgram -active Yes -parent 9C96DF15-FD21-468D-9996-76D96466D335 -InstallComponent 75B1D869-C9BA-42C4-9C07-E1D156DA80A8 -setup Install -type action -title {Windows Uninstall Registry} -component AddWindowsUninstallEntry -active Yes -parent 9C96DF15-FD21-468D-9996-76D96466D335 -InstallComponent A4155ACD-0377-4A2C-B952-2C19BF592347 -setup Install -type action -title {Uninstall Shortcut} -component InstallProgramFolderShortcut -active Yes -parent 9C96DF15-FD21-468D-9996-76D96466D335 -InstallComponent 18774B81-6D13-4BD2-B6F2-852BF95814BD -setup Install -type actiongroup -title {Finish Actions} -active Yes -parent ActionGroupsInstall -InstallComponent 5EA75DE2-F9E1-405D-800E-B28FB96CDC61 -setup Install -type action -conditions {EDB4771C-ED91-462E-84D9-66E4AE0A9D9C 5CC9615C-1568-415A-A9BA-8D48DD155F7E 9D5D32C2-9AEC-46C1-98CA-F9A535E6ED82} -title {View Readme Window} -component TextWindow -active Yes -parent 18774B81-6D13-4BD2-B6F2-852BF95814BD -Condition EDB4771C-ED91-462E-84D9-66E4AE0A9D9C -active Yes -parent 5EA75DE2-F9E1-405D-800E-B28FB96CDC61 -title {String Is Condition} -component StringIsCondition -TreeObject::id EDB4771C-ED91-462E-84D9-66E4AE0A9D9C -Condition 5CC9615C-1568-415A-A9BA-8D48DD155F7E -active Yes -parent 5EA75DE2-F9E1-405D-800E-B28FB96CDC61 -title {String Is Condition} -component StringIsCondition -TreeObject::id 5CC9615C-1568-415A-A9BA-8D48DD155F7E -Condition 9D5D32C2-9AEC-46C1-98CA-F9A535E6ED82 -active Yes -parent 5EA75DE2-F9E1-405D-800E-B28FB96CDC61 -title {File Exists Condition} -component FileExistsCondition -TreeObject::id 9D5D32C2-9AEC-46C1-98CA-F9A535E6ED82 -InstallComponent CFF365EA-C5AD-4E16-9D09-E20AADED45ED -setup Install -type actiongroup -title {Cancel Actions} -active Yes -parent ActionGroupsInstall -InstallComponent F037AAD5-E79E-4544-B8C0-AA98CDF5438E -setup Uninstall -type pane -title Uninstall -component Uninstall -active Yes -parent StandardUninstall -InstallComponent 1728FDEB-5E1A-48D4-9FF8-EE993A2C04AC -setup Uninstall -type action -title {Modify Widget} -component ModifyWidget -active Yes -parent F037AAD5-E79E-4544-B8C0-AA98CDF5438E -InstallComponent 60FEFCD5-D31D-4DEA-86D7-E0246ABF0DF5 -setup Uninstall -type action -title {Execute Action} -component ExecuteAction -active Yes -parent F037AAD5-E79E-4544-B8C0-AA98CDF5438E -InstallComponent 6B488B72-9080-4AF7-8690-8D823CCD86AE -setup Uninstall -type action -title {Move Forward} -component MoveForward -active Yes -parent F037AAD5-E79E-4544-B8C0-AA98CDF5438E -InstallComponent 2C06B466-789E-4F18-B711-E8411E2CD80F -setup Uninstall -type pane -conditions 628E6478-81A8-4DF9-A4FE-EACEFAEA2E93 -title {Uninstall Details} -component UninstallDetails -active Yes -parent StandardUninstall -Condition 628E6478-81A8-4DF9-A4FE-EACEFAEA2E93 -active Yes -parent 2C06B466-789E-4F18-B711-E8411E2CD80F -title {String Is Condition} -component StringIsCondition -TreeObject::id 628E6478-81A8-4DF9-A4FE-EACEFAEA2E93 -InstallComponent C0AAD722-CF3D-4708-A62F-4EE9C92F7B24 -setup Uninstall -type pane -title {Uninstall Complete} -component UninstallComplete -active Yes -parent StandardUninstall -InstallComponent C19EE9A4-6BBE-4631-8013-7B7DCA588367 -setup Uninstall -type action -title {Console Ask Yes Or No} -component ConsoleAskYesOrNo -active Yes -parent ConsoleUninstall -InstallComponent AA0A7460-2E6B-4DB1-A7EF-845A1C7B09CE -setup Uninstall -type action -conditions 96F7BA2D-A593-40DC-89C9-AE7895FD0984 -title Exit -component Exit -active Yes -parent ConsoleUninstall -Condition 96F7BA2D-A593-40DC-89C9-AE7895FD0984 -active Yes -parent AA0A7460-2E6B-4DB1-A7EF-845A1C7B09CE -title {String Is Condition} -component StringIsCondition -TreeObject::id 96F7BA2D-A593-40DC-89C9-AE7895FD0984 -InstallComponent 1D572EE2-DD93-4F13-850E-DE0EEB1DA110 -setup Uninstall -type action -title {Console Message} -component ConsoleMessage -active Yes -parent ConsoleUninstall -InstallComponent A518E166-9DC7-454F-8EFE-CD4461F093FB -setup Uninstall -type action -title {Execute Action} -component ExecuteAction -active Yes -parent ConsoleUninstall -InstallComponent 4E1B9A69-B88E-4DE5-A0E1-08E04C4BE6B3 -setup Uninstall -type action -title {Console Message} -component ConsoleMessage -active Yes -parent ConsoleUninstall -InstallComponent 6ADB9508-5F82-4564-B6AC-1170A76B4CB9 -setup Uninstall -type action -title Exit -component Exit -active Yes -parent ConsoleUninstall -InstallComponent F71872ED-E931-4B96-B4F8-1F65356FE848 -setup Uninstall -type action -title {Execute Action} -component ExecuteAction -active Yes -parent SilentUninstall -InstallComponent CFEEDA4E-6870-4C25-8847-2ABB087DF90D -setup Uninstall -type action -title Exit -component Exit -active Yes -parent SilentUninstall -InstallComponent ED3D7C90-4A56-40EE-A2C5-E845C3A57C12 -setup Uninstall -type actiongroup -title {Setup Actions} -active Yes -parent ActionGroupsUninstall -InstallComponent B923CC3C-CD18-4F8A-9648-51ADE1168D4A -setup Uninstall -type actiongroup -title {Startup Actions} -active Yes -parent ActionGroupsUninstall -InstallComponent 716175FD-DD14-46E4-AC3E-2E6483C6FF7D -setup Uninstall -type action -conditions {103DC6E3-97DC-46AC-81C5-DED8E4E319E7 DAE5A5A9-35B4-44B5-89C0-F25FDD2771FB} -title Exit -component Exit -active Yes -parent B923CC3C-CD18-4F8A-9648-51ADE1168D4A -Condition 103DC6E3-97DC-46AC-81C5-DED8E4E319E7 -active Yes -parent 716175FD-DD14-46E4-AC3E-2E6483C6FF7D -title {String Is Condition} -component StringIsCondition -TreeObject::id 103DC6E3-97DC-46AC-81C5-DED8E4E319E7 -Condition DAE5A5A9-35B4-44B5-89C0-F25FDD2771FB -active Yes -parent 716175FD-DD14-46E4-AC3E-2E6483C6FF7D -title {Ask Yes or No} -component AskYesOrNo -TreeObject::id DAE5A5A9-35B4-44B5-89C0-F25FDD2771FB -InstallComponent 73AB9FDF-9481-4EC3-8B31-C109BAA1086C -setup Uninstall -type actiongroup -title {Uninstall Actions} -active Yes -parent ActionGroupsUninstall -InstallComponent 19131BB8-88ED-C9E4-A5CF-8873BE8F5D09 -setup Uninstall -type action -title {Execute External Program} -component ExecuteExternalProgram -active Yes -parent 73AB9FDF-9481-4EC3-8B31-C109BAA1086C -InstallComponent 3A1294BA-6D93-95C0-D81D-3435E62A69F3 -setup Uninstall -type action -title {Execute External Program} -component ExecuteExternalProgram -active Yes -parent 73AB9FDF-9481-4EC3-8B31-C109BAA1086C -InstallComponent 73C87D6F-ACBB-026B-157C-1CC1FD4C4EEC -setup Uninstall -type action -title {Execute External Program} -component ExecuteExternalProgram -active Yes -parent 73AB9FDF-9481-4EC3-8B31-C109BAA1086C -InstallComponent 0BABDE07-5132-BB2B-CDB4-AED542367076 -setup Uninstall -type action -title {Remove Directory From Path} -component RemoveDirectoryFromPath -active Yes -parent 73AB9FDF-9481-4EC3-8B31-C109BAA1086C -InstallComponent D2829903-F232-F03E-070A-386860F74F4A -setup Uninstall -type action -title {Delete File} -component DeleteFile -active Yes -parent 73AB9FDF-9481-4EC3-8B31-C109BAA1086C -InstallComponent 100C074A-1AB7-6813-12F8-585CF0B5C2D5 -setup Uninstall -type action -title {Uninstall Leftover Files} -component UninstallLeftoverFiles -active Yes -parent 73AB9FDF-9481-4EC3-8B31-C109BAA1086C -InstallComponent ACFFE9C0-C404-4FD9-AD70-8F60E822DE65 -setup Uninstall -type action -title {Uninstall Selected Files} -component UninstallSelectedFiles -active Yes -parent 73AB9FDF-9481-4EC3-8B31-C109BAA1086C -InstallComponent AA00EDED-9979-419F-A32C-DF1480E9EFF0 -setup Uninstall -type actiongroup -title {Finish Actions} -active Yes -parent ActionGroupsUninstall -InstallComponent BC4AB013-F50F-49BF-BF98-FF7EBE16BCA4 -setup Uninstall -type actiongroup -title {Cancel Actions} -active Yes -parent ActionGroupsUninstall - -array set Properties { -0464C461-3BD5-93CE-C3BA-C59CA84AD70D,Conditions -{0 conditions} - -0464C461-3BD5-93CE-C3BA-C59CA84AD70D,Height -{20} - -0464C461-3BD5-93CE-C3BA-C59CA84AD70D,LabelSide -{left} - -0464C461-3BD5-93CE-C3BA-C59CA84AD70D,LabelWidth -{28} - -0464C461-3BD5-93CE-C3BA-C59CA84AD70D,Text,subst -{1} - -0464C461-3BD5-93CE-C3BA-C59CA84AD70D,Type -{entry} - -0464C461-3BD5-93CE-C3BA-C59CA84AD70D,Value -{Servers} - -0464C461-3BD5-93CE-C3BA-C59CA84AD70D,VirtualText -{AgentGroup} - -0464C461-3BD5-93CE-C3BA-C59CA84AD70D,Width -{420} - -0464C461-3BD5-93CE-C3BA-C59CA84AD70D,X -{20} - -0464C461-3BD5-93CE-C3BA-C59CA84AD70D,Y -{190} - -06959B7F-380D-DEF6-431A-1894BF9A367C,Conditions -{0 conditions} - -06959B7F-380D-DEF6-431A-1894BF9A367C,ShortcutName -{<%PandoraLicense%>} - -06959B7F-380D-DEF6-431A-1894BF9A367C,TargetFileName -{<%ProgramLicense%>} - -06959B7F-380D-DEF6-431A-1894BF9A367C,WorkingDirectory -{<%InstallDir%>} - -0BABDE07-5132-BB2B-CDB4-AED542367076,Conditions -{0 conditions} - -0BABDE07-5132-BB2B-CDB4-AED542367076,Directory -{<%InstallDir%>\util} - -0BABDE07-5132-BB2B-CDB4-AED542367076,Level -{system} - -0C4A17DA-7867-40CC-81B4-0D1F170581AC,Conditions -{0 conditions} - -0C4A17DA-7867-40CC-81B4-0D1F170581AC,ExecuteAction -{Before Next Pane is Displayed} - -0C4A17DA-7867-40CC-81B4-0D1F170581AC,Files -{pandora_agent.conf} - -0C4A17DA-7867-40CC-81B4-0D1F170581AC,StringMap -{$ServerIP$ <%ServerIP%> - $ServerPath$ /var/spool/pandora/data_in - $AgentTemp$ <%InstallDir%>\\temp} - -0F1370DF-FF15-4CE7-ADF6-CA74BC642334,CheckCondition -{Before Action is Executed} - -0F1370DF-FF15-4CE7-ADF6-CA74BC642334,Operator -{false} - -0F1370DF-FF15-4CE7-ADF6-CA74BC642334,String -{<%LicenseAccepted%>} - -100C074A-1AB7-6813-12F8-585CF0B5C2D5,Conditions -{0 conditions} - -103DC6E3-97DC-46AC-81C5-DED8E4E319E7,CheckCondition -{Before Action is Executed} - -103DC6E3-97DC-46AC-81C5-DED8E4E319E7,String -{<%GuiMode%>} - -10D62EB5-B108-461C-91D4-1D18A9CB5B08,Conditions -{2 conditions} - -10D62EB5-B108-461C-91D4-1D18A9CB5B08,ServiceName -{pandoraFMSagent} - -13C83B15-ECEF-9C00-F46C-6E799ABF2157,Conditions -{0 conditions} - -13C83B15-ECEF-9C00-F46C-6E799ABF2157,ExecuteAction -{Before Next Pane is Displayed} - -13C83B15-ECEF-9C00-F46C-6E799ABF2157,Files -{pandora_agent.conf} - -13C83B15-ECEF-9C00-F46C-6E799ABF2157,StringMap -{$ServerIP$ localhost - $ServerPath$ /var/spool/pandora/data_in - $AgentTemp$ <%InstallDir%>\\temp} - -1728FDEB-5E1A-48D4-9FF8-EE993A2C04AC,Conditions -{0 conditions} - -1728FDEB-5E1A-48D4-9FF8-EE993A2C04AC,State -{disabled} - -1728FDEB-5E1A-48D4-9FF8-EE993A2C04AC,Widget -{NextButton; CancelButton} - -18774B81-6D13-4BD2-B6F2-852BF95814BD,Alias -{Finish Actions} - -18774B81-6D13-4BD2-B6F2-852BF95814BD,Conditions -{0 conditions} - -19131BB8-88ED-C9E4-A5CF-8873BE8F5D09,Conditions -{0 conditions} - -19131BB8-88ED-C9E4-A5CF-8873BE8F5D09,ConsoleTitle -{<%AppName%> Deleting Pandora FMS Agent AT job} - -19131BB8-88ED-C9E4-A5CF-8873BE8F5D09,ProgramCommandLine -{delete_at_job.bat} - -19131BB8-88ED-C9E4-A5CF-8873BE8F5D09,WorkingDirectory -{<%InstallDir%>/scripts} - -1957048E-B498-4FFF-A8BA-F2DF640463B1,BackButton,subst -{1} - -1957048E-B498-4FFF-A8BA-F2DF640463B1,CancelButton,subst -{1} - -1957048E-B498-4FFF-A8BA-F2DF640463B1,Caption,subst -{1} - -1957048E-B498-4FFF-A8BA-F2DF640463B1,Conditions -{0 conditions} - -1957048E-B498-4FFF-A8BA-F2DF640463B1,Message,subst -{1} - -1957048E-B498-4FFF-A8BA-F2DF640463B1,NextButton,subst -{1} - -1D572EE2-DD93-4F13-850E-DE0EEB1DA110,Conditions -{0 conditions} - -1D572EE2-DD93-4F13-850E-DE0EEB1DA110,Message,subst -{1} - -1F7BE720-7885-4150-9550-F25FB1C69423,BackButton,subst -{0} - -1F7BE720-7885-4150-9550-F25FB1C69423,Buttons -{Next} - -1F7BE720-7885-4150-9550-F25FB1C69423,CancelButton,subst -{0} - -1F7BE720-7885-4150-9550-F25FB1C69423,Caption,subst -{1} - -1F7BE720-7885-4150-9550-F25FB1C69423,Conditions -{0 conditions} - -1F7BE720-7885-4150-9550-F25FB1C69423,Message,subst -{1} - -1F7BE720-7885-4150-9550-F25FB1C69423,NextButton,subst -{1} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Active -{Yes} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,BackButton,subst -{1} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Buttons -{Next} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,CancelButton,subst -{1} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Caption,subst -{1} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Conditions -{0 conditions} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Message,subst -{1} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,NextButton,subst -{1} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Subtitle,subst -{0} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Title,subst -{1} - -268B55D8-DE61-421A-AB68-A5D4821D981F,BackButton,subst -{1} - -268B55D8-DE61-421A-AB68-A5D4821D981F,Buttons -{Cancel} - -268B55D8-DE61-421A-AB68-A5D4821D981F,CancelButton,subst -{1} - -268B55D8-DE61-421A-AB68-A5D4821D981F,Caption,subst -{1} - -268B55D8-DE61-421A-AB68-A5D4821D981F,Conditions -{0 conditions} - -268B55D8-DE61-421A-AB68-A5D4821D981F,FileLabel,subst -{1} - -268B55D8-DE61-421A-AB68-A5D4821D981F,Message,subst -{1} - -268B55D8-DE61-421A-AB68-A5D4821D981F,NextButton,subst -{1} - -268B55D8-DE61-421A-AB68-A5D4821D981F,ProgressValue,subst -{1} - -268B55D8-DE61-421A-AB68-A5D4821D981F,Subtitle,subst -{1} - -268B55D8-DE61-421A-AB68-A5D4821D981F,Title,subst -{1} - -29B86DFA-93EA-4584-A9CF-DE823F4787F2,CheckCondition -{Before Action is Executed} - -29B86DFA-93EA-4584-A9CF-DE823F4787F2,FailureMessage -{Error starting Pandora FMS service} - -29B86DFA-93EA-4584-A9CF-DE823F4787F2,String -{<%Answer%>} - -2C06B466-789E-4F18-B711-E8411E2CD80F,BackButton,subst -{1} - -2C06B466-789E-4F18-B711-E8411E2CD80F,CancelButton,subst -{1} - -2C06B466-789E-4F18-B711-E8411E2CD80F,Caption,subst -{1} - -2C06B466-789E-4F18-B711-E8411E2CD80F,Conditions -{1 condition} - -2C06B466-789E-4F18-B711-E8411E2CD80F,Message,subst -{1} - -2C06B466-789E-4F18-B711-E8411E2CD80F,NextButton,subst -{1} - -2C06B466-789E-4F18-B711-E8411E2CD80F,Subtitle,subst -{1} - -2C06B466-789E-4F18-B711-E8411E2CD80F,Text,subst -{1} - -2C06B466-789E-4F18-B711-E8411E2CD80F,Title,subst -{1} - -2C6197E2-968E-F2D8-7805-E67A43EC5BB5,Conditions -{0 conditions} - -2C6197E2-968E-F2D8-7805-E67A43EC5BB5,ShortcutName -{<%EditConfiguration%>} - -2C6197E2-968E-F2D8-7805-E67A43EC5BB5,TargetFileName -{<%InstallDir%>\pandora_agent.conf} - -2C6197E2-968E-F2D8-7805-E67A43EC5BB5,WorkingDirectory -{<%InstallDir%>} - -2D8098DC-CDEA-32BE-83A6-A5AF95CC583E,Conditions -{0 conditions} - -2D8098DC-CDEA-32BE-83A6-A5AF95CC583E,ExecuteAction -{Before Next Pane is Displayed} - -2D8098DC-CDEA-32BE-83A6-A5AF95CC583E,Files -{pandora_agent.conf} - -2D8098DC-CDEA-32BE-83A6-A5AF95CC583E,StringMap -{$AgentGroup$ <%AgentGroup%>} - -354871D2-65BD-4414-BB04-F466798FA027,CheckCondition -{Before Action is Executed} - -354871D2-65BD-4414-BB04-F466798FA027,String -{<%Property <%CurrentPane%> UserMustAcceptLicense%>} - -3A1294BA-6D93-95C0-D81D-3435E62A69F3,Conditions -{0 conditions} - -3A1294BA-6D93-95C0-D81D-3435E62A69F3,ConsoleTitle -{<%AppName%> Stopping Pandora FMS agent} - -3A1294BA-6D93-95C0-D81D-3435E62A69F3,ProgramCommandLine -{stop_pandora_agent.bat} - -3A1294BA-6D93-95C0-D81D-3435E62A69F3,WorkingDirectory -{<%InstallDir%>/scripts} - -3AEDBF26-DF24-4328-B5AE-E93AA5F0617B,CheckCondition -{Before Action is Executed} - -3AEDBF26-DF24-4328-B5AE-E93AA5F0617B,Operator -{false} - -3AEDBF26-DF24-4328-B5AE-E93AA5F0617B,String -{<%InstallStopped%>} - -466DC16E-3453-409B-999C-CCDF853AA03D,Conditions -{0 conditions} - -466DC16E-3453-409B-999C-CCDF853AA03D,ExitType -{Finish} - -4D9FB66C-1A02-271A-B6C3-7C88498D1A57,Conditions -{0 conditions} - -4D9FB66C-1A02-271A-B6C3-7C88498D1A57,ExitType -{Finish} - -4E1B9A69-B88E-4DE5-A0E1-08E04C4BE6B3,Conditions -{0 conditions} - -4E1B9A69-B88E-4DE5-A0E1-08E04C4BE6B3,Message,subst -{1} - -4F41161A-813F-4BE4-F776-3ED4F26B0CF3,Conditions -{0 conditions} - -4F41161A-813F-4BE4-F776-3ED4F26B0CF3,ExecuteAction -{Before Next Pane is Displayed} - -4F41161A-813F-4BE4-F776-3ED4F26B0CF3,Files -{pandora_agent.conf} - -4F41161A-813F-4BE4-F776-3ED4F26B0CF3,StringMap -{$ServerIP$ localhost - $ServerPath$ /var/spool/pandora/data_in - $AgentTemp$ <%InstallDir%>\\temp} - -57BABE6F-717F-4D6A-8A66-921B404862F5,Conditions -{0 conditions} - -57BABE6F-717F-4D6A-8A66-921B404862F5,State -{disabled} - -57BABE6F-717F-4D6A-8A66-921B404862F5,Widget -{Back Button;Next Button} - -5CC9615C-1568-415A-A9BA-8D48DD155F7E,CheckCondition -{Before Action is Executed} - -5CC9615C-1568-415A-A9BA-8D48DD155F7E,String -{<%ViewReadme%>} - -5EA75DE2-F9E1-405D-800E-B28FB96CDC61,Caption,subst -{1} - -5EA75DE2-F9E1-405D-800E-B28FB96CDC61,CloseButton,subst -{1} - -5EA75DE2-F9E1-405D-800E-B28FB96CDC61,Conditions -{3 conditions} - -5EA75DE2-F9E1-405D-800E-B28FB96CDC61,Message,subst -{1} - -5EA75DE2-F9E1-405D-800E-B28FB96CDC61,TextFile -{<%ProgramReadme%>} - -5EA75DE2-F9E1-405D-800E-B28FB96CDC61,Title,subst -{1} - -6059F771-3AA1-491C-8B84-788812912E73,BackButton,subst -{1} - -6059F771-3AA1-491C-8B84-788812912E73,CancelButton,subst -{1} - -6059F771-3AA1-491C-8B84-788812912E73,Caption,subst -{1} - -6059F771-3AA1-491C-8B84-788812912E73,Conditions -{0 conditions} - -6059F771-3AA1-491C-8B84-788812912E73,FileLabel,subst -{1} - -6059F771-3AA1-491C-8B84-788812912E73,Message,subst -{1} - -6059F771-3AA1-491C-8B84-788812912E73,NextButton,subst -{1} - -6059F771-3AA1-491C-8B84-788812912E73,ProgressValue,subst -{1} - -6059F771-3AA1-491C-8B84-788812912E73,Subtitle,subst -{1} - -6059F771-3AA1-491C-8B84-788812912E73,Title,subst -{1} - -60CAEDF4-53E9-46C5-9A0F-5873E12F2328,Background -{white} - -60CAEDF4-53E9-46C5-9A0F-5873E12F2328,Checked -{Yes} - -60CAEDF4-53E9-46C5-9A0F-5873E12F2328,Conditions -{2 conditions} - -60CAEDF4-53E9-46C5-9A0F-5873E12F2328,Text,subst -{1} - -60CAEDF4-53E9-46C5-9A0F-5873E12F2328,Type -{checkbutton} - -60CAEDF4-53E9-46C5-9A0F-5873E12F2328,VirtualText -{ViewReadme} - -60CAEDF4-53E9-46C5-9A0F-5873E12F2328,X -{185} - -60CAEDF4-53E9-46C5-9A0F-5873E12F2328,Y -{250} - -60FEFCD5-D31D-4DEA-86D7-E0246ABF0DF5,Action -{Uninstall Actions} - -60FEFCD5-D31D-4DEA-86D7-E0246ABF0DF5,Conditions -{0 conditions} - -613FA629-E245-7370-9591-3648E0F25E00,Conditions -{0 conditions} - -613FA629-E245-7370-9591-3648E0F25E00,ServiceName -{pandoraFMSagent} - -61B40FBC-EADB-4F4C-A49F-81B35B3774BB,Alias -{Startup Actions} - -61B40FBC-EADB-4F4C-A49F-81B35B3774BB,Conditions -{0 conditions} - -628E6478-81A8-4DF9-A4FE-EACEFAEA2E93,String -{<%ErrorsOccurred%>} - -63A986C1-609D-430F-8119-EBEDFC8315EF,Conditions -{0 conditions} - -63A986C1-609D-430F-8119-EBEDFC8315EF,State -{disabled} - -63A986C1-609D-430F-8119-EBEDFC8315EF,Widget -{Back Button;Next Button} - -65546717-3D31-4931-B445-220199767639,Conditions -{0 conditions} - -66412B02-0460-4B2B-9D89-57A6BBF1328D,Conditions -{0 conditions} - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,Active -{Yes} - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,BackButton,subst -{1} - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,Buttons -{Next} - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,CancelButton,subst -{1} - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,Caption,subst -{1} - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,Conditions -{0 conditions} - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,Message,subst -{1} - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,NextButton,subst -{1} - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,Subtitle,subst -{0} - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,Title,subst -{1} - -697B7934-4664-A4A2-1467-26B285C39ABC,Conditions -{0 conditions} - -697B7934-4664-A4A2-1467-26B285C39ABC,IconPath -{<%InstallDir%>\pandora.ico} - -697B7934-4664-A4A2-1467-26B285C39ABC,ShortcutName -{<%StopPandoraService%>} - -697B7934-4664-A4A2-1467-26B285C39ABC,TargetFileName -{<%InstallDir%>\scripts\stop_pandora_agent.bat} - -697B7934-4664-A4A2-1467-26B285C39ABC,WorkingDirectory -{<%InstallDir%>} - -6ADB9508-5F82-4564-B6AC-1170A76B4CB9,Conditions -{0 conditions} - -6ADB9508-5F82-4564-B6AC-1170A76B4CB9,ExitType -{Finish} - -6B06C7C2-97A8-4642-B286-3B089943F359,BackButton,subst -{1} - -6B06C7C2-97A8-4642-B286-3B089943F359,Buttons -{Next} - -6B06C7C2-97A8-4642-B286-3B089943F359,CancelButton,subst -{1} - -6B06C7C2-97A8-4642-B286-3B089943F359,Caption,subst -{1} - -6B06C7C2-97A8-4642-B286-3B089943F359,Conditions -{0 conditions} - -6B06C7C2-97A8-4642-B286-3B089943F359,Message,subst -{1} - -6B06C7C2-97A8-4642-B286-3B089943F359,NextButton,subst -{1} - -6B488B72-9080-4AF7-8690-8D823CCD86AE,Conditions -{0 conditions} - -6EF6AADF-D373-CE5A-2D2C-26FB5BA9154D,Conditions -{0 conditions} - -6EF6AADF-D373-CE5A-2D2C-26FB5BA9154D,ServiceName -{pandoraFMSagent} - -716175FD-DD14-46E4-AC3E-2E6483C6FF7D,Comment -{Ask the user if they want to proceed with the uninstall.} - -716175FD-DD14-46E4-AC3E-2E6483C6FF7D,Conditions -{2 conditions} - -73AB9FDF-9481-4EC3-8B31-C109BAA1086C,Alias -{Uninstall Actions} - -73AB9FDF-9481-4EC3-8B31-C109BAA1086C,Conditions -{0 conditions} - -73C87D6F-ACBB-026B-157C-1CC1FD4C4EEC,Conditions -{0 conditions} - -73C87D6F-ACBB-026B-157C-1CC1FD4C4EEC,ConsoleTitle -{<%AppName%> Deregistering Pandora FMS Agent service} - -73C87D6F-ACBB-026B-157C-1CC1FD4C4EEC,ProgramCommandLine -{PandoraAgent.exe --uninstall} - -73C87D6F-ACBB-026B-157C-1CC1FD4C4EEC,WorkingDirectory -{<%InstallDir%>} - -75288342-4CEB-473C-B242-450642503F74,Conditions -{0 conditions} - -75288342-4CEB-473C-B242-450642503F74,Height -{20} - -75288342-4CEB-473C-B242-450642503F74,LabelSide -{left} - -75288342-4CEB-473C-B242-450642503F74,LabelWidth -{28} - -75288342-4CEB-473C-B242-450642503F74,Text,subst -{1} - -75288342-4CEB-473C-B242-450642503F74,Type -{entry} - -75288342-4CEB-473C-B242-450642503F74,Value -{myserver.ipaddress.net} - -75288342-4CEB-473C-B242-450642503F74,VirtualText -{ServerIP} - -75288342-4CEB-473C-B242-450642503F74,Width -{420} - -75288342-4CEB-473C-B242-450642503F74,X -{20} - -75288342-4CEB-473C-B242-450642503F74,Y -{190} - -75B1D869-C9BA-42C4-9C07-E1D156DA80A8,Conditions -{0 conditions} - -7FB76BFF-92E4-4210-9CFA-D6CDDB7C2288,Conditions -{0 conditions} - -7FB76BFF-92E4-4210-9CFA-D6CDDB7C2288,UpdateFilePercentage -{Yes} - -7FB76BFF-92E4-4210-9CFA-D6CDDB7C2288,UpdateFileText -{Yes} - -81001CE5-6E0D-FAC5-A8BE-D7D06ADA70B2,Conditions -{0 conditions} - -81001CE5-6E0D-FAC5-A8BE-D7D06ADA70B2,ShortcutName -{<%Readme%>} - -81001CE5-6E0D-FAC5-A8BE-D7D06ADA70B2,TargetFileName -{<%ProgramReadme%>} - -81001CE5-6E0D-FAC5-A8BE-D7D06ADA70B2,WorkingDirectory -{<%InstallDir%>} - -8112E00E-C24D-458F-9C19-03E63937E908,CheckCondition -{Before Action is Executed} - -8112E00E-C24D-458F-9C19-03E63937E908,FailureMessage -{Service not initialized. Try to init Pandora Windows Agent Service manually.} - -8112E00E-C24D-458F-9C19-03E63937E908,Message,subst -{1} - -8112E00E-C24D-458F-9C19-03E63937E908,Title,subst -{1} - -811B66F7-9751-FF4C-8189-5AB5F50E19FC,Action -{Install Actions} - -811B66F7-9751-FF4C-8189-5AB5F50E19FC,Conditions -{0 conditions} - -8A1B144A-F5F6-430F-A334-C31494182599,Conditions -{0 conditions} - -946FC43B-0E32-4C38-86EF-4F9252C67E16,Destination -{<%InstallDir%>} - -946FC43B-0E32-4C38-86EF-4F9252C67E16,FileSize -{15267909} - -946FC43B-0E32-4C38-86EF-4F9252C67E16,Name -{Program Files} - -96F7BA2D-A593-40DC-89C9-AE7895FD0984,CheckCondition -{Before Action is Executed} - -96F7BA2D-A593-40DC-89C9-AE7895FD0984,Operator -{false} - -96F7BA2D-A593-40DC-89C9-AE7895FD0984,String -{<%Answer%>} - -9C96DF15-FD21-468D-9996-76D96466D335,Alias -{Install Actions} - -9C96DF15-FD21-468D-9996-76D96466D335,Conditions -{0 conditions} - -9D5D32C2-9AEC-46C1-98CA-F9A535E6ED82,CheckCondition -{Before Action is Executed} - -9D5D32C2-9AEC-46C1-98CA-F9A535E6ED82,Filename -{<%ProgramReadme%>} - -9F763EAB-21A4-41E7-B51B-EDC4ACF4C5C8,Action -{Install Actions} - -9F763EAB-21A4-41E7-B51B-EDC4ACF4C5C8,Conditions -{0 conditions} - -A2D703B9-395E-59F4-B03C-1655F2690FB7,Conditions -{0 conditions} - -A2D703B9-395E-59F4-B03C-1655F2690FB7,ExecuteAction -{Before Next Pane is Displayed} - -A2D703B9-395E-59F4-B03C-1655F2690FB7,Files -{pandora_agent.conf} - -A2D703B9-395E-59F4-B03C-1655F2690FB7,StringMap -{$ServerIP$ localhost - $ServerPath$ /var/spool/pandora/data_in - $AgentTemp$ <%InstallDir%>\\temp} - -A4155ACD-0377-4A2C-B952-2C19BF592347,Conditions -{0 conditions} - -A4155ACD-0377-4A2C-B952-2C19BF592347,FileName -{<%ShortAppName%>-uninstall} - -A4155ACD-0377-4A2C-B952-2C19BF592347,ShortcutName -{<%UninstallApplicationText%>} - -A4155ACD-0377-4A2C-B952-2C19BF592347,TargetFileName -{<%Uninstaller%>} - -A4155ACD-0377-4A2C-B952-2C19BF592347,WorkingDirectory -{<%InstallDir%>} - -A518E166-9DC7-454F-8EFE-CD4461F093FB,Action -{Uninstall Actions} - -A518E166-9DC7-454F-8EFE-CD4461F093FB,Conditions -{0 conditions} - -A87C1A6B-ED26-4B07-8736-750725FF34E4,Components -{FB96078B-BA3C-498C-8C20-B01C1F28ACA9} - -A87C1A6B-ED26-4B07-8736-750725FF34E4,Description,subst -{1} - -A87C1A6B-ED26-4B07-8736-750725FF34E4,DisplayName,subst -{1} - -A87C1A6B-ED26-4B07-8736-750725FF34E4,Name -{Typical} - -A87C1A6B-ED26-4B07-8736-750725FF34E4,ShowSetupType -{No} - -AA00EDED-9979-419F-A32C-DF1480E9EFF0,Alias -{Finish Actions} - -AA00EDED-9979-419F-A32C-DF1480E9EFF0,Conditions -{0 conditions} - -AA0A7460-2E6B-4DB1-A7EF-845A1C7B09CE,Conditions -{1 condition} - -ACFFE9C0-C404-4FD9-AD70-8F60E822DE65,Conditions -{0 conditions} - -AIX-ppc,Active -{No} - -AIX-ppc,BuildSeparateArchives -{No} - -AIX-ppc,DefaultDirectoryPermission -{0755} - -AIX-ppc,DefaultFilePermission -{0755} - -AIX-ppc,Executable -{<%AppName%>-<%Version%>-<%Platform%>-Install<%Ext%>} - -AIX-ppc,FallBackToConsole -{Yes} - -AIX-ppc,InstallDir -{<%Home%>/<%ShortAppName%>} - -AIX-ppc,InstallMode -{Standard} - -AIX-ppc,InstallType -{Typical} - -AIX-ppc,ProgramExecutable -{} - -AIX-ppc,ProgramFolderAllUsers -{No} - -AIX-ppc,ProgramFolderName -{<%AppName%>} - -AIX-ppc,ProgramLicense -{<%InstallDir%>/installer/LICENSE.txt} - -AIX-ppc,ProgramName -{} - -AIX-ppc,ProgramReadme -{<%InstallDir%>/installer/README.txt} - -AIX-ppc,PromptForRoot -{Yes} - -AIX-ppc,RequireRoot -{No} - -AIX-ppc,RootInstallDir -{/usr/local/<%ShortAppName%>} - -B26D8DB4-B899-384A-DA80-782EDCBC98D6,Conditions -{0 conditions} - -B26D8DB4-B899-384A-DA80-782EDCBC98D6,FolderName -{<%InstallDir%>\temp} - -B2E20690-C57D-4286-9977-F2541E04D71F,BackButton,subst -{1} - -B2E20690-C57D-4286-9977-F2541E04D71F,BrowseButton,subst -{1} - -B2E20690-C57D-4286-9977-F2541E04D71F,BrowseText,subst -{1} - -B2E20690-C57D-4286-9977-F2541E04D71F,Buttons -{Next/Cancel} - -B2E20690-C57D-4286-9977-F2541E04D71F,CancelButton,subst -{1} - -B2E20690-C57D-4286-9977-F2541E04D71F,Caption,subst -{1} - -B2E20690-C57D-4286-9977-F2541E04D71F,Conditions -{2 conditions} - -B2E20690-C57D-4286-9977-F2541E04D71F,Destination,subst -{1} - -B2E20690-C57D-4286-9977-F2541E04D71F,DestinationLabel,subst -{0} - -B2E20690-C57D-4286-9977-F2541E04D71F,Message,subst -{1} - -B2E20690-C57D-4286-9977-F2541E04D71F,NextButton,subst -{1} - -B2E20690-C57D-4286-9977-F2541E04D71F,Subtitle,subst -{1} - -B2E20690-C57D-4286-9977-F2541E04D71F,Title,subst -{1} - -B5904821-3970-1701-002C-0318B8BECA06,Conditions -{0 conditions} - -B5904821-3970-1701-002C-0318B8BECA06,Message,subst -{1} - -B923CC3C-CD18-4F8A-9648-51ADE1168D4A,Alias -{Startup Actions} - -B923CC3C-CD18-4F8A-9648-51ADE1168D4A,Conditions -{0 conditions} - -BC4AB013-F50F-49BF-BF98-FF7EBE16BCA4,Alias -{Cancel Actions} - -BC8CE18E-2121-7ECF-9CA3-FE3E7FC329A1,Conditions -{0 conditions} - -BC8CE18E-2121-7ECF-9CA3-FE3E7FC329A1,Directory -{<%InstallDir%>\util} - -BC8CE18E-2121-7ECF-9CA3-FE3E7FC329A1,Level -{system} - -C0AAD722-CF3D-4708-A62F-4EE9C92F7B24,BackButton,subst -{1} - -C0AAD722-CF3D-4708-A62F-4EE9C92F7B24,CancelButton,subst -{1} - -C0AAD722-CF3D-4708-A62F-4EE9C92F7B24,Caption,subst -{1} - -C0AAD722-CF3D-4708-A62F-4EE9C92F7B24,Conditions -{0 conditions} - -C0AAD722-CF3D-4708-A62F-4EE9C92F7B24,Message,subst -{1} - -C0AAD722-CF3D-4708-A62F-4EE9C92F7B24,NextButton,subst -{1} - -C19EE9A4-6BBE-4631-8013-7B7DCA588367,Conditions -{0 conditions} - -C19EE9A4-6BBE-4631-8013-7B7DCA588367,Default -{Yes} - -C19EE9A4-6BBE-4631-8013-7B7DCA588367,Prompt -{<%UninstallStartupText%>} - -C862BDC0-8F67-4546-B658-4A9A8ADCE385,BackButton,subst -{1} - -C862BDC0-8F67-4546-B658-4A9A8ADCE385,Buttons -{Next/Cancel} - -C862BDC0-8F67-4546-B658-4A9A8ADCE385,CancelButton,subst -{1} - -C862BDC0-8F67-4546-B658-4A9A8ADCE385,Caption,subst -{1} - -C862BDC0-8F67-4546-B658-4A9A8ADCE385,Conditions -{0 conditions} - -C862BDC0-8F67-4546-B658-4A9A8ADCE385,Message,subst -{1} - -C862BDC0-8F67-4546-B658-4A9A8ADCE385,NextButton,subst -{1} - -C862BDC0-8F67-4546-B658-4A9A8ADCE385,Subtitle,subst -{1} - -C862BDC0-8F67-4546-B658-4A9A8ADCE385,Text,subst -{1} - -C862BDC0-8F67-4546-B658-4A9A8ADCE385,Title,subst -{1} - -CAA5BD76-A403-3277-17F9-2E88C8EC540E,Conditions -{0 conditions} - -CAA5BD76-A403-3277-17F9-2E88C8EC540E,ConsoleTitle -{<%AppName%> Installing Pandora FMS Agent as windows service} - -CAA5BD76-A403-3277-17F9-2E88C8EC540E,ProgramCommandLine -{PandoraAgent.exe --install} - -CAA5BD76-A403-3277-17F9-2E88C8EC540E,WorkingDirectory -{<%InstallDir%>} - -CFEEDA4E-6870-4C25-8847-2ABB087DF90D,ExitType -{Finish} - -CFF365EA-C5AD-4E16-9D09-E20AADED45ED,Alias -{Cancel Actions} - -D05D0C20-4972-455A-885D-69F24E9AF177,Action -{Install Actions} - -D05D0C20-4972-455A-885D-69F24E9AF177,Conditions -{0 conditions} - -D2829903-F232-F03E-070A-386860F74F4A,Conditions -{0 conditions} - -D2829903-F232-F03E-070A-386860F74F4A,Files -{<%InstallDir%>\pandora_agent.log} - -D2829903-F232-F03E-070A-386860F74F4A,IgnoreErrors -{Yes} - -D567240B-2A30-47FD-97AA-3EDA09B64E9F,Alias -{Setup Actions} - -D567240B-2A30-47FD-97AA-3EDA09B64E9F,Conditions -{0 conditions} - -D8C1E7BD-813A-43ED-95A4-4F5DA45D5886,CheckCondition -{Before Action is Executed} - -D8C1E7BD-813A-43ED-95A4-4F5DA45D5886,Filename -{<%ProgramReadme%>} - -D945ADEC-CFCF-87DD-B8EC-480E6A87F4AF,Action -{Install Actions} - -D945ADEC-CFCF-87DD-B8EC-480E6A87F4AF,Conditions -{0 conditions} - -DAE5A5A9-35B4-44B5-89C0-F25FDD2771FB,CheckCondition -{Before Action is Executed} - -DAE5A5A9-35B4-44B5-89C0-F25FDD2771FB,Message,subst -{1} - -DAE5A5A9-35B4-44B5-89C0-F25FDD2771FB,Title,subst -{1} - -DAE5A5A9-35B4-44B5-89C0-F25FDD2771FB,TrueValue -{No} - -DE1D4DF7-A35C-4228-8A25-07106AD77C9E,AcceptRadiobutton,subst -{0} - -DE1D4DF7-A35C-4228-8A25-07106AD77C9E,Active -{Yes} - -DE1D4DF7-A35C-4228-8A25-07106AD77C9E,BackButton,subst -{1} - -DE1D4DF7-A35C-4228-8A25-07106AD77C9E,CancelButton,subst -{1} - -DE1D4DF7-A35C-4228-8A25-07106AD77C9E,Caption,subst -{1} - -DE1D4DF7-A35C-4228-8A25-07106AD77C9E,Conditions -{0 conditions} - -DE1D4DF7-A35C-4228-8A25-07106AD77C9E,DeclineRadiobutton,subst -{0} - -DE1D4DF7-A35C-4228-8A25-07106AD77C9E,Message,subst -{1} - -DE1D4DF7-A35C-4228-8A25-07106AD77C9E,NextButton,subst -{1} - -DE1D4DF7-A35C-4228-8A25-07106AD77C9E,Subtitle,subst -{1} - -DE1D4DF7-A35C-4228-8A25-07106AD77C9E,Text,subst -{1} - -DE1D4DF7-A35C-4228-8A25-07106AD77C9E,Title,subst -{1} - -E8952A0A-82A0-4AD0-8FA8-8902870AF848,CheckCondition -{Before Next Pane is Displayed} - -E8952A0A-82A0-4AD0-8FA8-8902870AF848,FailureMessage -{<%DirectoryPermissionText%>} - -E8952A0A-82A0-4AD0-8FA8-8902870AF848,Filename -{<%InstallDir%>} - -E8952A0A-82A0-4AD0-8FA8-8902870AF848,Permission -{can create} - -EAB473BD-3ECC-4FDE-AF62-B80B89DCAE38,Conditions -{2 conditions} - -EAB473BD-3ECC-4FDE-AF62-B80B89DCAE38,State -{disabled} - -EAB473BD-3ECC-4FDE-AF62-B80B89DCAE38,Widget -{NextButton} - -EC0536AE-91F2-712A-DDBD-E6DF378335EA,Conditions -{0 conditions} - -EC0536AE-91F2-712A-DDBD-E6DF378335EA,IgnoreErrors -{Yes} - -EC0536AE-91F2-712A-DDBD-E6DF378335EA,ProgramCommandLine -{install_service_restart.bat} - -EC0536AE-91F2-712A-DDBD-E6DF378335EA,WorkingDirectory -{<%InstallDir%>\scripts} - -EC33B744-E0BD-BCCA-7695-F6D12FBE74E6,Conditions -{0 conditions} - -EC33B744-E0BD-BCCA-7695-F6D12FBE74E6,IconPath -{<%InstallDir%>\pandora.ico} - -EC33B744-E0BD-BCCA-7695-F6D12FBE74E6,ShortcutName -{<%StartPandoraService%>} - -EC33B744-E0BD-BCCA-7695-F6D12FBE74E6,TargetFileName -{<%InstallDir%>\scripts\start_pandora_agent.bat} - -EC33B744-E0BD-BCCA-7695-F6D12FBE74E6,WorkingDirectory -{<%InstallDir%>} - -ED3D7C90-4A56-40EE-A2C5-E845C3A57C12,Alias -{Setup Actions} - -ED3D7C90-4A56-40EE-A2C5-E845C3A57C12,Conditions -{0 conditions} - -EDB4771C-ED91-462E-84D9-66E4AE0A9D9C,CheckCondition -{Before Action is Executed} - -EDB4771C-ED91-462E-84D9-66E4AE0A9D9C,String -{<%GuiMode%>} - -F037AAD5-E79E-4544-B8C0-AA98CDF5438E,BackButton,subst -{1} - -F037AAD5-E79E-4544-B8C0-AA98CDF5438E,CancelButton,subst -{1} - -F037AAD5-E79E-4544-B8C0-AA98CDF5438E,Caption,subst -{1} - -F037AAD5-E79E-4544-B8C0-AA98CDF5438E,Conditions -{0 conditions} - -F037AAD5-E79E-4544-B8C0-AA98CDF5438E,FileValue,subst -{1} - -F037AAD5-E79E-4544-B8C0-AA98CDF5438E,Message,subst -{1} - -F037AAD5-E79E-4544-B8C0-AA98CDF5438E,NextButton,subst -{1} - -F037AAD5-E79E-4544-B8C0-AA98CDF5438E,ProgressValue,subst -{1} - -F037AAD5-E79E-4544-B8C0-AA98CDF5438E,Subtitle,subst -{1} - -F037AAD5-E79E-4544-B8C0-AA98CDF5438E,Title,subst -{1} - -F0BC8450-668B-41B2-A442-F1BE095D1BFB,Conditions -{0 conditions} - -F6A6DB43-C89D-4A19-98D3-1E24284260AE,Comment -{Do not display this pane if this is an upgrade install unless there is more than one installation present} - -F6A6DB43-C89D-4A19-98D3-1E24284260AE,Script -{!<%UpgradeInstall%> || <%PreviousInstallCount%> != 1} - -F71872ED-E931-4B96-B4F8-1F65356FE848,Action -{Uninstall Actions} - -F71872ED-E931-4B96-B4F8-1F65356FE848,Conditions -{0 conditions} - -FB96078B-BA3C-498C-8C20-B01C1F28ACA9,Description,subst -{1} - -FB96078B-BA3C-498C-8C20-B01C1F28ACA9,DisplayName,subst -{1} - -FB96078B-BA3C-498C-8C20-B01C1F28ACA9,FileGroups -{946FC43B-0E32-4C38-86EF-4F9252C67E16} - -FB96078B-BA3C-498C-8C20-B01C1F28ACA9,Name -{Default Component} - -FB96078B-BA3C-498C-8C20-B01C1F28ACA9,RequiredComponent -{Yes} - -FreeBSD-4-x86,Active -{No} - -FreeBSD-4-x86,BuildSeparateArchives -{No} - -FreeBSD-4-x86,DefaultDirectoryPermission -{0755} - -FreeBSD-4-x86,DefaultFilePermission -{0755} - -FreeBSD-4-x86,Executable -{<%AppName%>-<%Version%>-<%Platform%>-Install<%Ext%>} - -FreeBSD-4-x86,FallBackToConsole -{Yes} - -FreeBSD-4-x86,InstallDir -{<%Home%>/<%ShortAppName%>} - -FreeBSD-4-x86,InstallMode -{Standard} - -FreeBSD-4-x86,InstallType -{Typical} - -FreeBSD-4-x86,ProgramExecutable -{} - -FreeBSD-4-x86,ProgramFolderAllUsers -{No} - -FreeBSD-4-x86,ProgramFolderName -{<%AppName%>} - -FreeBSD-4-x86,ProgramLicense -{<%InstallDir%>/LICENSE.txt} - -FreeBSD-4-x86,ProgramName -{} - -FreeBSD-4-x86,ProgramReadme -{<%InstallDir%>/README.txt} - -FreeBSD-4-x86,PromptForRoot -{Yes} - -FreeBSD-4-x86,RequireRoot -{No} - -FreeBSD-4-x86,RootInstallDir -{/usr/local/<%ShortAppName%>} - -FreeBSD-5-x86,Active -{No} - -FreeBSD-5-x86,BuildSeparateArchives -{No} - -FreeBSD-5-x86,DefaultDirectoryPermission -{0755} - -FreeBSD-5-x86,DefaultFilePermission -{0755} - -FreeBSD-5-x86,Executable -{<%AppName%>-<%Version%>-<%Platform%>-Install<%Ext%>} - -FreeBSD-5-x86,FallBackToConsole -{Yes} - -FreeBSD-5-x86,InstallDir -{<%Home%>/<%ShortAppName%>} - -FreeBSD-5-x86,InstallMode -{Standard} - -FreeBSD-5-x86,InstallType -{Typical} - -FreeBSD-5-x86,ProgramExecutable -{} - -FreeBSD-5-x86,ProgramFolderAllUsers -{No} - -FreeBSD-5-x86,ProgramFolderName -{<%AppName%>} - -FreeBSD-5-x86,ProgramLicense -{<%InstallDir%>/LICENSE.txt} - -FreeBSD-5-x86,ProgramName -{} - -FreeBSD-5-x86,ProgramReadme -{<%InstallDir%>/README.txt} - -FreeBSD-5-x86,PromptForRoot -{Yes} - -FreeBSD-5-x86,RequireRoot -{No} - -FreeBSD-5-x86,RootInstallDir -{/usr/local/<%ShortAppName%>} - -FreeBSD-6-x86,Active -{No} - -FreeBSD-6-x86,BuildSeparateArchives -{No} - -FreeBSD-6-x86,DefaultDirectoryPermission -{0755} - -FreeBSD-6-x86,DefaultFilePermission -{0755} - -FreeBSD-6-x86,Executable -{<%AppName%>-<%Version%>-<%Platform%>-Install<%Ext%>} - -FreeBSD-6-x86,FallBackToConsole -{Yes} - -FreeBSD-6-x86,InstallDir -{<%Home%>/<%ShortAppName%>} - -FreeBSD-6-x86,InstallMode -{Standard} - -FreeBSD-6-x86,InstallType -{Typical} - -FreeBSD-6-x86,ProgramExecutable -{} - -FreeBSD-6-x86,ProgramFolderAllUsers -{No} - -FreeBSD-6-x86,ProgramFolderName -{<%AppName%>} - -FreeBSD-6-x86,ProgramLicense -{<%InstallDir%>/LICENSE.txt} - -FreeBSD-6-x86,ProgramName -{} - -FreeBSD-6-x86,ProgramReadme -{<%InstallDir%>/README.txt} - -FreeBSD-6-x86,PromptForRoot -{Yes} - -FreeBSD-6-x86,RequireRoot -{No} - -FreeBSD-6-x86,RootInstallDir -{/usr/local/<%ShortAppName%>} - -FreeBSD-7-x86,Active -{No} - -FreeBSD-7-x86,BuildSeparateArchives -{No} - -FreeBSD-7-x86,DefaultDirectoryPermission -{0755} - -FreeBSD-7-x86,DefaultFilePermission -{0755} - -FreeBSD-7-x86,Executable -{<%AppName%>-<%Version%>-<%Platform%>-Install<%Ext%>} - -FreeBSD-7-x86,FallBackToConsole -{Yes} - -FreeBSD-7-x86,InstallDir -{<%Home%>/<%ShortAppName%>} - -FreeBSD-7-x86,InstallMode -{Standard} - -FreeBSD-7-x86,InstallType -{Typical} - -FreeBSD-7-x86,ProgramExecutable -{} - -FreeBSD-7-x86,ProgramFolderAllUsers -{No} - -FreeBSD-7-x86,ProgramFolderName -{<%AppName%>} - -FreeBSD-7-x86,ProgramLicense -{<%InstallDir%>/LICENSE.txt} - -FreeBSD-7-x86,ProgramName -{} - -FreeBSD-7-x86,ProgramReadme -{<%InstallDir%>/README.txt} - -FreeBSD-7-x86,PromptForRoot -{Yes} - -FreeBSD-7-x86,RequireRoot -{No} - -FreeBSD-7-x86,RootInstallDir -{/usr/local/<%ShortAppName%>} - -HPUX-hppa,Active -{No} - -HPUX-hppa,BuildSeparateArchives -{No} - -HPUX-hppa,DefaultDirectoryPermission -{0755} - -HPUX-hppa,DefaultFilePermission -{0755} - -HPUX-hppa,Executable -{<%AppName%>-<%Version%>-<%Platform%>-Install<%Ext%>} - -HPUX-hppa,FallBackToConsole -{Yes} - -HPUX-hppa,InstallDir -{<%Home%>/<%ShortAppName%>} - -HPUX-hppa,InstallMode -{Standard} - -HPUX-hppa,InstallType -{Typical} - -HPUX-hppa,ProgramExecutable -{} - -HPUX-hppa,ProgramFolderAllUsers -{No} - -HPUX-hppa,ProgramFolderName -{<%AppName%>} - -HPUX-hppa,ProgramLicense -{<%InstallDir%>/LICENSE.txt} - -HPUX-hppa,ProgramName -{} - -HPUX-hppa,ProgramReadme -{<%InstallDir%>/README.txt} - -HPUX-hppa,PromptForRoot -{Yes} - -HPUX-hppa,RequireRoot -{No} - -HPUX-hppa,RootInstallDir -{/usr/local/<%ShortAppName%>} - -Linux-x86,Active -{No} - -Linux-x86,BuildSeparateArchives -{No} - -Linux-x86,DefaultDirectoryPermission -{0755} - -Linux-x86,DefaultFilePermission -{0755} - -Linux-x86,Executable -{<%AppName%>-<%Version%>-<%Platform%>-Install<%Ext%>} - -Linux-x86,FallBackToConsole -{Yes} - -Linux-x86,InstallDir -{<%Home%>/<%ShortAppName%>} - -Linux-x86,InstallMode -{Standard} - -Linux-x86,InstallType -{Typical} - -Linux-x86,ProgramExecutable -{<%InstallDir%>/pandora_agent} - -Linux-x86,ProgramFolderAllUsers -{No} - -Linux-x86,ProgramFolderName -{<%AppName%>} - -Linux-x86,ProgramLicense -{<%InstallDir%>/LICENSE.txt} - -Linux-x86,ProgramName -{} - -Linux-x86,ProgramReadme -{<%InstallDir%>/README.txt} - -Linux-x86,PromptForRoot -{Yes} - -Linux-x86,RequireRoot -{No} - -Linux-x86,RootInstallDir -{/usr/local/<%ShortAppName%>} - -Linux-x86_64,Active -{No} - -Linux-x86_64,BuildSeparateArchives -{No} - -Linux-x86_64,DefaultDirectoryPermission -{0755} - -Linux-x86_64,DefaultFilePermission -{0755} - -Linux-x86_64,Executable -{<%AppName%>-<%Version%>-<%Platform%>-Install<%Ext%>} - -Linux-x86_64,FallBackToConsole -{Yes} - -Linux-x86_64,InstallDir -{<%Home%>/<%ShortAppName%>} - -Linux-x86_64,InstallMode -{Standard} - -Linux-x86_64,InstallType -{Typical} - -Linux-x86_64,ProgramExecutable -{} - -Linux-x86_64,ProgramFolderAllUsers -{No} - -Linux-x86_64,ProgramFolderName -{<%AppName%>} - -Linux-x86_64,ProgramLicense -{<%InstallDir%>/LICENSE.txt} - -Linux-x86_64,ProgramName -{} - -Linux-x86_64,ProgramReadme -{<%InstallDir%>/README.txt} - -Linux-x86_64,PromptForRoot -{Yes} - -Linux-x86_64,RequireRoot -{No} - -Linux-x86_64,RootInstallDir -{/usr/local/<%ShortAppName%>} - -Solaris-sparc,Active -{No} - -Solaris-sparc,BuildSeparateArchives -{No} - -Solaris-sparc,DefaultDirectoryPermission -{0755} - -Solaris-sparc,DefaultFilePermission -{0755} - -Solaris-sparc,Executable -{<%AppName%>-<%Version%>-<%Platform%>-Install<%Ext%>} - -Solaris-sparc,FallBackToConsole -{Yes} - -Solaris-sparc,InstallDir -{<%Home%>/<%ShortAppName%>} - -Solaris-sparc,InstallMode -{Standard} - -Solaris-sparc,InstallType -{Typical} - -Solaris-sparc,ProgramExecutable -{} - -Solaris-sparc,ProgramFolderAllUsers -{No} - -Solaris-sparc,ProgramFolderName -{<%AppName%>} - -Solaris-sparc,ProgramLicense -{<%InstallDir%>/LICENSE.txt} - -Solaris-sparc,ProgramName -{} - -Solaris-sparc,ProgramReadme -{<%InstallDir%>/README.txt} - -Solaris-sparc,PromptForRoot -{Yes} - -Solaris-sparc,RequireRoot -{No} - -Solaris-sparc,RootInstallDir -{/usr/local/<%ShortAppName%>} - -Solaris-x86,Active -{No} - -Solaris-x86,BuildSeparateArchives -{No} - -Solaris-x86,DefaultDirectoryPermission -{0755} - -Solaris-x86,DefaultFilePermission -{0755} - -Solaris-x86,Executable -{<%AppName%>-<%Version%>-<%Platform%>-Install<%Ext%>} - -Solaris-x86,FallBackToConsole -{Yes} - -Solaris-x86,InstallDir -{<%Home%>/<%ShortAppName%>} - -Solaris-x86,InstallMode -{Standard} - -Solaris-x86,InstallType -{Typical} - -Solaris-x86,ProgramExecutable -{} - -Solaris-x86,ProgramFolderAllUsers -{No} - -Solaris-x86,ProgramFolderName -{<%AppName%>} - -Solaris-x86,ProgramLicense -{<%InstallDir%>/LICENSE.txt} - -Solaris-x86,ProgramName -{} - -Solaris-x86,ProgramReadme -{<%InstallDir%>/README.txt} - -Solaris-x86,PromptForRoot -{Yes} - -Solaris-x86,RequireRoot -{No} - -Solaris-x86,RootInstallDir -{/usr/local/<%ShortAppName%>} - -TarArchive,Active -{No} - -TarArchive,BuildSeparateArchives -{No} - -TarArchive,CompressionLevel -{6} - -TarArchive,DefaultDirectoryPermission -{0755} - -TarArchive,DefaultFilePermission -{0755} - -TarArchive,Executable -{<%AppName%>-<%Version%>-<%Platform%>-Install<%Ext%>} - -TarArchive,FallBackToConsole -{Yes} - -TarArchive,InstallDir -{<%Home%>/<%ShortAppName%>} - -TarArchive,InstallMode -{Standard} - -TarArchive,InstallType -{Typical} - -TarArchive,OutputFileName -{<%ShortAppName%>-<%Version%>.tar.gz} - -TarArchive,ProgramExecutable -{} - -TarArchive,ProgramFolderAllUsers -{No} - -TarArchive,ProgramFolderName -{<%AppName%>} - -TarArchive,ProgramLicense -{<%InstallDir%>/LICENSE.txt} - -TarArchive,ProgramName -{} - -TarArchive,ProgramReadme -{<%InstallDir%>/README.txt} - -TarArchive,PromptForRoot -{Yes} - -TarArchive,RequireRoot -{No} - -TarArchive,RootInstallDir -{/usr/local/<%ShortAppName%>} - -TarArchive,VirtualTextMap -{<%InstallDir%> <%ShortAppName%>} - -Windows,Active -{Yes} - -Windows,BuildSeparateArchives -{No} - -Windows,Executable -{<%AppName%>-<%Version%>-Setup<%Ext%>} - -Windows,FileDescription -{<%AppName%> <%Version%> Setup} - -Windows,IncludeTWAPI -{No} - -Windows,InstallDir -{<%PROGRAM_FILES%>/pandora_agent} - -Windows,InstallMode -{Standard} - -Windows,InstallType -{Typical} - -Windows,LastRequireAdministrator -{Yes} - -Windows,ProgramExecutable -{<%InstallDir%>/PandoraAgent.exe} - -Windows,ProgramFolderAllUsers -{No} - -Windows,ProgramFolderName -{<%AppName%>} - -Windows,ProgramLicense -{<%InstallDir%>/LICENSE.txt} - -Windows,ProgramName -{} - -Windows,ProgramReadme -{<%InstallDir%>/README.txt} - -Windows,RequireAdministrator -{Yes} - -Windows,UseUncompressedBinaries -{No} - -Windows,WindowsIcon -{pandora.ico} - -ZipArchive,Active -{No} - -ZipArchive,BuildSeparateArchives -{No} - -ZipArchive,CompressionLevel -{6} - -ZipArchive,DefaultDirectoryPermission -{0755} - -ZipArchive,DefaultFilePermission -{0755} - -ZipArchive,Executable -{<%AppName%>-<%Version%>-<%Platform%>-Install<%Ext%>} - -ZipArchive,FallBackToConsole -{Yes} - -ZipArchive,InstallDir -{<%Home%>/<%ShortAppName%>} - -ZipArchive,InstallMode -{Standard} - -ZipArchive,InstallType -{Typical} - -ZipArchive,OutputFileName -{<%ShortAppName%>-<%Version%>.zip} - -ZipArchive,ProgramExecutable -{} - -ZipArchive,ProgramFolderAllUsers -{No} - -ZipArchive,ProgramFolderName -{<%AppName%>} - -ZipArchive,ProgramLicense -{<%InstallDir%>/LICENSE.txt} - -ZipArchive,ProgramName -{} - -ZipArchive,ProgramReadme -{<%InstallDir%>/README.txt} - -ZipArchive,PromptForRoot -{Yes} - -ZipArchive,RequireRoot -{No} - -ZipArchive,RootInstallDir -{/usr/local/<%ShortAppName%>} - -ZipArchive,VirtualTextMap -{<%InstallDir%> <%ShortAppName%>} - -} - -::msgcat::mcmset ca { -0464C461-3BD5-93CE-C3BA-C59CA84AD70D,Text -{} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,BackButton -{< <%Back%>} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,CancelButton -{<%Cancel%>} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Caption -{Llegenda} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Message -{Missatge} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,NextButton -{<%Next%> >} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Subtitle -{Subtítol} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Title -{Ròtul} - -4DC6C83C-511B-300F-900F-8670A81A7F9C,Message -{} - -4DC6C83C-511B-300F-900F-8670A81A7F9C,Title -{} - -B5904821-3970-1701-002C-0318B8BECA06,Message -{} - -} -::msgcat::mcmset cs { -0464C461-3BD5-93CE-C3BA-C59CA84AD70D,Text -{} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,BackButton -{< <%Back%>} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,CancelButton -{<%Cancel%>} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Caption -{Titulek} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Message -{Zpráva} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,NextButton -{<%Next%> >} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Subtitle -{Podnadpis} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Title -{Nadpis} - -4DC6C83C-511B-300F-900F-8670A81A7F9C,Message -{} - -4DC6C83C-511B-300F-900F-8670A81A7F9C,Title -{} - -B5904821-3970-1701-002C-0318B8BECA06,Message -{} - -} -::msgcat::mcmset de { -0464C461-3BD5-93CE-C3BA-C59CA84AD70D,Text -{Agent group name: } - -1957048E-B498-4FFF-A8BA-F2DF640463B1,Message -{Dies wird <%AppName%> auf Ihrem Computer installieren. - -Es wird empfohlen, das Sie alle anderen Anwendungen schließen, bevor Sie fortfahren. - -Nach der Installierung sollten Sie Konfigurationsdatei editieren, um Server IP Adresse und andere Rahmen zu definieren. - -Klicken Sie auf Weiter um Fortzufahren oder auf Abbrechen, um das Setup zu beenden.} - -1D572EE2-DD93-4F13-850E-DE0EEB1DA110,Message -{<%UninstallingApplicationText%>} - -2073DDB6-50AB-4708-82AD-02A6C3F3EDE1,Message -{<%InstallationCompleteText%>} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,BackButton -{< <%Back%>} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,CancelButton -{<%Cancel%>} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Caption -{This values will be written to the pandora_agent.conf file in the <%ProgramFolderName%> folder. Please change them to your own data.} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Message -{ } - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,NextButton -{<%Next%> >} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Subtitle -{Now it's time to configure your pandora_agent.conf file} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Title -{Pandora FMS Agent for Windows Configuration} - -4DC6C83C-511B-300F-900F-8670A81A7F9C,Message -{} - -4DC6C83C-511B-300F-900F-8670A81A7F9C,Title -{} - -4E1B9A69-B88E-4DE5-A0E1-08E04C4BE6B3,Message -{<%UninstallCompleteText%>} - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,Caption -{This values will be written to the pandora_agent.conf file in the <%ProgramFolderName%> folder. Please change them to your own data.} - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,Message -{ } - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,Subtitle -{Now it's time to configure your pandora_agent.conf file} - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,Title -{Pandora FMS Agent for Windows Configuration} - -75288342-4CEB-473C-B242-450642503F74,Text -{Pandora Server IP Address:} - -B5904821-3970-1701-002C-0318B8BECA06,Message -{} - -BF861387-DA7F-4986-B5BB-F77358B58603,Message -{<%InstallingApplicationText%>} - -EditConfiguration -{Bearbeiten der Konfiguration} - -StartPandoraService -{Startet <%AppName%> Dienst} - -StopPandoraService -{Beendet <%AppName%> Dienst} - -} -::msgcat::mcmset en { -0464C461-3BD5-93CE-C3BA-C59CA84AD70D,Text -{Agent group (Must exists)} - -1957048E-B498-4FFF-A8BA-F2DF640463B1,Message -{This program will install <%AppName%> (build <%Version%>) in your computer. When you finish this installation, probably you will need to edit the agent configuration file to add aditional modules or review main setup parameters. - -Please click on Next button to continue, or Cancel to exit this setup. -} - -1D572EE2-DD93-4F13-850E-DE0EEB1DA110,Message -{<%UninstallingApplicationText%>} - -1F7BE720-7885-4150-9550-F25FB1C69423,Message -{The InstallJammer Wizard has successfully installed <%AppName%>. Click Finish to exit the wizard. - -NOTE: In some Windows systems, it is needed to restart the server after installing a Service and adding new directories to system path. We recommend to restart your server, but this is not always needed.} - -2073DDB6-50AB-4708-82AD-02A6C3F3EDE1,Message -{<%InstallationCompleteText%>} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,BackButton -{< <%Back%>} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,CancelButton -{<%Cancel%>} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Caption -{ - -Enter the group name for this agent. This group must exist in the Pandora FMS server at destination.} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Message -{ } - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,NextButton -{<%Next%> >} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Subtitle -{} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Title -{Pandora FMS Agent for Windows Configuration} - -4DC6C83C-511B-300F-900F-8670A81A7F9C,Message -{Do you want to start Pandora FMS Agent Service?} - -4DC6C83C-511B-300F-900F-8670A81A7F9C,Title -{Pandora FMS Windows Agent Service} - -4E1B9A69-B88E-4DE5-A0E1-08E04C4BE6B3,Message -{<%UninstallCompleteText%>} - -4F66C16F-6FAC-4A36-B0EA-CCA2324B27DF,Message -{<%InstallStartupText%>} - -4F66C16F-6FAC-4A36-B0EA-CCA2324B27DF,Title -{<%InstallApplicationText%>} - -5EA75DE2-F9E1-405D-800E-B28FB96CDC61,Caption -{<%ApplicationReadmeText%>} - -5EA75DE2-F9E1-405D-800E-B28FB96CDC61,Message -{} - -5EA75DE2-F9E1-405D-800E-B28FB96CDC61,Title -{<%ApplicationReadmeText%>} - -6057A263-437C-4EB8-93AB-DBC7055A759F,Description -{<%CustomInstallDescription%>} - -60CAEDF4-53E9-46C5-9A0F-5873E12F2328,Text -{<%ViewReadmeText%>} - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,Caption -{ - -Write here the IP address or FQN address to your Pandora FMS server.} - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,Message -{ } - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,Subtitle -{} - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,Title -{Pandora FMS Agent for Windows Configuration} - -6FD08442-A7BA-4654-9ECE-3883DD747D00,Message -{Do you like to start Pandora FMS Windows Agent Service Now?} - -6FD08442-A7BA-4654-9ECE-3883DD747D00,Title -{Starting Pandora FMS service} - -75288342-4CEB-473C-B242-450642503F74,Text -{Pandora FMS Server address} - -8112E00E-C24D-458F-9C19-03E63937E908,Message -{Do you want to start Pandora FMS Agent Service?} - -8112E00E-C24D-458F-9C19-03E63937E908,Title -{Pandora FMS Windows Agent Service} - -A84F44C7-9ABD-43C6-AA57-CF527E0C82A5,Caption -{Please enter Server IP} - -A84F44C7-9ABD-43C6-AA57-CF527E0C82A5,Subtitle -{Enter the IP of the server you want to connect} - -A84F44C7-9ABD-43C6-AA57-CF527E0C82A5,Title -{Server IP} - -A87C1A6B-ED26-4B07-8736-750725FF34E4,Description -{<%TypicalInstallDescription%>} - -B5904821-3970-1701-002C-0318B8BECA06,Message -{Install finished. Don't forget to edit your pandora_agent.conf for define IP address of your Pandora FMS Server.} - -BF861387-DA7F-4986-B5BB-F77358B58603,Message -{<%InstallingApplicationText%>} - -C862BDC0-8F67-4546-B658-4A9A8ADCE385,Caption -{Setup has enough information to start copying the program files. If you want to review or change any settings, click Back. If you are satisfied with the settings, click Next to begin copying files.} - -DAE5A5A9-35B4-44B5-89C0-F25FDD2771FB,Message -{<%UninstallStartupText%>} - -DAE5A5A9-35B4-44B5-89C0-F25FDD2771FB,Title -{<%UninstallApplicationText%>} - -DE1D4DF7-A35C-4228-8A25-07106AD77C9E,Text -{GNU GENERAL PUBLIC LICENSE - -Version 2, June 1991 - -Copyright (C) 1989, 1991 Free Software Foundation, Inc. -59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - -Everyone is permitted to copy and distribute verbatim copies -of this license document, but changing it is not allowed. - -Preamble - -The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. - -When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. - -To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. - -For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. - -We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. - -Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. - -Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. - -The precise terms and conditions for copying, distribution and modification follow. -TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - -0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. - -1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. - -You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. - -2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. - - c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. - -3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. - -If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. - -4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. - -5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. - -6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. - -7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. - -This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. - -8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. - -9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. - -10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. - -NO WARRANTY - -11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - -12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -END OF TERMS AND CONDITIONS} - -EditConfiguration -{Edit Configuration} - -FB96078B-BA3C-498C-8C20-B01C1F28ACA9,Description -{<%ProgramFilesDescription%>} - -HelpGeneratingSSHKeys -{Help Generating SSH Keys} - -HowTo -{how_to_keys.html} - -PandoraLicense -{Pandora FMS License} - -Readme -{Readme} - -StartPandoraService -{Start <%AppName%> Service} - -StopPandoraService -{Stop <%AppName%> Service} - -} -::msgcat::mcmset es { -0464C461-3BD5-93CE-C3BA-C59CA84AD70D,Text -{Grupo del agente:} - -1957048E-B498-4FFF-A8BA-F2DF640463B1,Message -{Este programa instalará <%AppName%> (build <%Version%>) en su equipo. - -Se recomienda cerrar las demas aplicaciones antes de continuar. - -Al finalizar la instalación, debe editarse el fichero de configuración para definir la dirección IP del servidor y otros parámetros. - -Pulse Siguiente para continuar o Cancelar para salir de la instalación.} - -1D572EE2-DD93-4F13-850E-DE0EEB1DA110,Message -{<%UninstallingApplicationText%>} - -1F7BE720-7885-4150-9550-F25FB1C69423,Caption -{La instalación ha finalizado} - -1F7BE720-7885-4150-9550-F25FB1C69423,Message -{El instalador ha instalado <%AppName%> con éxito. Pulse Finalizar para salir de este instalador. - -NOTA: En algunos sistemas Windows es necesario reiniciar después de instalar un servicio y agregar un nuevo directorio al PATH del sistema. Recomendamos por tanto que reinicie este servidor.} - -2073DDB6-50AB-4708-82AD-02A6C3F3EDE1,Message -{<%InstallationCompleteText%>} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,BackButton -{< <%Back%>} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,CancelButton -{<%Cancel%>} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Caption -{ - - -Introduzca el nombre del grupo para este agente. El nombre del grupo debe existir en el servidor Pandora FMS de destino.} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Message -{ } - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,NextButton -{<%Next%> >} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Subtitle -{Configuración del fichero pandora_agent.conf del agente} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Title -{Configuración del agente de Pandora FMS para Windows} - -4DC6C83C-511B-300F-900F-8670A81A7F9C,Message -{¿Quiere iniciar el servicio del agente de Pandora FMS para Windows?} - -4DC6C83C-511B-300F-900F-8670A81A7F9C,Title -{} - -4E1B9A69-B88E-4DE5-A0E1-08E04C4BE6B3,Message -{<%UninstallCompleteText%>} - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,Caption -{ - -Escriba a continuación la dirección IP o el nombre del servidor de Pandora FMS al que enviará datos este agente.} - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,Message -{ } - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,Subtitle -{} - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,Title -{Configuración del agente de Pandora FMS para Windows} - -6B06C7C2-97A8-4642-B286-3B089943F359,Message -{InstallJammer ha instalado <%AppName%> con éxito. Pulse Finalizar para salir de este instalador.} - -6FD08442-A7BA-4654-9ECE-3883DD747D00,Message -{¿Quiere iniciar ahora el servicio de Pandora FMS Windows Agent?} - -6FD08442-A7BA-4654-9ECE-3883DD747D00,Title -{Inicio del servicio Pandora FMS} - -75288342-4CEB-473C-B242-450642503F74,Text -{Dirección IP del servidor Pandora:} - -8112E00E-C24D-458F-9C19-03E63937E908,Message -{¿Quiere iniciar el servicio del agente de Pandora FMS para Windows?} - -B2E20690-C57D-4286-9977-F2541E04D71F,BrowseText -{Pulse Siguiente para continuar. Si desea seleccionar una carpeta diferente, pulse Examinar.} - -B2E20690-C57D-4286-9977-F2541E04D71F,Caption -{Se instalará <%AppName%> en la siguiente carpeta. - -Para instalar en esa carpeta, pulse Siguiente. Para instalar en una carpeta diferente, pulse Examinar y seleccione otra.} - -B5904821-3970-1701-002C-0318B8BECA06,Message -{} - -BF861387-DA7F-4986-B5BB-F77358B58603,Message -{<%InstallingApplicationText%>} - -C862BDC0-8F67-4546-B658-4A9A8ADCE385,Caption -{Se ha recopilado la información necesaria para comenzar a copiar los archivos del programa. Si desea revisar o cambiar la configuración, pulse Atrás. Si esta conforme con la configuración, pulse Siguiente para comenzar a copiar los archivos.} - -DE1D4DF7-A35C-4228-8A25-07106AD77C9E,Subtitle -{Por favor lea atentamente el siguiente acuerdo de licencia (en inglés).} - -EditConfiguration -{Editar fichero de configuración} - -HelpGeneratingSSHKeys -{Creación de claves SSH} - -HowTo -{how_to_keys_es.html} - -InstallStartupText -{Se va a instalar <%AppName%> en su equipo. ¿Desea continuar?} - -PandoraLicense -{Licencia de Pandora FMS (inglés)} - -Readme -{Léeme (inglés)} - -SeparatorText -{Instalador de Pandora FMS} - -StartPandoraService -{Pandora FMS Service - Iniciar Servicio} - -StopPandoraService -{Pandora FMS Service - Parar Servicio} - -StopPanodoraService -{Pandora FMS Service - Parar Servicio} - -UninstallStartupText -{Se eliminará completamente <%AppName%> de su sistema. ¿Seguro que desea continuar?} - -} -::msgcat::mcmset fr { -0464C461-3BD5-93CE-C3BA-C59CA84AD70D,Text -{Agent group name: } - -1957048E-B498-4FFF-A8BA-F2DF640463B1,Message -{Ceci installera <%AppName%> sur votre ordinateur. - -Il est recommandé de fermer toutes les autres applications avant de continuer. - -Après avoir terminé l'installation, il faut éditer le fichier de configuration pour définir l'adresse IP du serveur ainsi que d'autres paramètres. - -Cliquez sur SUIVANT pour continuer ou ANNULER pour quitter l'installation.} - -1D572EE2-DD93-4F13-850E-DE0EEB1DA110,Message -{<%UninstallingApplicationText%>} - -2073DDB6-50AB-4708-82AD-02A6C3F3EDE1,Message -{<%InstallationCompleteText%>} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,BackButton -{< <%Back%>} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,CancelButton -{<%Cancel%>} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Caption -{This values will be written to the pandora_agent.conf file in the <%ProgramFolderName%> folder. Please change them to your own data.} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Message -{ } - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,NextButton -{<%Next%> >} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Subtitle -{Now it's time to configure your pandora_agent.conf file} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Title -{Pandora FMS Agent for Windows Configuration} - -4DC6C83C-511B-300F-900F-8670A81A7F9C,Message -{} - -4DC6C83C-511B-300F-900F-8670A81A7F9C,Title -{} - -4E1B9A69-B88E-4DE5-A0E1-08E04C4BE6B3,Message -{<%UninstallCompleteText%>} - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,Caption -{This values will be written to the pandora_agent.conf file in the <%ProgramFolderName%> folder. Please change them to your own data.} - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,Message -{ } - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,Subtitle -{Now it's time to configure your pandora_agent.conf file} - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,Title -{Pandora FMS Agent for Windows Configuration} - -75288342-4CEB-473C-B242-450642503F74,Text -{Pandora Server IP Address:} - -B5904821-3970-1701-002C-0318B8BECA06,Message -{} - -BF861387-DA7F-4986-B5BB-F77358B58603,Message -{<%InstallingApplicationText%>} - -EditConfiguration -{Modifier la configuration} - -StartPandoraService -{Démarre le service <%AppName%>} - -StopPandoraService -{Arrête le service <%AppName%>} - -} -::msgcat::mcmset hu { -0464C461-3BD5-93CE-C3BA-C59CA84AD70D,Text -{Pandora Server IP Address:} - -1957048E-B498-4FFF-A8BA-F2DF640463B1,Message -{Ez a <%AppName%> verzióját fogja telepíteni a számítógépére. - - Javasoljuk, hogy zárjon be minden alkalmazást, mielőtt folytatná. - - Kattintson a <%Next%> gombra a folytatáshoz vagy a <%Cancel%> gombra kilépéshez.} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,BackButton -{< <%Back%>} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,CancelButton -{<%Cancel%>} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Caption -{This values will be written to the pandora_agent.conf file in the <%ProgramFolderName%> folder. Please change them to your own data.} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Message -{ } - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,NextButton -{<%Next%> >} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Subtitle -{Now it's time to configure your pandora_agent.conf file} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Title -{Pandora FMS Agent for Windows Configuration} - -4DC6C83C-511B-300F-900F-8670A81A7F9C,Message -{} - -4DC6C83C-511B-300F-900F-8670A81A7F9C,Title -{} - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,Caption -{This values will be written to the pandora_agent.conf file in the <%ProgramFolderName%> folder. Please change them to your own data.} - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,Message -{ } - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,Subtitle -{Now it's time to configure your pandora_agent.conf file} - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,Title -{Pandora FMS Agent for Windows Configuration} - -75288342-4CEB-473C-B242-450642503F74,Text -{Pandora Server IP Address:} - -B5904821-3970-1701-002C-0318B8BECA06,Message -{} - -StartPandoraService -{Start Pandora Service} - -StopPandoraService -{Stop Pandora Service} - -} -::msgcat::mcmset it { -0464C461-3BD5-93CE-C3BA-C59CA84AD70D,Text -{Pandora Server IP Address:} - -1957048E-B498-4FFF-A8BA-F2DF640463B1,Message -{Si sta per installare <%AppName%> sul computer. - -E' consigliata la chiusura di tutte le altre applicazioni prima di proseguire. - -Premere su Avanti per continuare o su Annulla per uscire dall'installazione.} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,BackButton -{< <%Back%>} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,CancelButton -{<%Cancel%>} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Caption -{This values will be written to the pandora_agent.conf file in the <%ProgramFolderName%> folder. Please change them to your own data.} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Message -{ } - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,NextButton -{<%Next%> >} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Subtitle -{Now it's time to configure your pandora_agent.conf file} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Title -{Pandora FMS Agent for Windows Configuration} - -4DC6C83C-511B-300F-900F-8670A81A7F9C,Message -{} - -4DC6C83C-511B-300F-900F-8670A81A7F9C,Title -{} - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,Caption -{This values will be written to the pandora_agent.conf file in the <%ProgramFolderName%> folder. Please change them to your own data.} - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,Message -{ } - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,Subtitle -{Now it's time to configure your pandora_agent.conf file} - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,Title -{Pandora FMS Agent for Windows Configuration} - -75288342-4CEB-473C-B242-450642503F74,Text -{Pandora Server IP Address:} - -B5904821-3970-1701-002C-0318B8BECA06,Message -{} - -StartPandoraService -{Start Pandora Service} - -StopPandoraService -{Stop Pandora Service} - -} -::msgcat::mcmset lt { -0464C461-3BD5-93CE-C3BA-C59CA84AD70D,Text -{} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,BackButton -{< <%Back%>} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,CancelButton -{<%Cancel%>} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Caption -{Pavadinimas} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Message -{Praneðimas} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,NextButton -{<%Next%> >} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Subtitle -{Paantraðtë} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Title -{Antraðtë} - -4DC6C83C-511B-300F-900F-8670A81A7F9C,Message -{} - -4DC6C83C-511B-300F-900F-8670A81A7F9C,Title -{} - -B5904821-3970-1701-002C-0318B8BECA06,Message -{} - -} -::msgcat::mcmset nl { -0464C461-3BD5-93CE-C3BA-C59CA84AD70D,Text -{Pandora Server IP Address:} - -1957048E-B498-4FFF-A8BA-F2DF640463B1,Message -{Het is aan te raden alle overige applicaties te sluiten alvorens verder te gaan met deze installatie. - -Klik op <%Next%> om verder te gaan of op <%Cancel%> om deze installatie af te breken} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,BackButton -{< <%Back%>} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,CancelButton -{<%Cancel%>} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Caption -{This values will be written to the pandora_agent.conf file in the <%ProgramFolderName%> folder. Please change them to your own data.} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Message -{ } - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,NextButton -{<%Next%> >} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Subtitle -{Now it's time to configure your pandora_agent.conf file} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Title -{Pandora FMS Agent for Windows Configuration} - -4DC6C83C-511B-300F-900F-8670A81A7F9C,Message -{} - -4DC6C83C-511B-300F-900F-8670A81A7F9C,Title -{} - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,Caption -{This values will be written to the pandora_agent.conf file in the <%ProgramFolderName%> folder. Please change them to your own data.} - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,Message -{ } - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,Subtitle -{Now it's time to configure your pandora_agent.conf file} - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,Title -{Pandora FMS Agent for Windows Configuration} - -75288342-4CEB-473C-B242-450642503F74,Text -{Pandora Server IP Address:} - -B5904821-3970-1701-002C-0318B8BECA06,Message -{} - -StartPandoraService -{Start Pandora Service} - -StopPandoraService -{Stop Pandora Service} - -} -::msgcat::mcmset pl { -0464C461-3BD5-93CE-C3BA-C59CA84AD70D,Text -{Pandora Server IP Address:} - -1957048E-B498-4FFF-A8BA-F2DF640463B1,Message -{Zainstaluje on <%AppName%> na twoim komputerze. - -Zalecane jest zamkniÄ™cie wszystkich programów przed instalacjÄ…. - -Kliknij Dalej, aby kontynuować lub Anuluj, aby opuÅ›cić instalator.} - -1D572EE2-DD93-4F13-850E-DE0EEB1DA110,Message -{<%UninstallingApplicationText%>} - -2073DDB6-50AB-4708-82AD-02A6C3F3EDE1,Message -{<%InstallationCompleteText%>} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,BackButton -{< <%Back%>} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,CancelButton -{<%Cancel%>} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Caption -{This values will be written to the pandora_agent.conf file in the <%ProgramFolderName%> folder. Please change them to your own data.} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Message -{ } - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,NextButton -{<%Next%> >} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Subtitle -{Now it's time to configure your pandora_agent.conf file} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Title -{Pandora FMS Agent for Windows Configuration} - -4DC6C83C-511B-300F-900F-8670A81A7F9C,Message -{} - -4DC6C83C-511B-300F-900F-8670A81A7F9C,Title -{} - -4E1B9A69-B88E-4DE5-A0E1-08E04C4BE6B3,Message -{<%UninstallCompleteText%>} - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,Caption -{This values will be written to the pandora_agent.conf file in the <%ProgramFolderName%> folder. Please change them to your own data.} - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,Message -{ } - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,Subtitle -{Now it's time to configure your pandora_agent.conf file} - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,Title -{Pandora FMS Agent for Windows Configuration} - -75288342-4CEB-473C-B242-450642503F74,Text -{Pandora Server IP Address:} - -B5904821-3970-1701-002C-0318B8BECA06,Message -{} - -BF861387-DA7F-4986-B5BB-F77358B58603,Message -{<%InstallingApplicationText%>} - -StartPandoraService -{} - -StopPandoraService -{Stop Pandora Service} - -} -::msgcat::mcmset pt_br { -0464C461-3BD5-93CE-C3BA-C59CA84AD70D,Text -{Pandora Server IP Address:} - -1957048E-B498-4FFF-A8BA-F2DF640463B1,Message -{Será instalado <%AppName%> version <%Version%> em seu computador. - -É recomendado que você feche todos os outros programas antes de continuar. - -Depois da instalação, você deve editar o arquivo de configuração para definir o servidor endereço de IP e outros parâmetros. - -Clique em Próximo para continuar ou em Cancelar para sair da Instalação.} - -1D572EE2-DD93-4F13-850E-DE0EEB1DA110,Message -{<%UninstallingApplicationText%>} - -2073DDB6-50AB-4708-82AD-02A6C3F3EDE1,Message -{<%InstallationCompleteText%>} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,BackButton -{< <%Back%>} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,CancelButton -{<%Cancel%>} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Caption -{This values will be written to the pandora_agent.conf file in the <%ProgramFolderName%> folder. Please change them to your own data.} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Message -{ } - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,NextButton -{<%Next%> >} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Subtitle -{Now it's time to configure your pandora_agent.conf file} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Title -{Pandora FMS Agent for Windows Configuration} - -4DC6C83C-511B-300F-900F-8670A81A7F9C,Message -{} - -4DC6C83C-511B-300F-900F-8670A81A7F9C,Title -{} - -4E1B9A69-B88E-4DE5-A0E1-08E04C4BE6B3,Message -{<%UninstallCompleteText%>} - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,Caption -{This values will be written to the pandora_agent.conf file in the <%ProgramFolderName%> folder. Please change them to your own data.} - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,Message -{ } - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,Subtitle -{Now it's time to configure your pandora_agent.conf file} - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,Title -{Pandora FMS Agent for Windows Configuration} - -75288342-4CEB-473C-B242-450642503F74,Text -{Pandora Server IP Address:} - -B5904821-3970-1701-002C-0318B8BECA06,Message -{} - -BF861387-DA7F-4986-B5BB-F77358B58603,Message -{<%InstallingApplicationText%>} - -EditConfiguration -{Editar a configuração} - -StartPandoraService -{Inicia o serviço <%AppName%>} - -StopPandoraService -{Interrompe o serviço <%AppName%>} - -} -::msgcat::mcmset ru { -0464C461-3BD5-93CE-C3BA-C59CA84AD70D,Text -{Agent group name:} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,BackButton -{< <%Back%>} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,CancelButton -{<%Cancel%>} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Caption -{This values will be written to the pandora_agent.conf file in the <%ProgramFolderName%> folder. Please change them to your own data.} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Message -{ } - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,NextButton -{<%Next%> >} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Subtitle -{Now it's time to configure your pandora_agent.conf file} - -22E3617C-DE0E-D452-41DC-8278EA3F9D76,Title -{Pandora FMS Agent for Windows Configuration} - -4DC6C83C-511B-300F-900F-8670A81A7F9C,Message -{} - -4DC6C83C-511B-300F-900F-8670A81A7F9C,Title -{} - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,Caption -{This values will be written to the pandora_agent.conf file in the <%ProgramFolderName%> folder. Please change them to your own data.} - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,Message -{ } - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,Subtitle -{Now it's time to configure your pandora_agent.conf file} - -68A06F1C-625E-4BF0-AE3B-8BFBD37824C1,Title -{Pandora FMS Agent for Windows Configuration} - -75288342-4CEB-473C-B242-450642503F74,Text -{Pandora Server IP Address:} - -B5904821-3970-1701-002C-0318B8BECA06,Message -{} - -StartPandoraService -{Start Pandora Service} - -StopPanodoraService -{} - -} - diff --git a/pandora_agents/win32/pandora.cc.orig b/pandora_agents/win32/pandora.cc.orig deleted file mode 100644 index 7ea551d506..0000000000 --- a/pandora_agents/win32/pandora.cc.orig +++ /dev/null @@ -1,345 +0,0 @@ -/* Common functions to any Pandora program. - Copyright (C) 2006 Artica ST. - Written by Esteban Sanchez. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#include -#include -#include -#include -#include -#include "pandora.h" -#include "pandora_strutils.h" - -using namespace std; -using namespace Pandora; -using namespace Pandora_Strutils; - -#define PATH_SIZE _MAX_PATH+1 -<<<<<<< HEAD -#define PANDORA_VERSION ("7.0NG(Build 170406)") -======= -#define PANDORA_VERSION ("7.0NG(Build 170418)") ->>>>>>> develop - -string pandora_path; -string pandora_dir; -bool pandora_debug; -bool pandora_log_disable; -string pandora_version = PANDORA_VERSION; - -/** - * Parses a string and initialize the key and the value. - * - * The string should be in the format: - * - key value - * - key "value with blankspaces" - */ -void -Key_Value::parseLine (string str) { - int pos; - list tokens; - list::iterator iter; - string trimmedstr; - - trimmedstr = trim (str); - - /* Check if the string has " */ - pos = trimmedstr.find ("\""); - if (pos == string::npos) { - stringtok (tokens, trimmedstr, " \t"); - } else { - stringtok (tokens, trimmedstr, "\""); - } - - /* Pick the first and the last value of the token list */ - iter = tokens.begin (); - key = trim (*iter); - transform (key.begin(), key.end(), key.begin(), (int(*)(int)) tolower); - iter = tokens.end (); - iter--; - /* Check if the line has only one token */ - if (iter != tokens.begin ()) { - value = trim (*iter); - } else { - value = ""; - } -} - -/** - * Parses a string by position and initialize the key and the value. - */ -void -Key_Value::parseLineByPosition (string str, int pos) { - string trimmedstr; - - trimmedstr = trim (str); - - key = trim (trimmedstr.substr (0, pos)); - value = trim (trimmedstr.substr (pos)); -} - -/** - * Get the key of the object. - * - * @return The key - */ -string -Key_Value::getKey () { - return key; -} - -/** - * Set the key of the object. - * - */ -void -Key_Value::setKey (const string key) { - this->key = key; -} - -/** - * Get the value of the object. - * - * @return The value - */ -string -Key_Value::getValue () { - return value; -} - -/** - * Set the value of the object. - * - * @return The value - */ -void -Key_Value::setValue (const string value) { - this->value = value; -} - -void -pandoraWriteLog (string filename, string line) { - string buffer; - char str_time[25]; - FILE *file; - string filepath; - SYSTEMTIME st; - - GetLocalTime(&st); - sprintf (str_time, "%d-%02d-%02d %02d:%02d:%02d ", st.wYear, st.wMonth, st.wDay, - st.wHour, st.wMinute, st.wSecond); - - buffer = (char *) str_time; - buffer += line; - - filepath = pandora_dir + filename; - - file = fopen (filepath.c_str (), "a+"); - if (file != NULL) { - fprintf (file, "%s\n", buffer.c_str ()); - fclose (file); - } -} - -/** - * Write a message in the log file. - * - * The log file is used to write the output of errors and problems of the - * agent. - * - * @param format String output format (like printf). - * @param ... Variable argument list - */ -void -Pandora::pandoraLog (const char *format, ...) { - if (!pandora_log_disable) { - va_list args; - char msg[5000]; - - va_start (args, format); - vsprintf (msg, format, args); - va_end (args); - - pandoraWriteLog ("pandora_agent.log", (char *) msg); - } - return; -} - -/** - * Write a message in the debug file. - * - * The log file is used to write the output of debugging information of the - * agent. - * - * @param format String output format. - * @param ... Variable argument list - */ -void -Pandora::pandoraDebug (const char *format, ...) { - if (pandora_debug) { - va_list args; - char msg[5000]; - - va_start (args, format); - vsprintf (msg, format, args); - va_end (args); - - pandoraWriteLog ("pandora_debug.log", (char *) msg); - } - return; -} - -/** - * Secure free of a pointer. - * - * @param pointer pointer to free. - */ -void -Pandora::pandoraFree (void * pointer) { - if (pointer != NULL) - free (pointer); - return; -} - -/** - * Set the installation directory of the application. - * - * This directory is the path to the directory which holds - * the binary file. - * - * @param dir The path to the directory. - * - * @see getPandoraInstallDir - */ -void -Pandora::setPandoraInstallDir (string dir) { - pandora_dir = dir; -} - -/** - * Get the installation directory of the application. - * - * This directory is the path to the directory which holds - * the binary file. - * - * @return The path to the directory. - * - * @see setPandoraInstallDir - */ -string -Pandora::getPandoraInstallDir () { - return pandora_dir; -} - -/** - * Set the installation path of the application. - * - * This the complete path to the binary file. - * - * @param path The path to the binary file. - * - * @see getPandoraInstallPath - */ -void -Pandora::setPandoraInstallPath (string path) { - pandora_path = path; -} - -/** - * Get the installation path of the application. - * - * This the complete path to the binary file. - * - * @return The path. - * - * @see setPandoraInstallPath - */ -string -Pandora::getPandoraInstallPath () { - return pandora_path; -} - -/** - * Set the debug flag. - * - * If the flag is true output wil be generated and XML files will not be deleted. - * - * @param dbg Turns the debug flag on/off. - * - * @see getPandoraDebug - * @see pandoraDebug - */ -void -Pandora::setPandoraDebug (bool dbg) { - pandora_debug = dbg; -} - -/** - * Get the debug flag value. - * - * If the flag is truee output wil be generated and XML files will not be deleted. - * - * @see setPandoraDebug - * @see pandoraDebug - */ -bool -Pandora::getPandoraDebug () { - return pandora_debug; -} - -/** - * Set the disable logfile flag. - * - * If the flag is true no logs will be written. - * - * @param dbg Turns the debug flag on/off. - * - */ -void -Pandora::setPandoraLogDisable (bool dbg) { - pandora_log_disable = dbg; -} - -/** - * Get the version of the agent. - * - * @return The version. - */ -string -Pandora::getPandoraAgentVersion () { - return pandora_version; -} - - -bool -Pandora::is_enabled (string value) { - static string enabled_values[] = {"enabled", "1", "on", "yes", "si", "sí", "ok", "true", ""}; - int i = 0; - - if (value == "") { - return false; - } - - while (enabled_values[i] != "") { - if (enabled_values[i] == value) { - return true; - } - i++; - } - return false; -} diff --git a/pandora_agents/win32/versioninfo.rc.orig b/pandora_agents/win32/versioninfo.rc.orig deleted file mode 100644 index fe87b98faf..0000000000 --- a/pandora_agents/win32/versioninfo.rc.orig +++ /dev/null @@ -1,28 +0,0 @@ -1 VERSIONINFO -FILEVERSION 1,0,0,0 -PRODUCTVERSION 1,0,0,0 -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "080904E4" - BEGIN - VALUE "CompanyName", "Artica ST" - VALUE "FileDescription", "Pandora FMS Agent for Windows Platform" - VALUE "LegalCopyright", "Artica ST" - VALUE "OriginalFilename", "PandoraAgent.exe" - VALUE "ProductName", "Pandora FMS Windows Agent" -<<<<<<< HEAD - VALUE "ProductVersion", "(7.0NG(Build 170406))" -======= - VALUE "ProductVersion", "(7.0NG(Build 170418))" ->>>>>>> develop - VALUE "FileVersion", "1.0.0.0" - END - END - - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x809, 1252 - END -END - diff --git a/pandora_console/DEBIAN/control.orig b/pandora_console/DEBIAN/control.orig deleted file mode 100644 index 34fa326f6e..0000000000 --- a/pandora_console/DEBIAN/control.orig +++ /dev/null @@ -1,14 +0,0 @@ -package: pandorafms-console -<<<<<<< HEAD -Version: 7.0NG-170406 -======= -Version: 7.0NG-170418 ->>>>>>> develop -Architecture: all -Priority: optional -Section: admin -Installed-Size: 42112 -Maintainer: Artica ST -Homepage: http://pandorafms.org/ -Depends: php5, php5-snmp, php5-gd, php5-mysql, php-db, php5-xmlrpc, php-gettext, php5-curl, graphviz, dbconfig-common, php5-ldap, mysql-client | virtual-mysql-client -Description: Pandora FMS is an Open Source monitoring tool. It monitor your systems and applications, and allows you to control the status of any element of them. The web console is the graphical user interface (GUI) to manage the pool and to generate reports and graphs from the Pandora FMS monitoring process. diff --git a/pandora_console/DEBIAN/make_deb_package.sh.orig b/pandora_console/DEBIAN/make_deb_package.sh.orig deleted file mode 100644 index ba3a273b73..0000000000 --- a/pandora_console/DEBIAN/make_deb_package.sh.orig +++ /dev/null @@ -1,168 +0,0 @@ -#!/bin/bash - -#Pandora FMS- http:#pandorafms.com -# ================================================== -# Copyright (c) 2005-2010 Artica Soluciones Tecnologicas -# Please see http:#pandorafms.org for full contribution list - -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation; version 2 - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -<<<<<<< HEAD -pandora_version="7.0NG-170406" -======= -pandora_version="7.0NG-170418" ->>>>>>> develop - -package_pear=0 -package_pandora=1 - -for param in $@ -do - if [ $param = "-h" -o $param = "--help" ] - then - echo "For only make packages of pear type +pear" - echo "For not make packages of pear type -pear" - exit 0 - fi - - if [ $param = "+pear" ] - then - package_pandora=0 - fi - if [ $param = "-pear" ] - then - package_pear=0 - fi -done - -if [ $package_pandora -eq 1 ] -then - echo "Test if you have all the needed tools to make the packages." - whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null - if [ $? = 1 ] - then - echo "No found \"dpkg-deb\" aplication, please install." - exit 1 - else - echo "Found \"dpkg-debs\"." - fi -fi - -if [ $package_pear -eq 1 ] -then - whereis dh-make-pear | cut -d":" -f2 | grep dh-make-pear > /dev/null - if [ $? = 1 ] - then - echo " \"dh-make-pear\" aplication not found, please install." - exit 1 - else - echo "Found \"dh-make-pear\"." - fi - - whereis fakeroot | cut -d":" -f2 | grep fakeroot > /dev/null - if [ $? = 1 ] - then - echo " \"fakeroot\" aplication not found, please install." - exit 1 - else - echo "Found \"fakeroot\"." - fi -fi - -whereis dpkg-buildpackage | cut -d":" -f2 | grep dpkg-buildpackage > /dev/null -if [ $? = 1 ] -then - echo " \"dpkg-buildpackage\" aplication not found, please install." - exit 1 -else - echo "Found \"dpkg-buildpackage\"." -fi - -cd .. - -echo "Make a \"temp_package\" temporary dir for job." -mkdir -p temp_package -if [ $package_pandora -eq 1 ] -then - mkdir -p temp_package/var/www/pandora_console - mkdir -p temp_package/etc/logrotate.d - - echo "Make directory system tree for package." - cp -R $(ls | grep -v temp_package | grep -v DEBIAN ) temp_package/var/www/pandora_console - cp -R DEBIAN temp_package - cp -aRf pandora_console_logrotate_ubuntu temp_package/etc/logrotate.d/pandora_console - find temp_package/var/www/pandora_console -name ".svn" | xargs rm -Rf - rm -Rf temp_package/var/www/pandora_console/pandora_console.spec - chmod 755 -R temp_package/DEBIAN - touch temp_package/var/www/pandora_console/include/config.php - - - echo "Remove the SVN files and other temp files." - for item in `find temp_package` - do - echo -n "." - echo $item | grep "svn" > /dev/null - #last command success - if [ $? -eq 0 ] - then - rm -rf $item - fi - - echo $item | grep "make_deb_package.sh" > /dev/null - #last command success - if [ $? -eq 0 ] - then - rm -rf $item - fi - done - echo "END" - - echo "Calculate md5sum for md5sums package control file." - for item in `find temp_package` - do - echo -n "." - if [ ! -d $item ] - then - echo $item | grep "DEBIAN" > /dev/null - #last command success - if [ $? -eq 1 ] - then - md5=`md5sum $item | cut -d" " -f1` - - #delete "temp_package" in the path - final_path=${item#temp_package} - echo $md5" "$final_path >> temp_package/DEBIAN/md5sums - fi - fi - done - echo "END" - - echo "Make the package \"Pandorafms console\"." - dpkg-deb --build temp_package - mv temp_package.deb pandorafms.console_$pandora_version.deb -fi - -if [ $package_pear -eq 1 ] -then - echo "Make the package \"php-xml-rpc\"." - cd temp_package - dh-make-pear --maintainer "Miguel de Dios " XML_RPC - cd php-xml-rpc-* - dpkg-buildpackage -rfakeroot - cd .. - mv php-xml-rpc*.deb .. - cd .. -fi - - -echo "Delete the \"temp_package\" temporary dir for job." -rm -Rf temp_package - -echo "DONE: Package ready at: ../pandorafms.console_$pandora_version.deb" diff --git a/pandora_console/include/config_process.php.orig b/pandora_console/include/config_process.php.orig deleted file mode 100644 index 724f83f3dd..0000000000 --- a/pandora_console/include/config_process.php.orig +++ /dev/null @@ -1,292 +0,0 @@ ->>>>>> develop -$pandora_version = 'v7.0NG'; - -// Do not overwrite default timezone set if defined. -$script_tz = @date_default_timezone_get(); -if (empty($script_tz)) { - date_default_timezone_set("Europe/Berlin"); - ini_set("date.timezone", "Europe/Berlin"); -} -else { - ini_set("date.timezone", $script_tz); -} - -//home dir bad defined -if (!is_dir($config['homedir'])) { - $ownDir = dirname(__FILE__) . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR; - $config['homedir'] = $ownDir; - $config["error"] = "homedir_bad_defined"; -} - - -/* Help to debug problems. Override global PHP configuration */ -global $develop_bypass; -if ($develop_bypass != 1) { - // error_reporting(E_ALL); - - if (version_compare(PHP_VERSION, '5.3.0') >= 0) - { - error_reporting(E_ALL & ~E_DEPRECATED & ~E_NOTICE); - } - else - { - error_reporting(E_ALL & ~E_NOTICE); - } - - ini_set("display_errors", 0); - ini_set("log_errors", 1); - ini_set("error_log", $config["homedir"]."/pandora_console.log"); -} -else { - // Develop mode, show all notices and errors on Console (and log it) - if (version_compare(PHP_VERSION, '5.3.0') >= 0) - { - error_reporting(E_ALL & ~E_DEPRECATED); - } - else - { - error_reporting(E_ALL); - } - ini_set("display_errors", 1); - ini_set("log_errors", 1); - ini_set("error_log", $config["homedir"]."/pandora_console.log"); -} - -// Check if mysqli is available -if (!(isset($config["mysqli"]))) { - $config["mysqli"] = extension_loaded(mysqli); -} - -$config['start_time'] = microtime (true); - -$ownDir = dirname(__FILE__) . '/'; -$ownDir = str_replace("\\", "/", $ownDir); - -//Set by default the MySQL connection for DB, because in older Pandora have not -//this token in the config.php -if (!isset($config['dbtype'])) { - $config['dbtype'] = 'mysql'; -} - -if (!isset($config['dbport'])) { - switch ($config['dbtype']) { - case 'mysql': - $config['dbport'] = '3306'; - break; - case 'postgresql': - $config['dbport'] = '5432'; - break; - case 'oracle': - $config['dbport'] = '1521'; - break; - } -} - -require_once ($ownDir . 'constants.php'); -require_once ($ownDir . 'functions_db.php'); -require_once ($ownDir . 'functions.php'); - -db_select_engine(); -$config['dbconnection'] = db_connect(); - - -if (! defined ('EXTENSIONS_DIR')) - define ('EXTENSIONS_DIR', 'extensions'); - -if (! defined ('ENTERPRISE_DIR')) - define ('ENTERPRISE_DIR', 'enterprise'); - -require_once ($ownDir. 'functions_config.php'); - -// We need a timezone BEFORE calling config_process_config. -// If not we will get ugly warnings. Set Europe/Madrid by default -// Later will be replaced by the good one. -if (!defined('METACONSOLE')) { - if(!isset($config["homeurl"])){ - $url = explode('/', $_SERVER['REQUEST_URI']); - $config["homeurl"] = $url[1]; - $config["homeurl_static"] = $url[1]; - $config["error"] = "homeurl_bad_defined"; - return; - } - else{ - $url = explode('/', $_SERVER['REQUEST_URI']); - if($config["homeurl"] != '/'.$url[1]){ - $config["homeurl"] = '/'.$url[1]; - $config["homeurl_static"] = '/'.$url[1]; - $config["error"] = "homeurl_bad_defined"; - return; - } - } -} -if (!isset($config["homeurl_static"])) { - $config["homeurl_static"] = $config["homeurl"]; -} -else{ - if($config["homeurl_static"] != $config["homeurl"]){ - $config["error"] = "homeurl_bad_defined"; - return; - } -} - -date_default_timezone_set("Europe/Madrid"); - - -config_process_config(); - -config_prepare_session(); -require_once ($config["homedir"].'/include/load_session.php'); -if(session_id() == '') { - $resultado = session_start(); -} - -// Set a the system timezone default -if ((!isset($config["timezone"])) OR ($config["timezone"] == "")) { - $config["timezone"] = "Europe/Berlin"; -} - -date_default_timezone_set($config["timezone"]); - -require_once ($ownDir . 'streams.php'); -require_once ($ownDir . 'gettext.php'); - -if (isset($_SERVER['REMOTE_ADDR'])) { - $config["remote_addr"] = $_SERVER['REMOTE_ADDR']; -} -else { - $config["remote_addr"] = null; -} - -// Save the global values -$config["global_block_size"] = $config["block_size"]; -$config["global_flash_charts"] = $config["flash_charts"]; - - -if (isset ($config['id_user'])) { - config_user_set_custom_config(); -} - -// Check if inventory_changes_blacklist is setted, if not create it -if (!isset($config['inventory_changes_blacklist'])) { - $config['inventory_changes_blacklist'] = array(); -} - -//NEW UPDATE MANAGER URL -if (!isset($config['url_update_manager'])) { - config_update_value('url_update_manager', - 'https://licensing.artica.es/pandoraupdate7/server.php'); -} - -if (defined('METACONSOLE')) { - enterprise_include_once('meta/include/functions_users_meta.php'); - enterprise_hook('set_meta_user_language'); -} -else - set_user_language(); - -require_once ($ownDir . 'functions_extensions.php'); - -$config['extensions'] = extensions_get_extensions (); - -// Detect if enterprise extension is installed -// NOTICE: This variable (config[enterprise_installed] is used in several -// sections. Faking or forcing to 1 will make pandora fails. - -if (file_exists ($config["homedir"] . '/' . ENTERPRISE_DIR . '/index.php')) { - $config['enterprise_installed'] = 1; - enterprise_include_once ('include/functions_enterprise.php'); -} -else { - $config['enterprise_installed'] = 0; -} - -// Function include_graphs_dependencies() it's called in the code below -require_once("include_graph_dependencies.php"); - -include_graphs_dependencies($config['homedir'] . '/'); - -// Updates autorefresh time -if (isset($_POST['vc_refr'])) { - config_update_value ('vc_refr', get_parameter('vc_refr', $config['vc_refr'])); -} - - -//======= Autorefresh code ============================================= -$select = db_process_sql("SELECT value FROM tconfig WHERE token='autorefresh_white_list'"); -$autorefresh_list = json_decode($select[0]['value']); -$config['autorefresh_white_list'] = array(); -$config['autorefresh_white_list'] = $autorefresh_list; -// Specific metaconsole autorefresh white list sections -if (defined('METACONSOLE')) { - $config['autorefresh_white_list'][] = 'monitoring/tactical'; - $config['autorefresh_white_list'][] = 'monitoring/group_view'; - $config['autorefresh_white_list'][] = 'operation/tree'; - $config['autorefresh_white_list'][] = 'screens/screens'; -} - -//====================================================================== - - -//====================================================================== -// Update the $config['homeurl'] with the full url with the special -// cases (reverse proxy, others ports...). -//====================================================================== -$config["homeurl"] = ui_get_full_url(false); - - -//====================================================================== -// Get the version of DB manager -//====================================================================== -switch ($config["dbtype"]) { - case "mysql": - if (!isset($config['quote_string'])) { - $config['db_quote_string'] = "\""; - } - break; - case "postgresql": - if (!isset($config['dbversion'])) { - $result = db_get_sql("select version();"); - $result_chunks = explode(" ", $result); - - $config['dbversion'] = $result_chunks[1]; - } - if (!isset($config['quote_string'])) { - $config['db_quote_string'] = "'"; - } - break; - case "oracle": - if (!isset($config['quote_string'])) { - $config['db_quote_string'] = "'"; - } - break; -} -//====================================================================== -?> diff --git a/pandora_console/install.php.orig b/pandora_console/install.php.orig deleted file mode 100644 index 35aee54a1a..0000000000 --- a/pandora_console/install.php.orig +++ /dev/null @@ -1,987 +0,0 @@ - - - - - Pandora FMS - Installation Wizard - - - - - - - - - - - - - -
- >>>>>> develop - $banner = "v$version Build $build"; - - error_reporting(0); - - // --------------- - // Main page code - // --------------- - - if (! isset($_GET["step"])) { - install_step1(); - } - else { - $step = $_GET["step"]; - switch ($step) { - case 11: install_step1_licence(); - break; - case 2: install_step2(); - break; - case 3: install_step3(); - break; - case 4: install_step4(); - break; - case 5: install_step5(); - break; - } - } - ?> -
- - - -"; - echo " $label "; - echo ""; - if (!extension_loaded($ext)) { - echo ""; - return 1; - } - else { - echo ""; - return 0; - } - echo ""; -} - -function check_include ( $ext, $label ) { - echo ""; - echo " $label "; - echo ""; - if (!include($ext)) { - echo ""; - return 1; - } - else { - echo ""; - return 0; - } - echo ""; -} - -function check_exists ( $file, $label ) { - echo ""; - echo " $label "; - echo ""; - if (!file_exists ($file)) { - echo " "; - return 1; - } - else { - echo " "; - return 0; - } - echo ""; -} - -function check_generic ( $ok, $label ) { - echo ""; - if ($ok == 0 ) { - echo " "; - echo ""; - echo " $label "; - echo ""; - echo ""; - return 1; - } - else { - echo " "; - echo ""; - echo " $label "; - echo ""; - echo ""; - return 0; - } -} - -function check_writable ( $fullpath, $label ) { - echo ""; - if (file_exists($fullpath)) - if (is_writable($fullpath)) { - echo " "; - echo ""; - echo " $label "; - echo ""; - echo ""; - return 0; - } - else { - echo " "; - echo ""; - echo " $label "; - echo ""; - echo ""; - return 1; - } - else { - echo " "; - echo ""; - echo " $label "; - echo ""; - echo ""; - return 1; - } -} - -function check_variable ( $var, $value, $label, $mode ) { - echo ""; - echo " $label "; - echo ""; - if ($mode == 1) { - if ($var >= $value) { - echo " "; - return 0; - } - else { - echo " "; - return 1; - } - } - elseif ($var == $value) { - echo " "; - return 0; - } - else { - echo " "; - return 1; - } - echo ""; -} - -function parse_mysql_dump($url) { - if (file_exists($url)) { - $file_content = file($url); - $query = ""; - foreach($file_content as $sql_line) { - if (trim($sql_line) != "" && strpos($sql_line, "-- ") === false) { - $query .= $sql_line; - if(preg_match("/;[\040]*\$/", $sql_line)) { - if (!$result = mysql_query($query)) { - echo mysql_error(); //Uncomment for debug - echo "
$query
"; - return 0; - } - $query = ""; - } - } - } - return 1; - } - else - return 0; -} - -function parse_mysqli_dump($connection, $url) { - if (file_exists($url)) { - $file_content = file($url); - $query = ""; - foreach($file_content as $sql_line) { - if (trim($sql_line) != "" && strpos($sql_line, "-- ") === false) { - $query .= $sql_line; - if(preg_match("/;[\040]*\$/", $sql_line)) { - if (!$result = mysqli_query($connection, $query)) { - echo mysqli_error(); //Uncomment for debug - echo "
$query
"; - return 0; - } - $query = ""; - } - } - } - return 1; - } - else - return 0; -} - -function random_name ($size) { - $temp = ""; - for ($a=0;$a< $size;$a++) - $temp = $temp. chr(rand(122,97)); - - return $temp; -} - -function print_logo_status ($step, $step_total) { - global $banner; - - $header = " -
-
-
- $banner -
-
"; - $header .= " -
- Install step $step of $step_total -
"; - - return $header; -} - -// -// This function adjusts path settings in pandora db for FreeBSD. -// -// All packages and configuration files except operating system's base files -// are installed under /usr/local in FreeBSD. So, path settings in pandora db -// for some programs should be changed from the Linux default. -// -function adjust_paths_for_freebsd($engine, $connection = false) { - - $adjust_sql = array( - "update trecon_script set script = REPLACE(script,'/usr/share','/usr/local/share');", - "update tconfig set value = REPLACE(value,'/usr/bin','/usr/local/bin') where token='netflow_daemon' OR token='netflow_nfdump' OR token='netflow_nfexpire';", - "update talert_commands set command = REPLACE(command,'/usr/bin','/usr/local/bin');", - "update talert_commands set command = REPLACE(command,'/usr/share', '/usr/local/share');", - "update tplugin set execute = REPLACE(execute,'/usr/share','/usr/local/share');", - "update tevent_response set target = REPLACE(target,'/usr/share','/usr/local/share');", - "insert into tconfig (token, value) VALUES ('graphviz_bin_dir', '/usr/local/bin');" - ); - - for ($i = 0; $i < count ($adjust_sql); $i++) { - switch ($engine) { - case 'mysql': - $result = mysql_query($adjust_sql[$i]); - break; - case 'mysqli': - $result = mysqli_query($connection, $adjust_sql[$i]); - break; - case 'oracle': - //Delete the last semicolon from current query - $query = substr($adjust_sql[$i], 0, strlen($adjust_sql[$i]) - 1); - $sql = oci_parse($connection, $query); - $result = oci_execute($sql); - break; - case 'pgsql': - pg_send_query($connection, $adjust_sql[$i]); - $result = pg_get_result($connection); - break; - } - if (!$result) { - return 0; - } - } - - return 1; -} - -function install_step1() { - global $banner; - - echo " -
-
- " . print_logo_status (1,6) . " -
-

Welcome to Pandora FMS installation Wizard

-

This wizard helps you to quick install Pandora FMS console and main database in your system.

-

In four steps, this installer will check all dependencies and will create your configuration, ready to use.

-

For more information, please refer to documentation.
- Pandora FMS Development Team

- "; - if (file_exists("include/config.php")) { - echo "
Warning: You already have a config.php file. - Configuration and database would be overwritten if you continued.
"; - } - echo "
"; - echo ""; - $writable = check_writable ( "include", "Checking if ./include is writable"); - if (file_exists("include/config.php")) - $writable += check_writable ( "include/config.php", "Checking if include/config.php is writable"); - echo "
"; - - echo "
Warning: This installer will overwrite and destroy - your existing Pandora FMS configuration and Database. Before continue, - please be sure that you have no valuable Pandora FMS data in your Database.
-
"; - - echo "
Upgrade: - If you want to upgrade from Pandora FMS 4.x to 5.0 version, please use the migration tool inside /extras directory in this setup. -
"; - - echo "
"; - - if ($writable == 0) { - echo "
"; - echo ""; - echo "
"; - } - else { - echo "
ERROR:You need to setup permissions to be able to write in ./include directory
"; - } - echo "
"; - - echo "
"; - echo " -
-
- Pandora FMS is an OpenSource Software project registered at - SourceForge -
-
"; -} - -function install_step1_licence() { - echo " -
-
- " . print_logo_status (2,6) . " -
-

GPL2 Licence terms agreement

-

Pandora FMS is an OpenSource software project licensed under the GPL2 licence. Pandora FMS includes, as well, another software also licensed under LGPL and BSD licenses. Before continue, you must accept the licence terms.. -

For more information, please refer to our website at http://pandorafms.org and contact us if you have any kind of question about the usage of Pandora FMS

-

If you dont accept the licence terms, please, close your browser and delete Pandora FMS files.

- "; - - if (!file_exists("COPYING")) { - echo "
Licence file 'COPYING' is not present in your distribution. This means you have some 'partial' Pandora FMS distribution. We cannot continue without accepting the licence file."; - echo "
"; - } - else { - echo "
"; - echo ""; - echo "

"; - echo "

"; - } - echo "
"; - - echo "
-
-
- Pandora FMS is an OpenSource Software project registered at - SourceForge -
-
"; -} - -function install_step2() { - - echo " -
-
- " . print_logo_status (3,6) . " -
"; - echo "

Checking software dependencies

"; - echo ""; - $res = 0; - $res += check_variable(phpversion(),"5.2","PHP version >= 5.2",1); - $res += check_extension("gd","PHP GD extension"); - $res += check_extension("ldap","PHP LDAP extension"); - $res += check_extension("snmp","PHP SNMP extension"); - $res += check_extension("session","PHP session extension"); - $res += check_extension("gettext","PHP gettext extension"); - $res += check_extension("mbstring","PHP Multibyte String"); - $res += check_extension("zip","PHP Zip"); - $res += check_extension("zlib","PHP Zlib extension"); - $res += check_extension("json","PHP json extension"); - $res += check_extension("curl","CURL (Client URL Library)"); - $res += check_extension("filter","PHP filter extension"); - $res += check_extension("calendar","PHP calendar extension"); - if (PHP_OS == "FreeBSD") { - $res += check_exists ("/usr/local/bin/twopi","Graphviz Binary"); - } - else if (PHP_OS == "NetBSD") { - $res += check_exists ("/usr/pkg/bin/twopi","Graphviz Binary"); - } - else if ( substr(PHP_OS, 0, 3) == 'WIN' ) { - $res += check_exists ("..\\..\\..\\Graphviz\\bin\\twopi.exe", "Graphviz Binary"); - } - else { - $res += check_exists ("/usr/bin/twopi","Graphviz Binary"); - } - - echo ""; - check_extension("mysql", "PHP MySQL extension"); - check_extension("mysqli", "PHP MySQL(mysqli) extension"); - echo "
"; - echo "DB Engines"; - echo ""; - echo "
"; - - if ($res > 0) { - echo " -
You have some incomplete - dependencies. Please correct them or this installer - will not be able to finish your installation. -
-
- Remember, if you install any PHP module to comply - with these dependences, you need to restart - your HTTP/Apache server after it to use the new - modules. -
-
- Ignore it. -
"; - } - else { - echo "
"; - echo " - "; - echo "
"; - } - echo "
"; - echo "
"; - echo " -
-
-
-
- Pandora FMS is an OpenSource Software project registered at - SourceForge -
- "; -} - - -function install_step3() { - $options = ''; - if (extension_loaded("mysql")) { - $options .= ""; - } - if (extension_loaded("mysqli")) { - $options .= ""; - } - - $error = false; - if (empty($options)) { - $error = true; - } - - echo " -
-
- " . print_logo_status (4,6) . " -
-

Environment and database setup

-

- This wizard will create your Pandora FMS database, - and populate it with all the data needed to run for the first time. -

-

- You need a privileged user to create database schema, this is usually root user. - Information about root user will not be used or stored anymore. -

-

- You can also deploy the scheme into an existing Database. - In this case you need a privileged Database user and password of that instance. -

-

- Now, please, complete all details to configure your database and environment setup. -

-
- Warning: This installer will overwrite and destroy your existing - Pandora FMS configuration and Database. Before continue, - please be sure that you have no valuable Pandora FMS data in your Database. -

-
"; - - if (extension_loaded("oci8")) { - echo "
For Oracle installation an existing Database with a privileged user is needed.
"; - } - if (!$error) { - echo ""; - } - - echo ""; - echo ""; - - // the field dbgrant is only shown when the DB host is different from 127.0.0.1 or localhost - echo " - - "; - - - echo " "; - - echo ""; - if ($_SERVER['SERVER_ADDR'] == 'localhost' || $_SERVER['SERVER_ADDR'] == '127.0.0.1') { - echo "
"; - echo "DB Engine
"; - - - if ($error) { - echo " -
- Warning: You haven't a any DB engine with PHP. Please check the previous step to DB engine dependencies. -
"; - } - else { - echo ""; - - echo "
"; - echo " Installation in
"; - echo ""; - } - echo "
DB User with privileges
- - -
DB Password for this user
- - -
DB Hostname
- - -
DB Name (pandora by default)
- - -
Drop Database if exists
- -
Full path to HTTP publication directory
- For example /var/www/pandora_console/ -
- - -
- Drop Database if exists
- - "; - } else { - echo "
"; - } - echo "URL path to Pandora FMS Console
- For example '/pandora_console' -
- -
- "; - - if (!$error) { - echo "
"; - echo " - "; - echo "
"; - } - - echo "
"; - - echo ""; - - echo "
"; - echo "
-
- Pandora FMS is an OpenSource Software project registered at - SourceForge -
-
"; -} - -function install_step4() { - $pandora_config = "include/config.php"; - - if ( (! isset($_POST["user"])) || (! isset($_POST["dbname"])) || (! isset($_POST["host"])) || - (! isset($_POST["pass"])) || (!isset($_POST['engine'])) || (! isset($_POST["db_action"])) ) { - $dbpassword = ""; - $dbuser = ""; - $dbhost = ""; - $dbname = ""; - $engine = ""; - $dbaction = ""; - $dbgrant = ""; - } - else { - $engine = $_POST['engine']; - $dbpassword = $_POST["pass"]; - $dbuser = $_POST["user"]; - $dbhost = $_POST["host"]; - $dbaction = $_POST["db_action"]; - if (isset($_POST["dbgrant"]) && $_POST["dbgrant"] != "") - $dbgrant = $_POST["dbgrant"]; - else - $dbgrant = $_SERVER["SERVER_ADDR"]; - if (isset($_POST["drop"])) - $dbdrop = $_POST["drop"]; - else - $dbdrop = 0; - - $dbname = $_POST["dbname"]; - if (isset($_POST["url"])) - $url = $_POST["url"]; - else - $url = "http://localhost"; - if (isset($_POST["path"])) { - $path = $_POST["path"]; - $path = str_replace("\\", "/", $path); // Windows compatibility - } - else - $path = "/var/www"; - } - $everything_ok = 0; - $step1=0; - $step2=0; - $step3=0; - $step4=0; $step5=0; $step6=0; $step7=0; - - echo " -
-
- " . print_logo_status(5,6) . " -
-

Creating database and default configuration file

- "; - switch ($engine) { - case 'mysql': - if (! mysql_connect ($dbhost, $dbuser, $dbpassword)) { - check_generic ( 0, "Connection with Database"); - } - else { - check_generic ( 1, "Connection with Database"); - - // Drop database if needed and don't want to install over an existing DB - if ($dbdrop == 1) { - mysql_query ("DROP DATABASE IF EXISTS `$dbname`"); - } - - // Create schema - if ($dbaction == 'db_new' || $dbdrop == 1) { - $step1 = mysql_query ("CREATE DATABASE `$dbname`"); - check_generic ($step1, "Creating database '$dbname'"); - } - else { - $step1 = 1; - } - if ($step1 == 1) { - $step2 = mysql_select_db($dbname); - check_generic ($step2, "Opening database '$dbname'"); - - $step3 = parse_mysql_dump("pandoradb.sql"); - check_generic ($step3, "Creating schema"); - - $step4 = parse_mysql_dump("pandoradb_data.sql"); - check_generic ($step4, "Populating database"); - if (PHP_OS == "FreeBSD") { - $step_freebsd = adjust_paths_for_freebsd ($engine); - check_generic ($step_freebsd, "Adjusting paths in database for FreeBSD"); - } - - $random_password = random_name (8); - $host = $dbhost; // set default granted origin to the origin of the queries - if (($dbhost != 'localhost') && ($dbhost != '127.0.0.1')) - $host = $dbgrant; // if the granted origin is different from local machine, set the valid origin - $step5 = mysql_query ("GRANT ALL PRIVILEGES ON `$dbname`.* to pandora@$host - IDENTIFIED BY '".$random_password."'"); - mysql_query ("FLUSH PRIVILEGES"); - check_generic ($step5, "Established privileges for user pandora. A new random password has been generated: $random_password
Please write it down, you will need to setup your Pandora FMS server, editing the /etc/pandora/pandora_server.conf file
"); - - $step6 = is_writable("include"); - check_generic ($step6, "Write permissions to save config file in './include'"); - - $cfgin = fopen ("include/config.inc.php","r"); - $cfgout = fopen ($pandora_config,"w"); - $config_contents = fread ($cfgin, filesize("include/config.inc.php")); - $dbtype = 'mysql'; - $config_new = ''; - $step7 = fputs ($cfgout, $config_new); - $step7 = $step7 + fputs ($cfgout, $config_contents); - if ($step7 > 0) - $step7 = 1; - fclose ($cfgin); - fclose ($cfgout); - chmod ($pandora_config, 0600); - check_generic ($step7, "Created new config file at '".$pandora_config."'"); - } - } - - if (($step7 + $step6 + $step5 + $step4 + $step3 + $step2 + $step1) == 7) { - $everything_ok = 1; - } - break; - case 'mysqli': - $connection = mysqli_connect ($dbhost, $dbuser, $dbpassword); - if (mysqli_connect_error() > 0) { - check_generic ( 0, "Connection with Database"); - } - else { - check_generic ( 1, "Connection with Database"); - - // Drop database if needed and don't want to install over an existing DB - if ($dbdrop == 1) { - mysqli_query ($connection, "DROP DATABASE IF EXISTS `$dbname`"); - } - - // Create schema - if ($dbaction == 'db_new' || $dbdrop == 1) { - $step1 = mysqli_query ($connection, "CREATE DATABASE `$dbname`"); - check_generic ($step1, "Creating database '$dbname'"); - } - else { - $step1 = 1; - } - if ($step1 == 1) { - $step2 = mysqli_select_db($connection, $dbname); - check_generic ($step2, "Opening database '$dbname'"); - - $step3 = parse_mysqli_dump($connection, "pandoradb.sql"); - check_generic ($step3, "Creating schema"); - - $step4 = parse_mysqli_dump($connection, "pandoradb_data.sql"); - check_generic ($step4, "Populating database"); - if (PHP_OS == "FreeBSD") { - $step_freebsd = adjust_paths_for_freebsd ($engine, $connection); - check_generic ($step_freebsd, "Adjusting paths in database for FreeBSD"); - } - - $random_password = random_name (8); - $host = $dbhost; // set default granted origin to the origin of the queries - if (($dbhost != 'localhost') && ($dbhost != '127.0.0.1')) - $host = $dbgrant; // if the granted origin is different from local machine, set the valid origin - $step5 = mysqli_query ($connection, "GRANT ALL PRIVILEGES ON `$dbname`.* to pandora@$host - IDENTIFIED BY '".$random_password."'"); - mysqli_query ($connection, "FLUSH PRIVILEGES"); - check_generic ($step5, "Established privileges for user pandora. A new random password has been generated: $random_password
Please write it down, you will need to setup your Pandora FMS server, editing the /etc/pandora/pandora_server.conf file
"); - - $step6 = is_writable("include"); - check_generic ($step6, "Write permissions to save config file in './include'"); - - $cfgin = fopen ("include/config.inc.php","r"); - $cfgout = fopen ($pandora_config,"w"); - $config_contents = fread ($cfgin, filesize("include/config.inc.php")); - $dbtype = 'mysql'; - $config_new = ''; - $step7 = fputs ($cfgout, $config_new); - $step7 = $step7 + fputs ($cfgout, $config_contents); - if ($step7 > 0) - $step7 = 1; - fclose ($cfgin); - fclose ($cfgout); - chmod ($pandora_config, 0600); - check_generic ($step7, "Created new config file at '".$pandora_config."'"); - } - } - - if (($step7 + $step6 + $step5 + $step4 + $step3 + $step2 + $step1) == 7) { - $everything_ok = 1; - } - break; - } - echo "
"; - - if ($everything_ok == 1) { - echo "
"; - echo " - "; - echo "
"; - } - else { - $info = "
There were some problems. - Installation was not completed. -

Please correct failures before trying again. - All database "; - if ($engine == 'oracle') - $info .= "objects "; - else - $info .= "schemes "; - - $info .= "created in this step have been dropped.

-
"; - echo $info; - - switch ($engine) { - case 'mysql': - if (mysql_error() != "") { - echo "
ERROR: ". mysql_error().".
"; - } - - if ($step1 == 1) { - mysql_query ("DROP DATABASE $dbname"); - } - break; - case 'mysqli': - if (mysqli_error($connection) != "") { - echo "
ERROR: ". mysqli_error($connection).".
"; - } - - if ($step1 == 1) { - mysqli_query ($connection, "DROP DATABASE $dbname"); - } - break; - } - echo "
"; - } - echo "
"; - echo "
"; - echo " -
-
- Pandora FMS is an Open Source Software project registered at - SourceForge -
- "; -} - - -function install_step5() { - echo " -
-
- " . print_logo_status (6,6) . " -
-

Installation complete

-

For security, you now must manually delete this installer - ('install.php') file before trying to access to your Pandora FMS console. -

You should also install Pandora FMS Servers before trying to monitor anything; - please read documentation on how to install it.

-

Default user is 'admin' with password 'pandora', - please change it both as soon as possible.

-

Don't forget to check http://pandorafms.com - for updates. -

Select if you want to rename 'install.php'.

-
- - -
-


. -

-
"; - - echo "
-
- Pandora FMS is an OpenSource Software project registered at - SourceForge -
-
"; -} -?> diff --git a/pandora_console/pandora_console.redhat.spec.orig b/pandora_console/pandora_console.redhat.spec.orig deleted file mode 100644 index 9fdc0c7021..0000000000 --- a/pandora_console/pandora_console.redhat.spec.orig +++ /dev/null @@ -1,85 +0,0 @@ -# -# Pandora FMS Console -# -%define name pandorafms_console -%define version 7.0NG -<<<<<<< HEAD -%define release 170406 -======= -%define release 170418 ->>>>>>> develop - -# User and Group under which Apache is running -%define httpd_name httpd -%define httpd_user apache -%define httpd_group apache - -Summary: Pandora FMS Console -Name: %{name} -Version: %{version} -Release: %{release} -License: GPL -Vendor: Artica ST -#Source0: %{name}-%{version}-%{revision}.tar.gz -Source0: %{name}-%{version}.tar.gz -URL: http://www.pandorafms.com -Group: Productivity/Networking/Web/Utilities -Packager: Sancho Lerena -Prefix: /var/www/html -BuildRoot: %{_tmppath}/%{name} -BuildArch: noarch -AutoReq: 0 -Requires: %{httpd_name} >= 2.0.0 -Requires: mod_php >= 5.2.0 -Requires: php-gd, php-ldap, php-snmp, php-session, php-gettext -Requires: php-mysql, php-mbstring, php-zip, php-zlib, php-curl -Requires: xorg-x11-fonts-75dpi, xorg-x11-fonts-misc -Requires: graphviz -Provides: %{name}-%{version} - - -%description -The Web Console is a web application that allows to see graphical reports, state of every agent, also to access to the information sent by the agent, to see every monitored parameter and to see its evolution throughout the time, to form the different nodes, groups and users of the system. It is the part that interacts with the final user, and that will allows you to administer the system. - -%prep -rm -rf $RPM_BUILD_ROOT - -%setup -q -n pandora_console - -%build - -%install -rm -rf $RPM_BUILD_ROOT -mkdir -p $RPM_BUILD_ROOT%{prefix}/pandora_console -mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/ -cp -aRf * $RPM_BUILD_ROOT%{prefix}/pandora_console -rm $RPM_BUILD_ROOT%{prefix}/pandora_console/*.spec -rm $RPM_BUILD_ROOT%{prefix}/pandora_console/pandora_console_install -install -m 0644 pandora_console_logrotate_centos $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/pandora_console - -%clean -rm -rf $RPM_BUILD_ROOT - -%post -# Has an install already been done, if so we only want to update the files -# push install.php aside so that the console works immediately using existing -# configuration. -# -if [ -f %{prefix}/pandora_console/include/config.php ] ; then - mv %{prefix}/pandora_console/install.php %{prefix}/pandora_console/install.done -else - echo "Please, now, point your browser to http://your_IP_address/pandora_console/install.php and follow all the steps described on it." -fi - -%preun - -# Upgrading -if [ "$1" = "1" ]; then - exit 0 -fi - -%files -%defattr(0644,%{httpd_user},%{httpd_group},0755) -%docdir %{prefix}/pandora_console/docs -%{prefix}/pandora_console -%config(noreplace) %{_sysconfdir}/logrotate.d/pandora_console diff --git a/pandora_console/pandora_console.spec.orig b/pandora_console/pandora_console.spec.orig deleted file mode 100644 index 82fb6dc56d..0000000000 --- a/pandora_console/pandora_console.spec.orig +++ /dev/null @@ -1,96 +0,0 @@ -# -# Pandora FMS Console -# -%define name pandorafms_console -%define version 7.0NG -<<<<<<< HEAD -%define release 170406 -======= -%define release 170418 ->>>>>>> develop -%define httpd_name httpd -# User and Group under which Apache is running -%define httpd_name apache2 -%define httpd_user wwwrun -%define httpd_group www - -# Evaluate PHP version -%define phpver_lt_430 %(out=`rpm -q --queryformat='%{VERSION}' php` 2>&1 >/dev/null || out=0 ; out=`echo $out | tr . : | sed s/://g` ; if [ $out -lt 430 ] ; then out=1 ; else out=0; fi ; echo $out) - -Summary: Pandora FMS Console -Name: %{name} -Version: %{version} -Release: %{release} -License: GPL -Vendor: Artica ST -Source0: %{name}-%{version}.tar.gz -URL: http://www.pandorafms.org -Group: System/Monitoring -Packager: Sancho Lerena -Prefix: /srv/www/htdocs -BuildRoot: %{_tmppath}/%{name} -BuildArch: noarch -AutoReq: 0 -Requires: apache2, apache2-mod_php5 -Requires: php >= 4.3.0 -Requires: php5-gd, php5-snmp, php5-json, php5-gettext -Requires: php5-mysql, php5-ldap, php5-mbstring, php5 -Requires: graphviz, xorg-x11-fonts-core, graphviz-gd -Requires: php5-zip, php5-zlib, php5-curl -Provides: %{name}-%{version} - -%description -Pandora FMS Console is a web application to manage Pandora FMS. Console allows to see graphical reports, state of every agent, also to access to the information sent by the agent, to see every monitored parameter and to see its evolution throughout the time, to form the different nodes, groups and users of the system. It is the part that interacts with the final user, and that will allows you to administer the system. - -%prep -rm -rf $RPM_BUILD_ROOT - -%setup -q -n pandora_console - -%build - -%install -rm -rf $RPM_BUILD_ROOT -mkdir -p $RPM_BUILD_ROOT%{prefix}/pandora_console -cp -aRf * $RPM_BUILD_ROOT%{prefix}/pandora_console -if [ -f $RPM_BUILD_ROOT%{prefix}/pandora_console/pandora_console.spec ] ; then - rm $RPM_BUILD_ROOT%{prefix}/pandora_console/pandora_console.spec -fi - -%clean -rm -rf $RPM_BUILD_ROOT - -%post -# Has an install already been done, if so we only want to update the files -# push install.php aside so that the console works immediately using existing -# configuration. -# -if [ -f %{prefix}/pandora_console/include/config.php ] ; then - mv %{prefix}/pandora_console/install.php %{prefix}/pandora_console/install.done -else - echo "Please, now, point your browser to http://your_IP_address/pandora_console/install.php and follow all the steps described on it." -fi -cp -aRf %{prefix}/pandora_console/pandora_console_logrotate_suse /etc/logrotate.d/pandora_console - -%preun - -# Upgrading -if [ "$1" = "1" ]; then - exit 0 -fi - -rm -Rf %{prefix}/pandora_console - -%postun - -# Upgrading -if [ "$1" = "1" ]; then - exit 0 -fi - -rm -Rf /etc/logrotate.d/pandora_console - -%files -%defattr(0644,%{httpd_user},%{httpd_group},0755) -%docdir %{prefix}/pandora_console/docs -%{prefix}/pandora_console diff --git a/pandora_server/DEBIAN/control.orig b/pandora_server/DEBIAN/control.orig deleted file mode 100644 index 8d59f31dcb..0000000000 --- a/pandora_server/DEBIAN/control.orig +++ /dev/null @@ -1,14 +0,0 @@ -package: pandorafms-server -<<<<<<< HEAD -Version: 7.0NG-170406 -======= -Version: 7.0NG-170418 ->>>>>>> develop -Architecture: all -Priority: optional -Section: admin -Installed-Size: 640 -Maintainer: Miguel de Dios -Homepage: http://pandorafms.org/ -Depends: perl (>= 5.8), libdbi-perl, libdbd-mysql-perl, libtime-format-perl, libnetaddr-ip-perl, libtime-format-perl, libxml-simple-perl, libxml-twig-perl, libhtml-parser-perl, snmp, snmpd, traceroute, xprobe2, nmap, sudo, libwww-perl, libsocket6-perl, libio-socket-inet6-perl, snmp-mibs-downloader, libjson-perl, libnet-telnet-perl, libencode-locale-perl -Description: Pandora FMS is a monitoring system for big IT environments. It uses remote tests, or local agents to grab information. Pandora supports all standard OS (Linux, AIX, HP-UX, Solaris and Windows XP,2000/2003), and support multiple setups in HA enviroments. This is the server package. Server makes the remote checks and process information transfer by Pandora FMS agents to the server. diff --git a/pandora_server/DEBIAN/make_deb_package.sh.orig b/pandora_server/DEBIAN/make_deb_package.sh.orig deleted file mode 100644 index 0226770872..0000000000 --- a/pandora_server/DEBIAN/make_deb_package.sh.orig +++ /dev/null @@ -1,188 +0,0 @@ -#!/bin/bash - -# Pandora FMS- http://pandorafms.com -# ================================================== -# Copyright (c) 2005-2010 Artica Soluciones Tecnologicas -# Please see http:#pandorafms.org for full contribution list - -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation; version 2 - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -<<<<<<< HEAD -pandora_version="7.0NG-170406" -======= -pandora_version="7.0NG-170418" ->>>>>>> develop - -package_cpan=0 -package_pandora=1 -for param in $@ -do - if [ $param = "-h" -o $param = "--help" ] - then - echo "For only make packages of cpan type +cpan" - echo "For not make packages of cpan type -cpan" - exit 0 - fi - - if [ $param = "+cpan" ] - then - package_pandora=0 - fi - if [ $param = "-cpan" ] - then - package_cpan=0 - fi -done - -echo "This script to make deb must run as root (because the dh-make-perl need this). Then test if you are root." -if [ `id -u` != 0 ] -then - echo "You aren't root." - exit 1 -fi - -if [ $package_cpan -eq 1 ] -then - echo "Test if you has the tools for to make the packages." - whereis dh-make-perl | cut -d":" -f2 | grep dh-make-perl > /dev/null - if [ $? = 1 ] - then - echo "No found \"dh-make-perl\" aplication, please install." - exit 1 - else - echo "Found \"dh-make-perl\"." - fi -fi - -cd .. - -echo "Make a \"temp_package\" temp dir for job." -mkdir temp_package - -if [ $package_pandora -eq 1 ] -then - mkdir -p temp_package/usr/bin/ - mkdir -p temp_package/usr/sbin/ - mkdir -p temp_package/etc/init.d/ - mkdir -p temp_package/lib/systemd/system/ - mkdir -p temp_package/etc/pandora/ - mkdir -p temp_package/var/spool/pandora/data_in - chmod 770 temp_package/var/spool/pandora/data_in - mkdir -p temp_package/var/spool/pandora/data_in/conf - mkdir -p temp_package/var/spool/pandora/data_in/md5 - chmod 770 temp_package/var/spool/pandora/data_in/md5 - mkdir -p temp_package/var/spool/pandora/data_in/collections - chmod 770 temp_package/var/spool/pandora/data_in/collections - mkdir -p temp_package/var/spool/pandora/data_in/netflow - chmod 770 temp_package/var/spool/pandora/data_in/netflow - mkdir -p temp_package/var/spool/pandora/data_in/trans - chmod 770 temp_package/var/spool/pandora/data_in/trans - mkdir -p temp_package/var/log/pandora/ - mkdir -p temp_package/usr/share/pandora_server/conf/ - mkdir -p temp_package/usr/lib/perl5/ - mkdir -p temp_package/usr/share/man/man1/ - mkdir -p temp_package/etc/logrotate.d/ - - cp -aRf bin/pandora_server temp_package/usr/bin/ - cp -aRf bin/pandora_exec temp_package/usr/bin/pandora_exec.server - cp -aRf bin/tentacle_server temp_package/usr/bin/ - - cp -aRf conf/* temp_package/usr/share/pandora_server/conf/ - cp -aRf util temp_package/usr/share/pandora_server/ - cp -aRf lib/* temp_package/usr/lib/perl5/ - cp -aRf AUTHORS COPYING README temp_package/usr/share/pandora_server/ - - cp -aRf util/pandora_server temp_package/etc/init.d/ - cp -aRf util/tentacle_serverd temp_package/etc/init.d/ - - cp -aRf util/pandora_server.service temp_package/lib/systemd/system/ - cp -aRf util/tentacle_serverd.service temp_package/lib/systemd/system/ - - cp -aRf man/man1/* temp_package/usr/share/man/man1/ - - cp -aRf util/pandora_server_logrotate temp_package/etc/logrotate.d/pandora_server - - rm -f temp_package/usr/share/pandora_server/util/PandoraFMS - rm -f temp_package/usr/share/pandora_server/bin/PandoraFMS - rm -f temp_package/usr/share/pandora_server/util/recon_scripts/PandoraFMS - - cp -R DEBIAN temp_package/ - chmod 755 -R temp_package/DEBIAN - - echo "Remove the SVN files and other temp files." - for item in `find temp_package` - do - echo -n "." - echo $item | grep "svn" > /dev/null - #last command success - if [ $? -eq 0 ] - then - rm -rf $item - fi - - echo $item | grep "make_deb_package.sh" > /dev/null - #last command success - if [ $? -eq 0 ] - then - rm -rf $item - fi - done - echo "END" - - echo " " - pwd - echo " " - - echo "Calcule md5sum for md5sums file control of package." - for item in `find temp_package` - do - echo -n "." - if [ ! -d $item ] - then - echo $item | grep "DEBIAN" > /dev/null - #last command success - if [ $? -eq 1 ] - then - md5=`md5sum $item | cut -d" " -f1` - - #delete "temp_package" in the path - final_path=${item#temp_package} - echo $md5" "$final_path >> temp_package/DEBIAN/md5sums - fi - fi - done - - echo "END" - - echo "Make the package \"Pandorafms server\"." - dpkg-deb --build temp_package - mv temp_package.deb pandorafms.server_$pandora_version.deb - chmod 777 pandorafms.server_$pandora_version.deb -fi - -if [ $package_cpan -eq 1 ] -then - echo "Make the package \"libnet-traceroute-pureperl-perl\"." - cd temp_package - dh-make-perl --build --cpan Net::Traceroute::PurePerl - chmod 777 libnet-traceroute-pureperl-perl*.deb - mv libnet-traceroute-pureperl-perl*.deb .. - cd .. - - echo "Make the package \"libnet-traceroute-perl\"." - cd temp_package - dh-make-perl --build --cpan Net::Traceroute - chmod 777 libnet-traceroute-perl*.deb - mv libnet-traceroute-perl*.deb .. - cd .. -fi - -echo "Delete the \"temp_package\" temp dir for job." -rm -rf temp_package diff --git a/pandora_server/lib/PandoraFMS/Config.pm.orig b/pandora_server/lib/PandoraFMS/Config.pm.orig deleted file mode 100644 index 50c07d207c..0000000000 --- a/pandora_server/lib/PandoraFMS/Config.pm.orig +++ /dev/null @@ -1,1109 +0,0 @@ -package PandoraFMS::Config; -########################################################################## -# Configuration Package -# Pandora FMS. the Flexible Monitoring System. http://www.pandorafms.org -########################################################################## -# Copyright (c) 2005-2011 Artica Soluciones Tecnologicas S.L -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation; version 2. -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -########################################################################## - -use warnings; -use POSIX qw(strftime); -use Time::Local; - -# Default lib dir for RPM and DEB packages -use lib '/usr/lib/perl5'; - -use PandoraFMS::Tools; -use PandoraFMS::DB; -use PandoraFMS::Core; -require Exporter; - -our @ISA = ("Exporter"); -our %EXPORT_TAGS = ( 'all' => [ qw( ) ] ); -our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); -our @EXPORT = qw( - pandora_help_screen - pandora_init - pandora_load_config - pandora_start_log - pandora_get_sharedconfig - pandora_get_tconfig_token - ); - -# version: Defines actual version of Pandora Server for this module only -my $pandora_version = "7.0NG"; -<<<<<<< HEAD -my $pandora_build = "170406"; -======= -my $pandora_build = "170418"; ->>>>>>> develop -our $VERSION = $pandora_version." ".$pandora_build; - -# Setup hash -my %pa_config; - -# Public functions -########################################################################## -# SUB pandora_help_screen() -# Shows a help screen and exits -########################################################################## - -sub help_screen { - print "\nSyntax: \n\n pandora_server [ options ] < fullpathname to configuration file (pandora_server.conf) > \n\n"; - print "Following options are optional : \n"; - print " -v : Verbose mode activated. Writes more information in the logfile \n"; - print " -d : Debug mode activated. Writes extensive information in the logfile \n"; - print " -D : Daemon mode (runs in background)\n"; - print " -P : Store PID to file.\n"; - print " -q : Quiet startup \n"; - print " -S : Manage the win32 service.\n"; - print " -h : This screen. Shows a little help screen \n"; - print " \n"; - exit; -} - -########################################################################## -# SUB pandora_init ( %pandora_cfg ) -# Makes the initial parameter parsing, initializing and error checking -########################################################################## - -sub pandora_init { - my $pa_config = $_[0]; - my $init_string = $_[1]; - print "\n$init_string $pandora_version Build $pandora_build Copyright (c) 2004-2015 ArticaST\n"; - print "This program is OpenSource, licensed under the terms of GPL License version 2.\n"; - print "You can download latest versions and documentation at http://www.pandorafms.org \n\n"; - - # Load config file from command line - if ($#ARGV == -1 ){ - print "I need at least one parameter: Complete path to Pandora FMS Server configuration file \n"; - help_screen; - exit; - } - $pa_config->{"verbosity"}=0; # Verbose 1 by default - $pa_config->{"daemon"}=0; # Daemon 0 by default - $pa_config->{'PID'}=""; # PID file not exist by default - $pa_config->{"quiet"}=0; # Daemon 0 by default - - # If there are not valid parameters - my $parametro; - my $ltotal=$#ARGV; my $ax; - - for ($ax=0;$ax<=$ltotal;$ax++){ - $parametro = $ARGV[$ax]; - if (($parametro =~ m/-h\z/i ) || ($parametro =~ m/help\z/i )) { - help_screen(); - } - elsif ($parametro =~ m/-v\z/i) { - $pa_config->{"verbosity"}=5; - } - elsif ($parametro =~ m/^-P\z/i) { - $pa_config->{'PID'}= clean_blank($ARGV[$ax+1]); - } - elsif ($parametro =~ m/-d\z/) { - $pa_config->{"verbosity"}=10; - } - elsif ($parametro =~ m/-q\z/) { - $pa_config->{"quiet"}=1; - } - elsif ($parametro =~ m/-D\z/) { - $pa_config->{"daemon"}=1; - } - elsif ($parametro =~ m/^-S\z/i) { - $pa_config->{'win32_service'}= clean_blank($ARGV[$ax+1]); - } - else { - ($pa_config->{"pandora_path"} = $parametro); - } - } - if ($pa_config->{"pandora_path"} eq ""){ - print " [ERROR] I need at least one parameter: Complete path to Pandora FMS configuration file. \n"; - print " For example: ./pandora_server /etc/pandora/pandora_server.conf \n\n"; - exit; - } -} - -########################################################################## -# Read some config tokens from database set by the console -########################################################################## -sub pandora_get_sharedconfig ($$) { - my ($pa_config, $dbh) = @_; - - # Agentaccess option - $pa_config->{"agentaccess"} = pandora_get_tconfig_token ($dbh, 'agentaccess', 1); - - # Realtimestats 0 disabled, 1 enabled. - # Master servers will generate all the information (global tactical stats). - # and each server will generate it's own server stats (lag, etc). - $pa_config->{"realtimestats"} = pandora_get_tconfig_token ($dbh, 'realtimestats', 0); - - # Stats_interval option - $pa_config->{"stats_interval"} = pandora_get_tconfig_token ($dbh, 'stats_interval', 300); - - # Netflow configuration options - $pa_config->{"activate_netflow"} = pandora_get_tconfig_token ($dbh, 'activate_netflow', 0); - $pa_config->{"netflow_path"} = pandora_get_tconfig_token ($dbh, 'netflow_path', '/var/spool/pandora/data_in/netflow'); - $pa_config->{"netflow_interval"} = pandora_get_tconfig_token ($dbh, 'netflow_interval', 300); - $pa_config->{"netflow_daemon"} = pandora_get_tconfig_token ($dbh, 'netflow_daemon', '/usr/bin/nfcapd'); - - # Log module configuration - $pa_config->{"log_dir"} = pandora_get_tconfig_token ($dbh, 'log_dir', '/var/spool/pandora/data_in/log'); - $pa_config->{"log_interval"} = pandora_get_tconfig_token ($dbh, 'log_interval', 3600); - - # Pandora FMS Console's attachment directory - $pa_config->{"attachment_dir"} = pandora_get_tconfig_token ($dbh, 'attachment_store', '/var/www/pandora_console/attachment'); - - #Limit of events replicate in metaconsole - $pa_config->{'replication_limit'} = pandora_get_tconfig_token ($dbh, 'replication_limit', 1000); - $pa_config->{'include_agents'} = pandora_get_tconfig_token ($dbh, 'include_agents', 0); - - #Public url - $pa_config->{'public_url'} = pandora_get_tconfig_token ($dbh, 'public_url', 'http://localhost/pandora_console'); - - # Node with a metaconsole license. - # NOTE: This must be read when checking license limits! - #$pa_config->{"node_metaconsole"} = pandora_get_tconfig_token ($dbh, 'node_metaconsole', 0); - - - if ($pa_config->{'include_agents'} eq '') { - $pa_config->{'include_agents'} = 0; - } - -} - -########################################################################## -# Read external configuration file -########################################################################## - -sub pandora_load_config { - my $pa_config = $_[0]; - my $archivo_cfg = $pa_config->{'pandora_path'}; - my $buffer_line; - my @command_line; - my $tbuf; - - # Default values - $pa_config->{'version'} = $pandora_version; - $pa_config->{'build'} = $pandora_build; - $pa_config->{"dbengine"} = "mysql"; - $pa_config->{"dbuser"} = "pandora"; - $pa_config->{"dbpass"} = "pandora"; - $pa_config->{"dbhost"} = "localhost"; - $pa_config->{'dbport'} = undef; # set to standard port of "dbengine" later - $pa_config->{"dbname"} = "pandora"; - $pa_config->{"basepath"} = $pa_config->{'pandora_path'}; # Compatibility with Pandora 1.1 - $pa_config->{"incomingdir"} = "/var/spool/pandora/data_in"; - $pa_config->{"user"} = "pandora"; # environment settings default user owner for files generated - $pa_config->{"group"} = "apache"; # environment settings default group owner for files generated - $pa_config->{"umask"} = "0007"; # environment settings umask applied over chmod (A & (not B)) - $pa_config->{"server_threshold"} = 30; - $pa_config->{"alert_threshold"} = 60; - $pa_config->{"graph_precision"} = 1; - $pa_config->{"log_file"} = "/var/log/pandora_server.log"; - $pa_config->{"errorlog_file"} = "/var/log/pandora_server.error"; - $pa_config->{"networktimeout"} = 5; # By default, not in config file yet - $pa_config->{"pandora_master"} = 1; # on by default - $pa_config->{"pandora_check"} = 0; # Deprecated since 2.0 - $pa_config->{"servername"} = `hostname`; - $pa_config->{"servername"} =~ s/\s//g; # Replace ' ' chars - $pa_config->{"dataserver"} = 1; # default - $pa_config->{"networkserver"} = 1; # default - $pa_config->{"snmpconsole"} = 1; # default - $pa_config->{"reconserver"} = 1; # default - $pa_config->{"wmiserver"} = 1; # default - $pa_config->{"pluginserver"} = 1; # default - $pa_config->{"predictionserver"} = 1; # default - $pa_config->{"exportserver"} = 1; # default - $pa_config->{"inventoryserver"} = 1; # default - $pa_config->{"webserver"} = 1; # 3.0 - $pa_config->{"transactionalserver"} = 0; # Default 0, introduced on 6.1 - $pa_config->{"transactional_threads"} = 1; # Default 1, introduced on 6.1 - $pa_config->{"transactional_threshold"} = 2; # Default 2, introduced on 6.1 - $pa_config->{"transactional_pool"} = $pa_config->{"incomingdir"} . "/" . "trans"; # Default, introduced on 6.1 - $pa_config->{'snmp_logfile'} = "/var/log/pandora_snmptrap.log"; - $pa_config->{"network_threads"} = 3; # Fixed default - $pa_config->{"keepalive"} = 60; # 60 Seconds initially for server keepalive - $pa_config->{"keepalive_orig"} = $pa_config->{"keepalive"}; - $pa_config->{"icmp_checks"} = 1; # Introduced on 1.3.1 - $pa_config->{"icmp_packets"} = 1; # > 5.1SP2 - $pa_config->{"alert_recovery"} = 0; # Introduced on 1.3.1 - $pa_config->{"snmp_checks"} = 1; # Introduced on 1.3.1 - $pa_config->{"snmp_timeout"} = 8; # Introduced on 1.3.1 - $pa_config->{"snmp_trapd"} = '/usr/sbin/snmptrapd'; # 3.0 - $pa_config->{"tcp_checks"} = 1; # Introduced on 1.3.1 - $pa_config->{"tcp_timeout"} = 20; # Introduced on 1.3.1 - $pa_config->{"snmp_proc_deadresponse"} = 1; # Introduced on 1.3.1 10 Feb08 - $pa_config->{"plugin_threads"} = 2; # Introduced on 2.0 - $pa_config->{"plugin_exec"} = '/usr/bin/timeout'; # 3.0 - $pa_config->{"recon_threads"} = 2; # Introduced on 2.0 - $pa_config->{"prediction_threads"} = 1; # Introduced on 2.0 - $pa_config->{"plugin_timeout"} = 5; # Introduced on 2.0 - $pa_config->{"wmi_threads"} = 2; # Introduced on 2.0 - $pa_config->{"wmi_timeout"} = 5; # Introduced on 2.0 - $pa_config->{"wmi_client"} = 'wmic'; # 3.0 - $pa_config->{"dataserver_threads"} = 2; # Introduced on 2.0 - $pa_config->{"inventory_threads"} = 2; # 2.1 - $pa_config->{"export_threads"} = 1; # 3.0 - $pa_config->{"web_threads"} = 1; # 3.0 - $pa_config->{"web_engine"} = 'lwp'; # 5.1 - $pa_config->{"activate_gis"} = 0; # 3.1 - $pa_config->{"location_error"} = 50; # 3.1 - $pa_config->{"recon_reverse_geolocation_mode"} = 'disabled'; # 3.1 - $pa_config->{"recon_reverse_geolocation_file"} = '/usr/local/share/GeoIP/GeoIPCity.dat'; # 3.1 - $pa_config->{"recon_location_scatter_radius"} = 50; # 3.1 - $pa_config->{"update_parent"} = 0; # 3.1 - $pa_config->{"google_maps_description"} = 0; - $pa_config->{'openstreetmaps_description'} = 0; - $pa_config->{"eventserver"} = 1; # 4.0 - $pa_config->{"event_window"} = 3600; # 4.0 - $pa_config->{"icmpserver"} = 0; # 4.0 - $pa_config->{"icmp_threads"} = 3; # 4.0 - $pa_config->{"snmpserver"} = 0; # 4.0 - $pa_config->{"snmp_threads"} = 3; # 4.0 - $pa_config->{"block_size"} = 15; # 4.0 - $pa_config->{"max_queue_files"} = 500; - $pa_config->{"snmp_ignore_authfailure"} = 1; # 5.0 - $pa_config->{"snmp_pdu_address"} = 0; # 5.0 - $pa_config->{"snmp_storm_protection"} = 0; # 5.0 - $pa_config->{"snmp_storm_timeout"} = 600; # 5.0 - $pa_config->{"snmp_delay"} = 0; # > 6.0SP3 - $pa_config->{"snmpconsole_threads"} = 1; # 5.1 - $pa_config->{"translate_variable_bindings"} = 0; # 5.1 - $pa_config->{"translate_enterprise_strings"} = 1; # 5.1 - $pa_config->{"syncserver"} = 0; # 7.0 - $pa_config->{"sync_address"} = ''; # 7.0 - $pa_config->{"sync_block_size"} = 65535; # 7.0 - $pa_config->{"sync_ca"} = ''; # 7.0 - $pa_config->{"sync_cert"} = ''; # 7.0 - $pa_config->{"sync_key"} = ''; # 7.0 - $pa_config->{"sync_port"} = '41121'; # 7.0 - $pa_config->{"sync_retries"} = 2; # 7.0 - $pa_config->{"sync_timeout"} = 5; # 7.0 - $pa_config->{"dynamic_updates"} = 5; # 7.0 - $pa_config->{"dynamic_warning"} = 25; # 7.0 - $pa_config->{"dynamic_constant"} = 10; # 7.0 - - # Internal MTA for alerts, each server need its own config. - $pa_config->{"mta_address"} = '127.0.0.1'; # Introduced on 2.0 - $pa_config->{"mta_port"} = '25'; # Introduced on 2.0 - $pa_config->{"mta_user"} = ''; # Introduced on 2.0 - $pa_config->{"mta_pass"} = ''; # Introduced on 2.0 - $pa_config->{"mta_auth"} = 'none'; # Introduced on 2.0 (Support LOGIN PLAIN CRAM-MD5 DIGEST-MD) - $pa_config->{"mta_from"} = 'pandora@localhost'; # Introduced on 2.0 - $pa_config->{"mail_in_separate"} = 1; # 1: eMail deliver alert mail in separate mails. - # 0: eMail deliver 1 mail with all destination. - - # nmap for recon OS fingerprinting and tcpscan (optional) - $pa_config->{"nmap"} = "/usr/bin/nmap"; - $pa_config->{"nmap_timing_template"} = 2; # > 5.1 - $pa_config->{"recon_timing_template"} = 3; # > 5.1 - - $pa_config->{"fping"} = "/usr/sbin/fping"; # > 5.1SP2 - - # braa for enterprise snmp server - $pa_config->{"braa"} = "/usr/bin/braa"; - - # SNMP enterprise retries (for braa) - $pa_config->{"braa_retries"} = 3; # 5.0 - - # Xprobe2 for recon OS fingerprinting and tcpscan (optional) - $pa_config->{"xprobe2"} = "/usr/bin/xprobe2"; - - - # Snmpget for snmpget system command (optional) - $pa_config->{"snmpget"} = "/usr/bin/snmpget"; - - $pa_config->{'autocreate_group'} = -1; - $pa_config->{'autocreate'} = 1; - - # max log size (bytes) - $pa_config->{'max_log_size'} = 1048576; - - # max log generation - $pa_config->{'max_log_generation'} = 1; - - # Ignore the timestamp in the XML and use the file timestamp instead - $pa_config->{'use_xml_timestamp'} = 0; - - # Server restart delay in seconds - $pa_config->{'restart_delay'} = 60; - - # Auto restart every x seconds - $pa_config->{'auto_restart'} = 0; - - # Restart server on error - $pa_config->{'restart'} = 0; - - # Self monitoring - $pa_config->{'self_monitoring'} = 0; - - # Self monitoring interval - $pa_config->{'self_monitoring_interval'} = 300; # 5.1SP1 - - # Process XML data files as a stack - $pa_config->{"dataserver_lifo"} = 0; # 5.0 - - # Patrol process of policies queue - $pa_config->{"policy_manager"} = 0; # 5.0 - - # Event replication process - $pa_config->{"event_replication"} = 0; # 5.0 - - # Event auto-validation - $pa_config->{"event_auto_validation"} = 1; # 5.0 - - # Export events to a text file - $pa_config->{"event_file"} = ''; # 5.0 - - # Default event messages - $pa_config->{"text_going_down_normal"} = "Module '_module_' is going to NORMAL (_data_)"; # 5.0 - $pa_config->{"text_going_up_critical"} = "Module '_module_' is going to CRITICAL (_data_)"; # 5.0 - $pa_config->{"text_going_up_warning"} = "Module '_module_' is going to WARNING (_data_)"; # 5.0 - $pa_config->{"text_going_down_warning"} = "Module '_module_' is going to WARNING (_data_)"; # 5.0 - $pa_config->{"text_going_unknown"} = "Module '_module_' is going to UNKNOWN"; # 5.0 - - # Event auto-expiry time - $pa_config->{"event_expiry_time"} = 0; # 5.0 - - # Event auto-expiry time window - $pa_config->{"event_expiry_window"} = 86400; # 5.0 - - # Event auto-expiry time window - $pa_config->{"claim_back_snmp_modules"} = 1; # 5.1 - - # Auto-recovery of asynchronous modules. - $pa_config->{"async_recovery"} = 1; # 5.1SP1 - - # Console API connection - $pa_config->{"console_api_url"} = 'http://localhost/pandora_console/include/api.php'; # 6.0 - $pa_config->{"console_api_pass"} = ''; # 6.0 - $pa_config->{"console_user"} = 'admin'; # 6.0 - $pa_config->{"console_pass"} = 'pandora'; # 6.0 - - # Database password encryption passphrase - $pa_config->{"encryption_passphrase"} = ''; # 6.0 - - # Unknown interval (as a multiple of the module's interval) - $pa_config->{"unknown_interval"} = 2; # > 5.1SP2 - - # ------------------------------------------------------------------------- - # This values are not stored in .conf files. - # This values should be stored in database, not in .conf files! - # Default values are set here because if they are not present in config DB - # don't get an error later. - $pa_config->{"realtimestats"} = 0; - $pa_config->{"stats_interval"} = 300; - $pa_config->{"agentaccess"} = 1; - $pa_config->{"event_storm_protection"} = 0; - $pa_config->{"node_metaconsole"} = 0; # > 7.0NG - # ------------------------------------------------------------------------- - - #SNMP Forwarding tokens - $pa_config->{"snmp_forward_trap"}=0; - $pa_config->{"snmp_forward_secName"}= ''; - $pa_config->{"snmp_forward_engineid"}= ''; - $pa_config->{"snmp_forward_authProtocol"}= ''; - $pa_config->{"snmp_forward_authPassword"}= ''; - $pa_config->{"snmp_forward_community"}= 'public'; - $pa_config->{"snmp_forward_privProtocol"}= ''; - $pa_config->{"snmp_forward_privPassword"}= ''; - $pa_config->{"snmp_forward_secLevel"}= ''; - $pa_config->{"snmp_forward_version"}= 2; - $pa_config->{"snmp_forward_ip"}= ''; - - # Global Timeout for Custom Commands Alerts - $pa_config->{"global_alert_timeout"}= 15; # 6.0 - - # Server Remote Config - $pa_config->{"remote_config"}= 0; # 6.0 - - # Remote config server address - $pa_config->{"remote_config_address"} = 'localhost'; # 6.0 - - # Remote config server port - $pa_config->{"remote_config_port"} = 41121; # 6.0 - - # Remote config server options - $pa_config->{"remote_config_opts"} = ''; # 6.0 - - # Temp path for file sendinn and receiving - $pa_config->{"temporal"} = '/tmp'; # 6.0 - - # Warmup intervals. - $pa_config->{"warmup_alert_interval"} = 0; # 6.1 - $pa_config->{"warmup_alert_on"} = 0; # 6.1 - $pa_config->{"warmup_event_interval"} = 0; # 6.1 - $pa_config->{"warmup_event_on"} = 0; # 6.1 - $pa_config->{"warmup_unknown_interval"} = 300; # 6.1 - $pa_config->{"warmup_unknown_on"} = 1; # 6.1 - - #$pa_config->{'include_agents'} = 0; #6.1 - # - # External .enc files for XML::Parser. - $pa_config->{"enc_dir"} = ""; # > 6.0SP4 - - # Enable (1) or disable (0) events related to the unknown status. - $pa_config->{"unknown_events"} = 1; # > 6.0SP4 - - # Check for UID0 - if ($pa_config->{"quiet"} != 0){ - if ($> == 0){ - printf " [W] Not all Pandora FMS components need to be executed as root\n"; - printf " please consider starting it with a non-privileged user.\n"; - } - } - - # Check for file - if ( ! -f $archivo_cfg ) { - printf "\n [ERROR] Cannot open configuration file at $archivo_cfg. \n"; - printf " Please specify a valid Pandora FMS configuration file in command line. \n"; - print " Standard configuration file is at /etc/pandora/pandora_server.conf \n"; - exit 1; - } - - # Collect items from config file and put in an array - if (! open (CFG, "< $archivo_cfg")) { - print "[ERROR] Error opening configuration file $archivo_cfg: $!.\n"; - exit 1; - } - - while (){ - $buffer_line = $_; - if ($buffer_line =~ /^[a-zA-Z]/){ # begins with letters - if ($buffer_line =~ m/([\w\-\_\.]+)\s([0-9\w\-\_\.\/\?\&\=\)\(\_\-\!\*\@\#\%\$\~\"\']+)/){ - push @command_line, $buffer_line; - } - } - } - close (CFG); - - # Process this array with commandline like options - # Process input parameters - - my @args = @command_line; - my $parametro; - my $ltotal=$#args; - my $ax; - - # Has read setup file ok ? - if ( $ltotal == 0 ) { - print "[ERROR] No valid setup tokens readed in $archivo_cfg "; - exit; - } - - for ($ax=0;$ax<=$ltotal;$ax++){ - $parametro = $args[$ax]; - - if ($parametro =~ m/^incomingdir\s(.*)/i) { - $tbuf= clean_blank($1); - if ($tbuf =~ m/^\.(.*)/){ - $pa_config->{"incomingdir"} =$pa_config->{"basepath"}.$1; - } else { - $pa_config->{"incomingdir"} = $tbuf; - } - } - - elsif ($parametro =~ m/^log_file\s(.*)/i) { - $tbuf= clean_blank($1); - if ($tbuf =~ m/^\.(.*)/){ - $pa_config->{"log_file"} = $pa_config->{"basepath"}.$1; - } else { - $pa_config->{"log_file"} = $tbuf; - } - } - - elsif ($parametro =~ m/^errorlog_file\s(.*)/i) { - $tbuf= clean_blank($1); - if ($tbuf =~ m/^\.(.*)/){ - $pa_config->{"errorlog_file"} = $pa_config->{"basepath"}.$1; - } else { - $pa_config->{"errorlog_file"} = $tbuf; - } - } - - # MTA setup (2.0) - elsif ($parametro =~ m/^mta_user\s(.*)/i) { - $pa_config->{'mta_user'}= clean_blank($1); - } - elsif ($parametro =~ m/^mta_pass\s(.*)/i) { - $pa_config->{'mta_pass'}= clean_blank($1); - } - elsif ($parametro =~ m/^mta_address\s(.*)/i) { - $pa_config->{'mta_address'}= clean_blank($1); - } - elsif ($parametro =~ m/^mta_port\s(.*)/i) { - $pa_config->{'mta_port'}= clean_blank($1); - } - elsif ($parametro =~ m/^mta_auth\s(.*)/i) { - $pa_config->{'mta_auth'}= clean_blank($1); - } - elsif ($parametro =~ m/^mta_from\s(.*)/i) { - $pa_config->{'mta_from'}= clean_blank($1); - } - elsif ($parametro =~ m/^mail_in_separate\s+([0-9]*)/i) { - $pa_config->{'mail_in_separate'}= clean_blank($1); - } - elsif ($parametro =~ m/^snmp_logfile\s(.*)/i) { - $pa_config->{'snmp_logfile'}= clean_blank($1); - } - elsif ($parametro =~ m/^snmp_ignore_authfailure\s+([0-1])/i) { - $pa_config->{'snmp_ignore_authfailure'}= clean_blank($1); - } - elsif ($parametro =~ m/^snmp_pdu_address\s+([0-1])/i) { - $pa_config->{'snmp_pdu_address'}= clean_blank($1); - } - elsif ($parametro =~ m/^snmp_storm_protection\s+(\d+)/i) { - $pa_config->{'snmp_storm_protection'}= clean_blank($1); - } - elsif ($parametro =~ m/^snmp_storm_timeout\s+(\d+)/i) { - $pa_config->{'snmp_storm_timeout'}= clean_blank($1); - } - elsif ($parametro =~ m/^snmp_delay\s+(\d+)/i) { - $pa_config->{'snmp_delay'}= clean_blank($1); - } - elsif ($parametro =~ m/^snmpconsole_threads\s+(\d+)/i) { - $pa_config->{'snmpconsole_threads'}= clean_blank($1); - } - elsif ($parametro =~ m/^translate_variable_bindings\s+([0-1])/i) { - $pa_config->{'translate_variable_bindings'}= clean_blank($1); - } - elsif ($parametro =~ m/^translate_enterprise_strings\s+([0-1])/i) { - $pa_config->{'translate_enterprise_strings'}= clean_blank($1); - } - elsif ($parametro =~ m/^user\s(.*)/i) { - $pa_config->{'user'}= clean_blank($1); - } - elsif ($parametro =~ m/^group\s(.*)/i) { - $pa_config->{'group'}= clean_blank($1); - } - elsif ($parametro =~ m/^umask\s(.*)/i) { - $pa_config->{'umask'}= clean_blank($1); - } - elsif ($parametro =~ m/^dbengine\s(.*)/i) { - $pa_config->{'dbengine'}= clean_blank($1); - } - elsif ($parametro =~ m/^dbname\s(.*)/i) { - $pa_config->{'dbname'}= clean_blank($1); - } - elsif ($parametro =~ m/^dbuser\s(.*)/i) { - $pa_config->{'dbuser'}= clean_blank($1); - } - elsif ($parametro =~ m/^dbpass\s(.*)/i) { - $pa_config->{'dbpass'}= clean_blank($1); - } - elsif ($parametro =~ m/^dbhost\s(.*)/i) { - $pa_config->{'dbhost'}= clean_blank($1); - } - elsif ($parametro =~ m/^dbport\s(.*)/i) { - $pa_config->{'dbport'}= clean_blank($1); - } - elsif ($parametro =~ m/^daemon\s+([0-9]*)/i) { - $pa_config->{'daemon'}= clean_blank($1); - } - elsif ($parametro =~ m/^dataserver\s+([0-9]*)/i){ - $pa_config->{'dataserver'}= clean_blank($1); - } - elsif ($parametro =~ m/^networkserver\s+([0-9]*)/i){ - $pa_config->{'networkserver'}= clean_blank($1); - } - elsif ($parametro =~ m/^pluginserver\s+([0-9]*)/i){ - $pa_config->{'pluginserver'}= clean_blank($1); - } - elsif ($parametro =~ m/^predictionserver\s+([0-9]*)/i){ - $pa_config->{'predictionserver'}= clean_blank($1); - } - elsif ($parametro =~ m/^reconserver\s+([0-9]*)/i) { - $pa_config->{'reconserver'}= clean_blank($1); - } - elsif ($parametro =~ m/^reconserver\s+([0-9]*)/i) { - $pa_config->{'reconserver'}= clean_blank($1); - } - elsif ($parametro =~ m/^wmiserver\s+([0-9]*)/i) { - $pa_config->{'wmiserver'}= clean_blank($1); - } - elsif ($parametro =~ m/^exportserver\s+([0-9]*)/i) { - $pa_config->{'exportserver'}= clean_blank($1); - } - elsif ($parametro =~ m/^inventoryserver\s+([0-9]*)/i) { - $pa_config->{'inventoryserver'}= clean_blank($1); - } - elsif ($parametro =~ m/^webserver\s+([0-9]*)/i) { - $pa_config->{'webserver'}= clean_blank($1); - } - elsif ($parametro =~ m/^transactionalserver\s+([0-9]*)/i) { - $pa_config->{'transactionalserver'}= clean_blank($1); - } - elsif ($parametro =~ m/^transactional_threads\s+([0-9]*)/i) { - $pa_config->{'transactional_threads'}= clean_blank($1); - } - elsif ($parametro =~ m/^transactional_threshold\s+([0-9]*\.{0,1}[0-9]*)/i) { - $pa_config->{'transactional_threshold'}= clean_blank($1); - } - if ($parametro =~ m/^transactional_pool\s(.*)/i) { - $tbuf= clean_blank($1); - if ($tbuf =~ m/^\.(.*)/){ - $pa_config->{"transactional_pool"} = $pa_config->{"incomingdir"} . "/" . $1; - } else { - $pa_config->{"transactional_pool"} = $pa_config->{"incomingdir"} . "/" . $tbuf; - } - } - elsif ($parametro =~ m/^eventserver\s+([0-9]*)/i) { - $pa_config->{'eventserver'}= clean_blank($1); - } - elsif ($parametro =~ m/^icmpserver\s+([0-9]*)/i) { - $pa_config->{'icmpserver'}= clean_blank($1); - } - elsif ($parametro =~ m/^icmp_threads\s+([0-9]*)/i) { - $pa_config->{'icmp_threads'}= clean_blank($1); - } - elsif ($parametro =~ m/^servername\s(.*)/i) { - $pa_config->{'servername'}= clean_blank($1); - } - elsif ($parametro =~ m/^checksum\s+([0-9])/i) { - $pa_config->{"pandora_check"} = clean_blank($1); - } - elsif ($parametro =~ m/^master\s+([0-9])/i) { - $pa_config->{"pandora_master"} = clean_blank($1); - } - elsif ($parametro =~ m/^icmp_checks\s+([0-9]*)/i) { - $pa_config->{"icmp_checks"} = clean_blank($1); - } - elsif ($parametro =~ m/^icmp_packets\s+([0-9]*)/i) { - $pa_config->{"icmp_packets"} = clean_blank($1); - } - elsif ($parametro =~ m/^snmpconsole\s+([0-9]*)/i) { - $pa_config->{"snmpconsole"} = clean_blank($1); - } - elsif ($parametro =~ m/^snmpserver\s+([0-9]*)/i) { - $pa_config->{"snmpserver"} = clean_blank($1); - } - elsif ($parametro =~ m/^alert_recovery\s+([0-9]*)/i) { - $pa_config->{"alert_recovery"} = clean_blank($1); - } - elsif ($parametro =~ m/^snmp_checks\s+([0-9]*)/i) { - $pa_config->{"snmp_checks"} = clean_blank($1); - } - elsif ($parametro =~ m/^snmp_timeout\s+([0-9]*)/i) { - $pa_config->{"snmp_timeout"} = clean_blank($1); - } - elsif ($parametro =~ m/^tcp_checks\s+([0-9]*)/i) { - $pa_config->{"tcp_checks"} = clean_blank($1); - } - elsif ($parametro =~ m/^tcp_timeout\s+([0-9]*)/i) { - $pa_config->{"tcp_timeout"} = clean_blank($1); - } - elsif ($parametro =~ m/^snmp_proc_deadresponse\s+([0-9]*)/i) { - $pa_config->{"snmp_proc_deadresponse"} = clean_blank($1); - } - elsif ($parametro =~ m/^verbosity\s+([0-9]*)/i) { - $pa_config->{"verbosity"} = clean_blank($1); - } - elsif ($parametro =~ m/^server_threshold\s+([0-9]*)/i) { - $pa_config->{"server_threshold"} = clean_blank($1); - } - elsif ($parametro =~ m/^alert_threshold\s+([0-9]*)/i) { - $pa_config->{"alert_threshold"} = clean_blank($1); - } - elsif ($parametro =~ m/^graph_precision\s+([0-9]*)/i) { - $pa_config->{"graph_precision"} = clean_blank($1); - } - elsif ($parametro =~ m/^network_timeout\s+([0-9]*)/i) { - $pa_config->{'networktimeout'}= clean_blank($1); - } - elsif ($parametro =~ m/^network_threads\s+([0-9]*)/i) { - $pa_config->{'network_threads'}= clean_blank($1); - } - elsif ($parametro =~ m/^plugin_threads\s+([0-9]*)/i) { - $pa_config->{'plugin_threads'}= clean_blank($1); - } - elsif ($parametro =~ m/^prediction_threads\s+([0-9]*)/i) { - $pa_config->{'prediction_threads'}= clean_blank($1); - } - elsif ($parametro =~ m/^plugin_timeout\s+([0-9]*)/i) { - $pa_config->{'plugin_timeout'}= clean_blank($1); - } - elsif ($parametro =~ m/^dataserver_threads\s+([0-9]*)/i) { - $pa_config->{'dataserver_threads'}= clean_blank($1); - } - elsif ($parametro =~ m/^server_keepalive\s+([0-9]*)/i) { - $pa_config->{"keepalive"} = clean_blank($1); - $pa_config->{"keepalive_orig"} = clean_blank($1); - } - elsif ($parametro =~ m/^nmap\s(.*)/i) { - $pa_config->{'nmap'}= clean_blank($1); - } - elsif ($parametro =~ m/^fping\s(.*)/i) { - $pa_config->{'fping'}= clean_blank($1); - } - elsif ($parametro =~ m/^nmap_timing_template\s+([0-9]*)/i) { - $pa_config->{'nmap_timing_template'}= clean_blank($1); - } - elsif ($parametro =~ m/^recon_timing_template\s+([0-9]*)/i) { - $pa_config->{'recon_timing_template'}= clean_blank($1); - } - elsif ($parametro =~ m/^braa\s(.*)/i) { - $pa_config->{'braa'}= clean_blank($1); - } - elsif ($parametro =~ m/^braa_retries\s+([0-9]*)/i) { - $pa_config->{"braa_retries"} = clean_blank($1); - } - elsif ($parametro =~ m/^xprobe2\s(.*)/i) { - $pa_config->{'xprobe2'}= clean_blank($1); - } - elsif ($parametro =~ m/^snmpget\s(.*)/i) { - $pa_config->{'snmpget'}= clean_blank($1); - } - elsif ($parametro =~ m/^autocreate\s+([0-9*]*)/i) { - $pa_config->{'autocreate'}= clean_blank($1); - } - elsif ($parametro =~ m/^autocreate_group\s+([0-9*]*)/i) { - $pa_config->{'autocreate_group'}= clean_blank($1); - } - elsif ($parametro =~ m/^recon_threads\s+([0-9]*)/i) { - $pa_config->{'recon_threads'}= clean_blank($1); - } - elsif ($parametro =~ m/^max_log_size\s+([0-9]*)/i) { - $pa_config->{'max_log_size'}= clean_blank($1); - } - elsif ($parametro =~ m/^max_log_generation\s+([1-9])/i) { - $pa_config->{'max_log_generation'}= clean_blank($1); - } - elsif ($parametro =~ m/^wmi_threads\s+([0-9]*)/i) { - $pa_config->{'wmi_threads'}= clean_blank($1); - } - elsif ($parametro =~ m/^wmi_client\s(.*)/i) { - $pa_config->{'wmi_client'}= clean_blank($1); - } - elsif ($parametro =~ m/^web_threads\s+([0-9]*)/i) { - $pa_config->{'web_threads'}= clean_blank($1); - } - elsif ($parametro =~ m/^web_engine\s(.*)/i) { - $pa_config->{'web_engine'}= clean_blank($1); - } - elsif ($parametro =~ m/^snmp_trapd\s(.*)/i) { - $pa_config->{'snmp_trapd'}= clean_blank($1); - } - elsif ($parametro =~ m/^plugin_exec\s(.*)/i) { - $pa_config->{'plugin_exec'}= clean_blank($1); - } - elsif ($parametro =~ m/^inventory_threads\s+([0-9]*)/i) { - $pa_config->{'inventory_threads'}= clean_blank($1); - } - elsif ($parametro =~ m/^export_threads\s+([0-9]*)/i) { - $pa_config->{'export_threads'}= clean_blank($1); - } - elsif ($parametro =~ m/^max_queue_files\s+([0-9]*)/i) { - $pa_config->{'max_queue_files'}= clean_blank($1); - } - elsif ($parametro =~ m/^use_xml_timestamp\s+([0-1])/i) { - $pa_config->{'use_xml_timestamp'} = clean_blank($1); - } - elsif ($parametro =~ m/^restart_delay\s+(\d+)/i) { - $pa_config->{'restart_delay'} = clean_blank($1); - } - elsif ($parametro =~ m/^auto_restart\s+(\d+)/i) { - $pa_config->{'auto_restart'} = clean_blank($1); - } - elsif ($parametro =~ m/^restart\s+([0-1])/i) { - $pa_config->{'restart'} = clean_blank($1); - } - elsif ($parametro =~ m/^google_maps_description\s+([0-1])/i) { - $pa_config->{'google_maps_description'} = clean_blank($1); - } - elsif ($parametro =~ m/^openstreetmaps_description\s+([0-1])/i) { - $pa_config->{'openstreetmaps_description'} = clean_blank($1); - } - elsif ($parametro =~ m/^activate_gis\s+([0-1])/i) { - $pa_config->{'activate_gis'} = clean_blank($1); - } - elsif ($parametro =~ m/^location_error\s+(\d+)/i) { - $pa_config->{'location_error'} = clean_blank($1); - } - elsif ($parametro =~ m/^recon_reverse_geolocation_mode\s+(\w+)/i) { - $pa_config->{'recon_reverse_geolocation_mode'} = clean_blank($1); - } #FIXME: Find a better regexp to validate the path - elsif ($parametro =~ m/^recon_reverse_geolocation_file\s+(.*)/i) { - $pa_config->{'recon_reverse_geolocation_file'} = clean_blank($1); - } - elsif ($parametro =~ m/^recon_location_scatter_radius\s+(\d+)/i) { - $pa_config->{'recon_location_scatter_radius'} = clean_blank($1); - } - elsif ($parametro =~ m/^self_monitoring\s+([0-1])/i) { - $pa_config->{'self_monitoring'} = clean_blank($1); - } - elsif ($parametro =~ m/^self_monitoring_interval\s+([0-9]*)/i) { - $pa_config->{'self_monitoring_interval'} = clean_blank($1); - } - elsif ($parametro =~ m/^update_parent\s+([0-1])/i) { - $pa_config->{'update_parent'} = clean_blank($1); - } - elsif ($parametro =~ m/^event_window\s+([0-9]*)/i) { - $pa_config->{'event_window'}= clean_blank($1); - } - elsif ($parametro =~ m/^snmp_threads\s+([0-9]*)/i) { - $pa_config->{'snmp_threads'}= clean_blank($1); - } - elsif ($parametro =~ m/^block_size\s+([0-9]*)/i) { - $pa_config->{'block_size'}= clean_blank($1); - } - elsif ($parametro =~ m/^dataserver_lifo\s+([0-1])/i) { - $pa_config->{'dataserver_lifo'}= clean_blank($1); - } - elsif ($parametro =~ m/^policy_manager\s+([0-1])/i) { - $pa_config->{'policy_manager'}= clean_blank($1); - } - elsif ($parametro =~ m/^event_replication\s+([0-1])/i) { - $pa_config->{'event_replication'}= clean_blank($1); - } - elsif ($parametro =~ m/^event_auto_validation\s+([0-1])/i) { - $pa_config->{'event_auto_validation'}= clean_blank($1); - } - elsif ($parametro =~ m/^event_file\s+(.*)/i) { - $pa_config->{'event_file'}= clean_blank($1); - } - elsif ($parametro =~ m/^text_going_down_normal\s+(.*)/i) { - $pa_config->{'text_going_down_normal'} = safe_input ($1); - } - elsif ($parametro =~ m/^text_going_up_critical\s+(.*)/i) { - $pa_config->{'text_going_up_critical'} = safe_input ($1); - } - elsif ($parametro =~ m/^text_going_up_warning\s+(.*)/i) { - $pa_config->{'text_going_up_warning'} = safe_input ($1); - } - elsif ($parametro =~ m/^text_going_down_warning\s+(.*)/i) { - $pa_config->{'text_going_down_warning'} = safe_input ($1); - } - elsif ($parametro =~ m/^text_going_unknown\s+(.*)/i) { - $pa_config->{'text_going_unknown'} = safe_input ($1); - } - elsif ($parametro =~ m/^event_expiry_time\s+([0-9]*)/i) { - $pa_config->{'event_expiry_time'}= clean_blank($1); - } - elsif ($parametro =~ m/^event_expiry_window\s+([0-9]*)/i) { - $pa_config->{'event_expiry_window'}= clean_blank($1); - } - elsif ($parametro =~ m/^snmp_forward_trap\s+([0-1])/i) { - $pa_config->{'snmp_forward_trap'}= clean_blank($1); - } - elsif ($parametro =~ m/^snmp_forward_secName\s(.*)/i) { - $pa_config->{'snmp_forward_secName'}= safe_input(clean_blank($1)); - } - elsif ($parametro =~ m/^snmp_forward_engineid\s(.*)/i) { - $pa_config->{'snmp_forward_engineid'}= safe_input(clean_blank($1)); - } - elsif ($parametro =~ m/^snmp_forward_authProtocol\s(.*)/i) { - $pa_config->{'snmp_forward_authProtocol'}= safe_input(clean_blank($1)); - } - elsif ($parametro =~ m/^snmp_forward_authPassword\s(.*)/i) { - $pa_config->{'snmp_forward_authPassword'}= safe_input(clean_blank($1)); - } - elsif ($parametro =~ m/^snmp_forward_community\s(.*)/i) { - $pa_config->{'snmp_forward_community'}= safe_input(clean_blank($1)); - } - elsif ($parametro =~ m/^snmp_forward_privProtocol\s(.*)/i) { - $pa_config->{'snmp_forward_privProtocol'}= safe_input(clean_blank($1)); - } - elsif ($parametro =~ m/^snmp_forward_privPassword\s(.*)/i) { - $pa_config->{'snmp_forward_privPassword'}= safe_input(clean_blank($1)); - } - elsif ($parametro =~ m/^snmp_forward_secLevel\s(.*)/i) { - $pa_config->{'snmp_forward_secLevel'}= safe_input(clean_blank($1)); - } - elsif ($parametro =~ m/^snmp_forward_version\s(.*)/i) { - $pa_config->{'snmp_forward_version'}= safe_input(clean_blank($1)); - } - elsif ($parametro =~ m/^snmp_forward_ip\s(.*)/i) { - $pa_config->{'snmp_forward_ip'}= safe_input(clean_blank($1)); - if ($pa_config->{'snmp_forward_trap'}==1 && ($pa_config->{'snmp_forward_ip'} eq '127.0.0.1' || $pa_config->{'snmp_forward_ip'} eq 'localhost')) { - printf "\n [ERROR] Cannot set snmp_forward_ip to localhost or 127.0.0.1 \n"; - exit 1; - - } - } - elsif ($parametro =~ m/^claim_back_snmp_modules\s(.*)/i) { - $pa_config->{'claim_back_snmp_modules'}= safe_input(clean_blank($1)); - } - elsif ($parametro =~ m/^async_recovery\s+([0-1])/i) { - $pa_config->{'async_recovery'}= clean_blank($1); - } - elsif ($parametro =~ m/^console_api_url\s(.*)/i) { - $pa_config->{'console_api_url'}= safe_input(clean_blank($1)); - } - elsif ($parametro =~ m/^console_api_pass\s(.*)/i) { - $pa_config->{'console_api_pass'}= safe_input(clean_blank($1)); - } - elsif ($parametro =~ m/^console_user\s(.*)/i) { - $pa_config->{'console_user'}= safe_input(clean_blank($1)); - } - elsif ($parametro =~ m/^console_pass\s(.*)/i) { - $pa_config->{'console_pass'}= safe_input(clean_blank($1)); - } - elsif ($parametro =~ m/^encryption_passphrase\s(.*)/i) { # 6.0 - $pa_config->{'encryption_passphrase'}= safe_input(clean_blank($1)); - } - elsif ($parametro =~ m/^unknown_interval\s+([0-9]*)/i) { # > 5.1SP2 - $pa_config->{'unknown_interval'}= clean_blank($1); - } - elsif ($parametro =~ m/^global_alert_timeout\s+([0-9]*)/i) { - $pa_config->{'global_alert_timeout'}= clean_blank($1); - } - elsif ($parametro =~ m/^remote_config\s+([0-9]*)/i) { - $pa_config->{'remote_config'}= clean_blank($1); - } - elsif ($parametro =~ m/^remote_config_address\s(.*)/i) { - $pa_config->{'remote_config_address'}= clean_blank($1); - } - elsif ($parametro =~ m/^remote_config_port\s+([0-9]*)/i) { - $pa_config->{'remote_config_port'}= clean_blank($1); - } - elsif ($parametro =~ m/^remote_config_opts\s(.*)/i) { - $pa_config->{'remote_config_opts'}= clean_blank($1); - } - elsif ($parametro =~ m/^temporal\s(.*)/i) { - $pa_config->{'temporal'}= clean_blank($1); - } - elsif ($parametro =~ m/^warmup_event_interval\s+([0-9]*)/i || - $parametro =~ m/^warmup_alert_interval\s+([0-9]*)/i) { - $pa_config->{'warmup_event_interval'}= clean_blank($1); - $pa_config->{'warmup_event_on'} = 1 if ($pa_config->{'warmup_event_interval'} > 0); # Off by default. - # The same interval is used for alerts and events. - $pa_config->{'warmup_alert_interval'}= clean_blank($1); - $pa_config->{'warmup_alert_on'} = 1 if ($pa_config->{'warmup_event_interval'} > 0); # Off by default. - } - elsif ($parametro =~ m/^warmup_unknown_interval\s+([0-9]*)/i) { - $pa_config->{'warmup_unknown_interval'}= clean_blank($1); - $pa_config->{'warmup_unknown_on'} = 0 if ($pa_config->{'warmup_unknown_interval'} == 0); # On by default. - } - #elsif ($parametro =~ m/^include_agents\s+([0-1])/i) { - # $pa_config->{'include_agents'}= clean_blank($1); - #} - elsif ($parametro =~ m/^enc_dir\s+(.*)/i) { - $pa_config->{'enc_dir'} = clean_blank($1); - } - elsif ($parametro =~ m/^unknown_events\s+([0-1])/i) { - $pa_config->{'unknown_events'} = clean_blank($1); - } - elsif ($parametro =~ m/^syncserver\s+([0-9]*)/i) { - $pa_config->{'syncserver'}= clean_blank($1); - } - elsif ($parametro =~ m/^sync_address\s+(.*)/i) { - $pa_config->{'sync_address'}= clean_blank($1); - } - elsif ($parametro =~ m/^sync_block_size\s+([0-9]*)/i) { - $pa_config->{'sync_block_size'}= clean_blank($1); - } - elsif ($parametro =~ m/^sync_ca\s+(.*)/i) { - $pa_config->{'sync_ca'}= clean_blank($1); - } - elsif ($parametro =~ m/^sync_cert\s+(.*)/i) { - $pa_config->{'sync_cert'}= clean_blank($1); - } - elsif ($parametro =~ m/^sync_key\s+(.*)/i) { - $pa_config->{'sync_key'}= clean_blank($1); - } - elsif ($parametro =~ m/^sync_port\s+([0-9]*)/i) { - $pa_config->{'sync_port'}= clean_blank($1); - } - elsif ($parametro =~ m/^sync_timeout\s+([0-9]*)/i) { - $pa_config->{'sync_timeout'}= clean_blank($1); - } - elsif ($parametro =~ m/^sync_retries\s+([0-9]*)/i) { - $pa_config->{'sync_retries'}= clean_blank($1); - } - elsif ($parametro =~ m/^dynamic_updates\s+([0-9]*)/i) { - $pa_config->{'dynamic_updates'}= clean_blank($1); - } - elsif ($parametro =~ m/^dynamic_warning\s+([0-9]*)/i) { - $pa_config->{'dynamic_warning'}= clean_blank($1); - } - elsif ($parametro =~ m/^dynamic_constant\s+([0-9]*)/i) { - $pa_config->{'dynamic_constant'}= clean_blank($1); - } - } # end of loop for parameter # - - # Set to RDBMS' standard port - if (!defined($pa_config->{'dbport'})) { - if ($pa_config->{'dbengine'} eq "mysql") { - $pa_config->{'dbport'} = 3306; - } - elsif ($pa_config->{'dbengine'} eq "postgresql") { - $pa_config->{'dbport'} = 5432; - } - elsif ($pa_config->{'dbengine'} eq "oracle") { - $pa_config->{'dbport'} = 1521; - } - } - - if (($pa_config->{"verbosity"} > 4) && ($pa_config->{"quiet"} == 0)){ - if ($pa_config->{"PID"} ne ""){ - print " [*] PID File is written at ".$pa_config->{'PID'}."\n"; - } - print " [*] Server basepath is ".$pa_config->{'basepath'}."\n"; - print " [*] Server logfile at ".$pa_config->{"log_file"}."\n"; - print " [*] Server errorlogfile at ".$pa_config->{"errorlog_file"}."\n"; - print " [*] Server incoming directory at ".$pa_config->{"incomingdir"}."\n"; - print " [*] Server keepalive ".$pa_config->{"keepalive"}."\n"; - print " [*] Server threshold ".$pa_config->{"server_threshold"}."\n"; - } - # Check for valid token token values - if (( $pa_config->{"dbuser"} eq "" ) || ( $pa_config->{"basepath"} eq "" ) || ( $pa_config->{"incomingdir"} eq "" ) || ( $pa_config->{"log_file"} eq "" ) || ( $pa_config->{"dbhost"} eq "") || ( $pa_config->{"pandora_master"} eq "") || ( $pa_config->{"dbpass"} eq "" ) ) { - print " [ERROR] Bad Config values. Be sure that $archivo_cfg is a valid setup file. \n\n"; - exit; - } - - if (($pa_config->{"quiet"} == 0) && ($pa_config->{"verbosity"} > 4)) { - if ($pa_config->{"pandora_check"} == 1) { - print " [*] MD5 Security enabled.\n"; - } - if ($pa_config->{"pandora_master"} != 0) { - print " [*] This server is running with MASTER priority " . $pa_config->{"pandora_master"} . "\n"; - } - } - - logger ($pa_config, "Launching $pa_config->{'version'} $pa_config->{'build'}", 1); - my $config_options = "Logfile at ".$pa_config->{"log_file"}.", Basepath is ".$pa_config->{"basepath"}.", Checksum is ".$pa_config->{"pandora_check"}.", Master is ".$pa_config->{"pandora_master"}.", SNMP Console is ".$pa_config->{"snmpconsole"}.", Server Threshold at ".$pa_config->{"server_threshold"}." sec, verbosity at ".$pa_config->{"verbosity"}.", Alert Threshold at $pa_config->{'alert_threshold'}, ServerName is '".$pa_config->{'servername'}."'"; - logger ($pa_config, "Config options: $config_options", 1); -} - - -########################################################################## -# Open the log file and start logging. -########################################################################## -sub pandora_start_log ($){ - my $pa_config = shift; - - # Dump all errors to errorlog - open (STDERR, ">> " . $pa_config->{'errorlog_file'}) or die " [ERROR] Pandora FMS can't write to Errorlog. Aborting : \n $! \n"; - print STDERR strftime ("%Y-%m-%d %H:%M:%S", localtime()) . ' - ' . $pa_config->{'servername'} . " Starting Pandora FMS Server. Error logging activated.\n"; -} - -########################################################################## -# Read the given token from the tconfig table. -########################################################################## -sub pandora_get_tconfig_token ($$$) { - my ($dbh, $token, $default_value) = @_; - - my $token_value = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = ?", $token); - if (defined ($token_value)) { - return safe_output ($token_value); - } - - return $default_value; -} - -# End of function declaration -# End of defined Code - -1; -__END__ diff --git a/pandora_server/pandora_server.redhat.spec.orig b/pandora_server/pandora_server.redhat.spec.orig deleted file mode 100644 index a91d2d3c51..0000000000 --- a/pandora_server/pandora_server.redhat.spec.orig +++ /dev/null @@ -1,188 +0,0 @@ -# -# Pandora FMS Server -# -%define name pandorafms_server -%define version 7.0NG -<<<<<<< HEAD -%define release 170406 -======= -%define release 170418 ->>>>>>> develop - -Summary: Pandora FMS Server -Name: %{name} -Version: %{version} -Release: %{release} -License: GPL -Vendor: ArticaST -Source0: %{name}-%{version}.tar.gz -URL: http://www.pandorafms.com -Group: System/Monitoring -Packager: Sancho Lerena -Prefix: %{_datadir} -BuildRoot: %{_tmppath}/%{name}-buildroot -BuildArchitectures: noarch -AutoReq: 0 -Provides: %{name}-%{version} -Requires(pre): shadow-utils -Requires(post,preun): /sbin/chkconfig /sbin/service -Requires: coreutils -Requires: perl(DBI) perl(DBD::mysql) -Requires: perl(HTTP::Request::Common) perl(LWP::Simple) perl(LWP::UserAgent) -Requires: perl(XML::Simple) perl(XML::Twig) net-snmp-utils -Requires: perl(NetAddr::IP) net-snmp net-tools -Requires: perl(IO::Socket::INET6) perl(Net::Telnet) -Requires: nmap sudo perl(JSON) -Requires: perl(Time::HiRes) perl(Encode::Locale) -Requires: perl perl(Sys::Syslog) perl(HTML::Entities) - -%description -Pandora FMS is a monitoring system for big IT environments. It uses remote tests, or local agents to grab information. Pandora supports all standard OS (Linux, AIX, HP-UX, Solaris and Windows XP,2000/2003), and support multiple setups in HA enviroments. - -%prep -rm -rf $RPM_BUILD_ROOT - -%setup -q -n pandora_server - -%build - -%install - -rm -rf $RPM_BUILD_ROOT -mkdir -p $RPM_BUILD_ROOT%{_bindir}/ -mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/ -mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/pandora/ -mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in -mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/conf -mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/md5 -mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/collections -mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/netflow -mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log/pandora/ -mkdir -p $RPM_BUILD_ROOT%{prefix}/pandora_server/conf/ -mkdir -p $RPM_BUILD_ROOT%{_mandir}/man1/ -mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/ -mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/cron.hourly/ -mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/lib/pandora/.ssh -mkdir -p $RPM_BUILD_ROOT/usr/lib/perl5/ - -# All binaries go to %{_bindir} -cp -aRf bin/pandora_server $RPM_BUILD_ROOT%{_bindir}/ -cp -aRf bin/pandora_exec $RPM_BUILD_ROOT%{_bindir}/ -install -m 0755 bin/tentacle_server $RPM_BUILD_ROOT%{_bindir}/ - -cp -aRf conf/* $RPM_BUILD_ROOT%{prefix}/pandora_server/conf/ -cp -aRf util $RPM_BUILD_ROOT%{prefix}/pandora_server/ -cp -aRf lib/* $RPM_BUILD_ROOT/usr/lib/perl5/ - -install -m 0755 util/pandora_server $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/ -install -m 0755 util/tentacle_serverd $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/ - -install -m 0444 man/man1/pandora_server.1.gz $RPM_BUILD_ROOT%{_mandir}/man1/ -install -m 0444 man/man1/tentacle_server.1.gz $RPM_BUILD_ROOT%{_mandir}/man1/ - -rm -f $RPM_BUILD_ROOT%{prefix}/pandora_server/util/PandoraFMS -rm -f $RPM_BUILD_ROOT%{prefix}/pandora_server/util/recon_scripts/PandoraFMS - -install -m 0644 util/pandora_server_logrotate $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/pandora_server -install -m 0640 conf/pandora_server.conf.new $RPM_BUILD_ROOT%{_sysconfdir}/pandora/pandora_server.conf.new - -mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sudoers.d -chmod 0750 $RPM_BUILD_ROOT%{_sysconfdir}/sudoers.d -cat < $RPM_BUILD_ROOT%{_sysconfdir}/sudoers.d/pandora -Defaults:root !requiretty -EOF -chmod 0440 $RPM_BUILD_ROOT%{_sysconfdir}/sudoers.d/pandora - -cat < $RPM_BUILD_ROOT%{_sysconfdir}/cron.hourly/pandora_db -#!/bin/bash -%__perl %{prefix}/pandora_server/util/pandora_db.pl %{_sysconfdir}/pandora/pandora_server.conf -EOF -chmod 0755 $RPM_BUILD_ROOT%{_sysconfdir}/cron.hourly/pandora_db - -%clean -rm -fr $RPM_BUILD_ROOT - -%pre -getent passwd pandora >/dev/null || \ - /usr/sbin/useradd -d %{prefix}/pandora_server -s /sbin/nologin -M -g 0 pandora - -exit 0 - -%post -# Initial installation -if [ "$1" = 1 ]; then - /sbin/chkconfig --add pandora_server - /sbin/chkconfig --add tentacle_serverd - /sbin/chkconfig pandora_server on - /sbin/chkconfig tentacle_serverd on - - echo "Pandora FMS Server configuration is %{_sysconfdir}/pandora/pandora_server.conf" - echo "Pandora FMS Server main directory is %{prefix}/pandora_server/" - echo "The manual can be reached at: man pandora or man pandora_server" - echo "Pandora FMS Documentation is in: http://pandorafms.org" - echo " " -fi - -# This will avoid pandora_server.conf overwritting on UPGRADES. - -if [ ! -e "/etc/pandora/pandora_server.conf" ] -then - echo "Creating a new version of Pandora FMS Server config file at /etc/pandora/pandora_server.conf" - cat /etc/pandora/pandora_server.conf.new > /etc/pandora/pandora_server.conf -else - # Do a copy of current .conf, just in case. - echo "An existing version of pandora_server.conf is found." - cat /etc/pandora/pandora_server.conf > /etc/pandora/pandora_server.conf.old -fi - -echo "Don't forget to start Tentacle Server daemon if you want to receive" -echo "data using tentacle" - -%preun - -# Upgrading -if [ "$1" = "1" ]; then - exit 0 -fi - -/sbin/service pandora_server stop >/dev/null 2>&1 || : -/sbin/service tentacle_serverd stop >/dev/null 2>&1 || : -/sbin/chkconfig --del pandora_server -/sbin/chkconfig --del tentacle_serverd - -exit 0 - -%files -%defattr(-,root,root) -%doc AUTHORS COPYING README -%{_sysconfdir}/rc.d/init.d/pandora_server -%{_sysconfdir}/rc.d/init.d/tentacle_serverd -%{_sysconfdir}/cron.hourly/pandora_db -%config(noreplace) %{_sysconfdir}/sudoers.d/pandora -%config(noreplace) %{_sysconfdir}/logrotate.d/pandora_server - -%defattr(755,pandora,root) -%{prefix}/pandora_server -/usr/lib/perl5/PandoraFMS - -%{_mandir}/man1/pandora_server.1.gz -%{_mandir}/man1/tentacle_server.1.gz - -%defattr(-,pandora,root) -%{_bindir}/pandora_exec -%{_bindir}/pandora_server -%{_bindir}/tentacle_server -%dir %{_localstatedir}/log/pandora -%dir %{_sysconfdir}/pandora -%dir %{_localstatedir}/spool/pandora - -%defattr(600,root,root) -/etc/pandora/pandora_server.conf.new - -%defattr(-,pandora,apache,2770) -%{_localstatedir}/spool/pandora -%{_localstatedir}/spool/pandora/data_in -%{_localstatedir}/spool/pandora/data_in/md5 -%{_localstatedir}/spool/pandora/data_in/collections -%{_localstatedir}/spool/pandora/data_in/conf -%{_localstatedir}/spool/pandora/data_in/netflow diff --git a/pandora_server/pandora_server.spec.orig b/pandora_server/pandora_server.spec.orig deleted file mode 100644 index bae0578983..0000000000 --- a/pandora_server/pandora_server.spec.orig +++ /dev/null @@ -1,193 +0,0 @@ -# -# Pandora FMS Server -# -%define name pandorafms_server -%define version 7.0NG -<<<<<<< HEAD -%define release 170406 -======= -%define release 170418 ->>>>>>> develop - -Summary: Pandora FMS Server -Name: %{name} -Version: %{version} -Release: %{release} -License: GPL -Vendor: ArticaST -Source0: %{name}-%{version}.tar.gz -URL: http://www.pandorafms.com -Group: System/Monitoring -Packager: Sancho Lerena -Prefix: /usr/share -BuildRoot: %{_tmppath}/%{name}-buildroot -BuildArch: noarch -PreReq: %fillup_prereq %insserv_prereq /usr/bin/sed /usr/bin/grep /usr/sbin/useradd -AutoReq: 0 -Provides: %{name}-%{version} -Requires: perl-DBI perl-DBD-mysql perl-libwww-perl -Requires: perl-NetAddr-IP net-snmp net-tools perl-XML-Twig -Requires: nmap sudo perl-HTML-Tree perl-XML-Simple perl-Net-Telnet -Requires: perl-IO-Socket-INET6 perl-Socket6 snmp-mibs perl-JSON -Requires: perl-Encode-Locale - -%description - -Pandora FMS is a monitoring Open Source software. It watches your systems and applications, and allows you to know the status of any element of those systems. - -Pandora FMS could detect a network interface down, a defacement in your website, a memory leak in one of your server application, or the movement of any value of the NASDAQ new technology market. Pandora FMS could send out SMS message when your systems fails... or when Google's value drop below US348.60? - -Pandora FMS runs on any operating system, with specific agents for each platform, gathering data and sending it to a server, it has specific agents for GNU/Linux, AIX, Solaris, HP-UX, BSD/IPSO, and Windows 2000, XP and 2003. - -Pandora FMS can also monitor any kind of TCP/IP service, without the need to install agents, and monitor network systems such as load balancers, routers, switches, operating systems, applications, or simply printers if you need. Pandora FMS also supports SNMP for collecting data and for receiving traps. - -A few examples of common resources monitored by Pandora FMS could be processor load, disk and memory usage, running processes, log files, environmental factors such as temperature, or application values like strings contained in web pages or any possible way to collect data in an automatic way. - - -%prep -rm -rf $RPM_BUILD_ROOT - -%setup -q -n pandora_server - -%build - -%install - -rm -rf $RPM_BUILD_ROOT -mkdir -p $RPM_BUILD_ROOT/usr/bin/ -mkdir -p $RPM_BUILD_ROOT/usr/sbin/ -mkdir -p $RPM_BUILD_ROOT/etc/init.d/ -mkdir -p $RPM_BUILD_ROOT/etc/pandora/ -mkdir -p $RPM_BUILD_ROOT/var/spool/pandora/data_in -mkdir -p $RPM_BUILD_ROOT/var/spool/pandora/data_in/conf -mkdir -p $RPM_BUILD_ROOT/var/spool/pandora/data_in/md5 -mkdir -p $RPM_BUILD_ROOT/var/spool/pandora/data_in/collections -mkdir -p $RPM_BUILD_ROOT/var/spool/pandora/data_in/netflow -mkdir -p $RPM_BUILD_ROOT/var/spool/pandora/data_in/trans -mkdir -p $RPM_BUILD_ROOT/var/log/pandora/ -mkdir -p $RPM_BUILD_ROOT%{prefix}/pandora_server/conf/ -mkdir -p $RPM_BUILD_ROOT/usr/lib/perl5/ -mkdir -p $RPM_BUILD_ROOT/usr/share/man/man1/ - -# All binaries go to /usr/bin -cp -aRf bin/pandora_server $RPM_BUILD_ROOT/usr/bin/ -cp -aRf bin/pandora_exec $RPM_BUILD_ROOT/usr/bin/ -cp -aRf bin/tentacle_server $RPM_BUILD_ROOT/usr/bin/ - -cp -aRf conf/* $RPM_BUILD_ROOT%{prefix}/pandora_server/conf/ -cp -aRf conf/pandora_server.conf.new $RPM_BUILD_ROOT/etc/pandora/ -cp -aRf util $RPM_BUILD_ROOT%{prefix}/pandora_server/ -cp -aRf lib/* $RPM_BUILD_ROOT/usr/lib/perl5/ -cp -aRf AUTHORS COPYING README $RPM_BUILD_ROOT%{prefix}/pandora_server/ - -cp -aRf util/pandora_server $RPM_BUILD_ROOT/etc/init.d/ -cp -aRf util/tentacle_serverd $RPM_BUILD_ROOT/etc/init.d/ - -cp -aRf man/man1/pandora_server.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/ -cp -aRf man/man1/tentacle_server.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/ - -rm -Rf $RPM_BUILD_ROOT%{prefix}/pandora_server/util/PandoraFMS -rm -Rf $RPM_BUILD_ROOT%{prefix}/pandora_server/util/recon_scripts/PandoraFMS - -%clean -rm -fr $RPM_BUILD_ROOT - -%pre -if [ "`id pandora | grep uid | wc -l`" = 0 ] -then - /usr/sbin/useradd -d %{prefix}/pandora -s /bin/false -M -g 0 pandora -fi -exit 0 - -%post -chkconfig pandora_server on -chkconfig tentacle_serverd on - -echo "/usr/share/pandora_server/util/pandora_db.pl /etc/pandora/pandora_server.conf" > /etc/cron.hourly/pandora_db -chmod 750 /etc/cron.hourly/pandora_db -cp -aRf /usr/share/pandora_server/util/pandora_server_logrotate /etc/logrotate.d/pandora_server - -if [ ! -d /etc/pandora ] ; then - mkdir -p /etc/pandora -fi - -if [ ! -e "/etc/pandora/pandora_server.conf" ] -then - echo "Creating a new version of Pandora FMS Server config file at /etc/pandora/pandora_server.conf" - cat /etc/pandora/pandora_server.conf.new > /etc/pandora/pandora_server.conf -else - # Do a copy of current .conf, just in case. - echo "An existing version of pandora_server.conf is found." - cat /etc/pandora/pandora_server.conf > /etc/pandora/pandora_server.conf.old -fi - -echo "Don't forget to start Tentacle Server daemon if you want to receive" -echo "data using tentacle" - -exit 0 - -%preun - -# Upgrading -if [ "$1" = "1" ]; then - exit 0 -fi - -/etc/init.d/pandora_server stop &>/dev/null -/etc/init.d/tentacle_serverd stop &>/dev/null -chkconfig --del pandora_server -chkconfig --del tentacle_serverd - -%postun - -# Upgrading -if [ "$1" = "1" ]; then - exit 0 -fi - -rm -Rf /etc/init.d/tentacle_serverd -rm -Rf /etc/init.d/pandora_server -rm -Rf %{prefix}pandora_server -rm -Rf /var/log/pandora -rm -Rf /usr/lib/perl5/PandoraFMS/ -rm -Rf /etc/pandora/pandora_server.conf* -rm -Rf /var/spool/pandora -rm -Rf /etc/init.d/pandora_server /etc/init.d/tentacle_serverd -rm -Rf /usr/bin/pandora_exec /usr/bin/pandora_server /usr/bin/tentacle_server -rm -Rf /etc/cron.hourly/pandora_db -rm -Rf /etc/logrotate.d/pandora_server -rm -Rf /usr/share/man/man1/pandora_server.1.gz -rm -Rf /usr/share/man/man1/tentacle_server.1.gz - -%files - -%defattr(750,pandora,root) -/etc/init.d/pandora_server -/etc/init.d/tentacle_serverd - -%defattr(755,pandora,root) -/usr/bin/pandora_exec -/usr/bin/pandora_server -/usr/bin/tentacle_server - -%defattr(755,pandora,root,755) -/usr/lib/perl5/PandoraFMS/ -%{prefix}/pandora_server -/var/log/pandora - -%defattr(-,pandora,www,2770) -/var/spool/pandora -/var/spool/pandora/data_in -/var/spool/pandora/data_in/md5 -/var/spool/pandora/data_in/collections -/var/spool/pandora/data_in/netflow -/var/spool/pandora/data_in/conf -/var/spool/pandora/data_in/trans - -%defattr(-,pandora,root,750) -/etc/pandora - -%defattr(644,pandora,root) -/usr/share/man/man1/pandora_server.1.gz -/usr/share/man/man1/tentacle_server.1.gz - diff --git a/pandora_server/pandora_server_installer.orig b/pandora_server/pandora_server_installer.orig deleted file mode 100755 index 8a59e3cb2f..0000000000 --- a/pandora_server/pandora_server_installer.orig +++ /dev/null @@ -1,529 +0,0 @@ -#!/bin/sh - -# Pandora FMS Server Installer (c) 2008-2013 Artica ST -# Linux/FreeBSD Version (generic), for SuSe, Debian/Ubuntu and FreeBSD only -# other Linux distros could not work properly without modifications -# Please see http://www.pandorafms.org -# v5.0 Build 130207 -# This code is licensed under GPL 2.0 license. -# ********************************************************************** - -PI_VERSION="7.0NG" -<<<<<<< HEAD -PI_BUILD="170406" -======= -PI_BUILD="170418" ->>>>>>> develop - -MODE=$1 -if [ $# -gt 1 ]; then - shift -fi - -# Defaults -PREFIX=/usr -PANDORA_SPOOL=/var/spool/pandora -PANDORA_HOME=$PREFIX/share/pandora_server -PANDORA_CFG_DIR=/etc/pandora -PANDORA_LOG=/var/log/pandora -PANDORA_SERVER=/etc/init.d/pandora_server -TENTACLE_SERVER=/etc/init.d/tentacle_serverd -PANDORA_CFG_FILE=$PANDORA_CFG_DIR/pandora_server.conf -PANDORA_CFG_FILE_DIST=conf/pandora_server.conf.new -PANDORA_INIT_SCRIPT=util/pandora_server -TENTACLE_INIT_SCRIPT=util/tentacle_serverd -PERL=perl -MANDIR=$PREFIX/share/man/man1 -INITDIR=/etc/init.d -WITHOUT_TENTACLE=0 - -# -# set_global_vars -# Check platform and set DISTRO, OS_VERSION and LINUX. -# Also, define some platform sepcific variables (e.g. PANDORA_RC_VAR for (Free|Net)BSD) -# and override some of defaults defined above if needed. -# -set_global_vars () { - # Default - LINUX=NO - OS_VERSION=`uname -r` - DISTRO=`uname -s` - - # set correct value for LINUX_DISTRO - case $DISTRO in - Linux) - # Default for Linux - LINUX=YES - DISTRO="GENERIC" - # Get Linux Distro type and version - # We assume we are on Linux unless told otherwise - if [ -f "/etc/SuSE-release" ] - then - OS_VERSION=`cat /etc/SuSE-release | grep VERSION | cut -f 3 -d " "` - DISTRO=SUSE - elif [ -f "/etc/lsb-release" ] && [ ! -f "/etc/redhat-release" ] - then - OS_VERSION=`cat /etc/lsb-release | grep DISTRIB_RELEASE | cut -f 2 -d "="` - DISTRO=UBUNTU - OS_VERSION="UBUNTU $OS_VERSION" - elif [ -f "/etc/debian_version" ] - then - OS_VERSION=`cat /etc/debian_version` - OS_VERSION="DEBIAN $OS_VERSION" - DISTRO=DEBIAN - elif [ -f "/etc/fedora-release" ] - then - OS_VERSION=`cat /etc/fedora-release | cut -f 4 -d " "` - OS_VERSION="FEDORA $OS_VERSION" - DISTRO=FEDORA - fi - ;; - Darwin|AIX) - # For future reference, Darwin doesn't have /etc/init.d but uses LaunchDaemons. - # AIX doesn't have /etc/init.d - ;; - SunOS) - # Some Solaris and other Unices don't have /etc/init.d, some have /usr/spool instead of /var/spool - DISTRO="Solaris" - ;; - FreeBSD) - PREFIX=/usr/local - PANDORA_HOME=$PREFIX/share/pandora_server - PANDORA_CFG_DIR=$PREFIX/etc/pandora - PANDORA_SERVER=$PREFIX/etc/rc.d/pandora_server - TENTACLE_SERVER=$PREFIX/etc/rc.d/tentacle_server - PANDORA_CFG_FILE=$PANDORA_CFG_DIR/pandora_server.conf - PANDORA_CFG_FILE_DIST=$DISTRO/pandora_server.conf.new - PANDORA_INIT_SCRIPT=$DISTRO/pandora_server - TENTACLE_INIT_SCRIPT=$DISTRO/tentacle_server - MANDIR=$PREFIX/man/man1 - INITDIR=$PREFIX/etc/rc.d - PERL=/usr/local/bin/perl - PANDORA_RC_VAR="pandora_server_enable" - TENTACLE_RC_VAR="tentacle_server_enable" - ;; - NetBSD) - PREFIX=/usr/local - PANDORA_HOME=$PREFIX/share/pandora_server - PANDORA_CFG_DIR=$PREFIX/etc/pandora - PANDORA_SERVER=/etc/rc.d/pandora_server - TENTACLE_SERVER=/etc/rc.d/tentacle_server - PANDORA_CFG_FILE=$PANDORA_CFG_DIR/pandora_server.conf - PANDORA_CFG_FILE_DIST=$DISTRO/pandora_server.conf.new - PANDORA_INIT_SCRIPT=$DISTRO/pandora_server - TENTACLE_INIT_SCRIPT=$DISTRO/tentacle_server - PERL=/usr/pkg/bin/perl - INITDIR=/etc/rc.d - PANDORA_RC_VAR="pandora_server" - TENTACLE_RC_VAR="tentacle_server" - ;; - esac -} - -# -# install_startup_script [options...] SRC -# copy SRC into the $INITDIR and do additional required operation according to $DISTRO -# if $INITDIR is not set or empty, do nothing. -# If $DESTDIR is set, skip enabling service -# OPTIONS: -# -s SPRIO specify startup priority for service -# -install_startup_script () { - [ "$INITDIR" ] || return 1 - if [ "$1" = "-s" ] - then - SPRIO=$2 - shift;shift - fi - SRC=$1 - SCRIPT_NAME=`basename $SRC` - - echo "Copying the daemon script into $INITDIR" - [ -d $DESTDIR$INITDIR ] || mkdir -p $DESTDIR$INITDIR - cp $SRC $DESTDIR$INITDIR - - [ "$DESTDIR" ] && return - - case $DISTRO in - UBUNTU|DEBIAN) - echo "Linking startup script to /etc/rc2.d" - update-rc.d $SCRIPT_NAME defaults - ;; - SUSE) - echo "Creating startup daemons" - insserv $SCRIPT_NAME - ;; - FeeBSD|NetBSD) - chmod 555 $DESTDIR$INITDIR/$SCRIPT_NAME - ;; - *) - if [ "$LINUX" = YES ] - then - # Pandora FMS Server install (Other Distros) - INITLV=`grep '[0-9]:initdefault' /etc/inittab | cut -f 2 -d ':'` - : ${INITLV:=2} - echo "Linking startup script to /etc/rc.d/rc$INITLV.d/S$SPRIO$SCRIPT_NAME" - ln -s $INITDIR/$SCRIPT_NAME /etc/rc.d/rc$INITLV.d/S$SPRIO$SCRIPT_NAME - fi - ;; - esac -} - -install () { - set_global_vars - - FORCE=0 - BINARIES=0 - - # parse options - while : - do - case $1 in - --force) FORCE=1;; - --from-binary) BINARIES=1;; - --no-tentacle) WITHOUT_TENTACLE=1;; - --destdir) DESTDIR=$2;shift;; - *) break;; - esac - shift - done - - if [ "$LINUX" = YES ] - then - echo "$DISTRO distribution detected" - else - echo "$DISTRO detected" - fi - - if [ ! $BINARIES -eq 1 ] - # Do not compile files if binary is distributed - then - $PERL Makefile.PL INSTALLMAN1DIR=none WITHOUT_TENTACLE=$WITHOUT_TENTACLE > output 2>&1 - #&& sleep 2 && cat output | grep "found" | wc -l - DEPENDENCIAS=`cat output | grep "found" | wc -l` - - if [ $DEPENDENCIAS -gt 0 ] && [ $FORCE -eq 0 ] - then - echo "You are missing the following dependencies" - echo " " - cat output | awk -F ": prerequisite" '{print $2}' | awk -F " " '{print $1}' - echo "The complete installation guide is at: http://openideas.info/wiki/index.php?title=Pandora" - echo " " - echo "Debian-based distribution do:" - echo " # apt-get install snmp snmpd libjson-perllibio-socket-inet6-perl libsocket6-perl libxml-simple-perl libxml-twig-perl libnetaddr-ip-perl libdbi-perl libnetaddr-ip-perl libhtml-parser-perl wmi-client xprobe2 snmp-mibs-downloader" - echo " " - echo "For CentOS / RHEL do: " - echo " " - echo " # yum install perl-XML-Simple* perl-XML-Twig perl-JSON perl-IO-Socket* perl-Socket6 perl-Time-modules* perl-NetAddr-IP* perl-DateTime* perl-ExtUtils perl-DBI nmap " - echo " " - echo "For OpenSUSE / SLES do : " - echo " " - echo " # zypper install nmap perl-DBD-mysql perl-DBI perl-HTML-Parser perl-JSON - perl-HTML-Encoding perl-HTML-Tree perl-NetAddr-IP perl-IO-Socket-INET6 perl-Socket6 - perl-TimeDate perl-XML-Simple perl-XML-Twig perl-libwww-perl mysql-client" - echo " " - echo " You also will need to install (optionally) xprobe2 and wmiclient from rpm (download from our website)" - echo " " - echo "For FreeBSD do : " - echo " " - echo " Install perl5.8 or later from ports with thread enabled." - echo " (perl-5.8.x.pkg can not be used.)" - echo " # cd /usr/ports/lang/perl5.8" - echo " # make config" - echo " -> Enable THREADS." - echo " # make" - echo " # make install" - echo " " - echo " Install following tools from ports. Don't use packages." - echo " Recommended: p5-DBI p5-NetAddr-IP p5-XML-Simple p5-XML-Twig p5-HTML-Parser p5-DBD-mysql p5-Socket6 p5-IO-Socket-INET6 p5-JSON" - echo " Optional: nmap xprobe" - echo " " - echo "To get it from source through CPAN do" - echo " " - echo " $ cpan Time::Local DBI Socket6 XML::Simple XML::Twig IO::Socket Time::HiRes NetAddr::IP HTML::Entities IO::Socket::INET6 JSON" - echo " " - rm output - exit 1 - fi - rm output - - echo "Installing binaries and libraries" - make - make DESTDIR=$DESTDIR install - - echo "Checking binaries at /usr/local/bin -> /usr/bin" - if [ ! -f "$DESTDIR/usr/bin/pandora_server" ] - then - if [ ! -f "$DESTDIR/usr/local/bin/pandora_server" ] - then - echo "ERROR compiling Pandora FMS Server from sources. Aborting" - exit 1 - fi - if [ "$DISTRO" != "FreeBSD" ] && [ "$DISTRO" != "NetBSD" ] - then - [ -d $DESTDIR$PREFIX/bin ] || mkdir -p $DESTDIR$PREFIX/bin - ln -s /usr/local/bin/pandora_server $DESTDIR$PREFIX/bin - ln -s /usr/local/bin/pandora_exec $DESTDIR$PREFIX/bin - ln -s /usr/local/bin/tentacle_server $DESTDIR$PREFIX/bin - fi - fi - fi - - echo "Creating common Pandora FMS directories" - id pandora 2> /dev/null - if [ $? -eq 0 ]; then - echo " " - echo "User pandora does exist, make sure the SSH directories are correct" - elif [ "$DESTDIR" ] - then - # chown can fail with fakeroot installation - echo "User 'pandora' does not exist. All chown operations may fail." - echo "You should manualy set proper ownership to $DESTDIR$PANDORA_SPOOL if needed." - echo - else - echo "Are you sure we can create a standard 'pandora' user locally? [y/N]" - read AREYOUSURE - if [ "$AREYOUSURE" = "y" ]; then - if [ "$DISTRO" = "FreeBSD" ] - then - echo "pandora:41121:::::Pandora FMS:/home/pandora:/usr/sbin/nologin:" | adduser -f - -w no 2> /dev/null - else - useradd pandora - mkdir /home/pandora 2> /dev/null - mkdir /home/pandora/.ssh 2> /dev/null - chown -R pandora /home/pandora - fi - else - echo "Please create the 'pandora' user manually according to your authentication scheme, then start again the installation" - echo "Aborting..." - exit 1 - fi - fi - - mkdir -p $DESTDIR$PANDORA_SPOOL/data_in 2> /dev/null - chmod 2770 $DESTDIR$PANDORA_SPOOL/data_in - mkdir $DESTDIR$PANDORA_SPOOL/data_in/conf 2> /dev/null - chmod 2770 $DESTDIR$PANDORA_SPOOL/data_in/conf - mkdir $DESTDIR$PANDORA_SPOOL/data_in/md5 2> /dev/null - chmod 2770 $DESTDIR$PANDORA_SPOOL/data_in/md5 - mkdir $DESTDIR$PANDORA_SPOOL/data_in/collections 2> /dev/null - chmod 2770 $DESTDIR$PANDORA_SPOOL/data_in/collections - mkdir $DESTDIR$PANDORA_SPOOL/data_in/netflow 2> /dev/null - chmod 2770 $DESTDIR$PANDORA_SPOOL/data_in/netflow - mkdir $DESTDIR$PANDORA_SPOOL/data_in/trans 2> /dev/null - chmod 2770 $DESTDIR$PANDORA_SPOOL/data_in/trans - mkdir -p $DESTDIR$PANDORA_LOG 2> /dev/null - chown -R pandora $DESTDIR$PANDORA_LOG 2> /dev/null - chmod 2770 $DESTDIR$PANDORA_LOG 2> /dev/null - - echo "Giving proper permission to /var/spool/pandora" - for group in "www-data" wwwrun www apache - do - IDGROUP=`id -g "$group" 2> /dev/null` - if [ $? -eq 0 ] - then - GROUPNAME=`grep ":$IDGROUP:" /etc/group | awk -F":" '{print $1}'` - break - fi - done - if [ -z "$GROUPNAME" ] - then - echo "No web server user found, some functionality might not perform correctly" - GROUPNAME=0 - fi - # when fakeroot installation, this can fail - chown -R pandora:$GROUPNAME $DESTDIR$PANDORA_SPOOL 2>/dev/null - - echo "Creating setup directory in $PANDORA_CFG_DIR" - mkdir -p $DESTDIR$PANDORA_CFG_DIR 2> /dev/null - if [ -f "$DESTDIR$PANDORA_CFG_FILE" ] - then - echo cp $PANDORA_CFG_FILE_DIST $DESTDIR$PANDORA_CFG_DIR - cp $PANDORA_CFG_FILE_DIST $DESTDIR$PANDORA_CFG_DIR - else - echo cp $PANDORA_CFG_FILE_DIST $DESTDIR$PANDORA_CFG_FILE - cp $PANDORA_CFG_FILE_DIST $DESTDIR$PANDORA_CFG_FILE - chmod 770 $DESTDIR$PANDORA_CFG_FILE - fi - - echo "Installing Pandora Server manual" - [ -d $DESTDIR$MANDIR ] || mkdir -p $DESTDIR$MANDIR - cp man/man1/pandora_server.1.gz $DESTDIR$MANDIR - - install_startup_script -s 90 $PANDORA_INIT_SCRIPT - - if [ -d /etc/logrotate.d ] - then - [ -d $DESTDIR/etc/logrotate.d ] || mkdir -p $DESTDIR/etc/logrotate.d - echo "Creating logrotate.d entry for Pandora FMS log management" - cp util/pandora_server_logrotate $DESTDIR/etc/logrotate.d/pandora_server - else - echo "Please add a log rotation schedule manually to your log rotation daemon (if any)" - fi - - if [ $WITHOUT_TENTACLE -eq 0 ] - then - # tentacle_server is already installed by "make install" - install_startup_script -s 80 $TENTACLE_INIT_SCRIPT - - echo "Installing Tentacle Server manual" - cp man/man1/tentacle_server.1.gz $DESTDIR$MANDIR - fi - - echo "Creating Pandora FMS distribution directory in $PANDORA_HOME" - mkdir -p $DESTDIR$PANDORA_HOME 2> /dev/null - cp -R util $DESTDIR$PANDORA_HOME - find $DESTDIR$PANDORA_HOME -type l -delete - - # install cron job - if [ -d /etc/cron.hourly ] - then - [ ! -d $DESTDIR/etc/cron.hourly ] && mkdir -p $DESTDIR/etc/cron.hourly - echo "Creating the Cron script to run Pandora DB tool each hour" - echo "#!/bin/bash" > $DESTDIR/etc/cron.hourly/pandora_db - echo "perl $PANDORA_HOME/util/pandora_db.pl /etc/pandora/pandora_server.conf" >> $DESTDIR/etc/cron.hourly/pandora_db - chmod +x $DESTDIR/etc/cron.hourly/pandora_db - elif [ "$DISTRO" = "FreeBSD" ] || [ "$DISTRO" = "NetBSD" ] - then - if [ "$DESTDIR" ] - then - echo "Skip adding cron entry for pandora_db.pl when performing fakeroot installation." - else - grep pandora_db.pl /etc/crontab > /dev/null 2>&1 - if [ $? -ne 0 ] - then - echo "# Pandora FMS" >> /etc/crontab - echo "2 * * * * root perl $PANDORA_HOME/util/pandora_db.pl $PANDORA_CFG_FILE" >> /etc/crontab - else - echo "The crontab for pandora_db.pl is already configured." - fi - fi - else - echo "You're probably not using cron for automatic scheduling. You should schedule the following command to run frequently (hourly) on your master server:" - echo " perl $PANDORA_HOME/util/pandora_db.pl $PANDORA_CFG_FILE" - fi - echo - echo "Now you have to edit your $PANDORA_CFG_FILE file to change the database password (default is pandora) with the one set in include/config.php of your Pandora FMS Console." - echo "After setting password you can start your Pandora FMS Server!!" - - if [ "$DISTRO" = "FreeBSD" ] || [ "$DISTRO" = "NetBSD" ] - then - echo " " - echo "Define '$PANDORA_RC_VAR=\"YES\"' in /etc/rc.conf to enable pandora server daemon." - [ "$WITHOUT_TENTACLE" = 0 ] && \ - echo "Define '$TENTACLE_RC_VAR=\"YES\"' in /etc/rc.conf to enable tentacle server daemon." - fi -} - -uninstall () { - set_global_vars - - if [ "$LINUX" != "YES" ] && [ "$DISTRO" != "FreeBSD" ] && [ "$DISTRO" != "NetBSD" ] - then - echo "This is not a Linux-based distro. Uninstaller is currently not working for your OS" - exit 1 - fi - - echo "Removing PERL libs and man files" - - PERL_SITELIB=/usr/lib/perl5 - if [ "$DISTRO" != "FreeBSD" ] || [ "$DISTRO" != "NetBSD" ] - then - PERL_SITELIB=$(eval $($PERL -V:sitelib);echo $sitelib); - fi - PERL_SITEMAN3DIR=`eval \`$PERL -V:siteman3dir\`;echo $siteman3dir`; - - [ -d $DESTDIR/$PERL_SITELIB/PandoraFMS ] && rm -rf $DESTDIR/$PERL_SITELIB/PandoraFMS - rm -f $DESTDIR/$PERL_SITEMAN3DIR/PandoraFMS::* 2>/dev/null - - - echo "Removing Pandora Servers" - if [ -d $DESTDIR$PANDORA_SPOOL/data_out ]; then - rm -Rf $DESTDIR$PANDORA_SPOOL/data_in - else - rm -Rf $DESTDIR$PANDORA_SPOOL - fi - - echo "If the user Pandora is not being used for any other operations, please delete using the following commands:" - if [ "$DISTRO" != "FreeBSD" ] || [ "$DISTRO" != "NetBSD" ] - then - echo " rmuser pandora" - else - echo " userdel pandora" - echo " rm -Rf /home/pandora/" - fi - - ## Just to clarify here. Some people (like me) are using the pandora user - ## for other purposes and/or using an LDAP-based user management - ## I would hate to have a script clear out this users' information without any notification - - - rm -Rf $DESTDIR$PANDORA_LOG 2> /dev/null - rm -f $DESTDIR$PANDORA_CFG_FILE 2> /dev/null - rm -f "$DESTDIR$PANDORA_CFG_FILE.new" 2> /dev/null - rm -f $DESTDIR$PANDORA_SERVER 2> /dev/null - rm -f $DESTDIR$PREFIX/bin/pandora_server 2> /dev/null - rm -f $DESTDIR$PREFIX/bin/pandora_exec 2> /dev/null - rm -f $DESTDIR$PREFIX/bin/tentacle_server 2> /dev/null - rm -Rf $DESTDIR$PANDORA_HOME - rm -f $DESTDIR/etc/cron.hourly/pandora_db - rm -f $DESTDIR/etc/logrotate.d/pandora_server - if [ "$DESTDIR" ] - then - # do nothing with "fakeroot" uninstallation - : - elif [ "$DISTRO" = "UBUNTU" ] || [ "$DISTRO" = "DEBIAN" ] - then - update-rc.d -f pandora_server remove - update-rc.d -f tentacle_serverd remove - elif [ "$DISTRO" != "FreeBSD" ] || [ "$DISTRO" != "NetBSD" ] - then - TMP_CRONTAB=/tmp/crontab.tmp - egrep -v "Pandora FMS|pandora_db.pl" /etc/crontab > $TMP_CRONTAB - cp $TMP_CRONTAB /etc/crontab - rm $TMP_CRONTAB - fi - rm -f $DESTDIR/etc/rc2.d/S90pandora_server 2> /dev/null - rm -f $DESTDIR/etc/rc.d/rc3.d/S90pandora_server 2> /dev/null - rm -f $DESTDIR/etc/rc2.d/S80tentacle_serverd 2> /dev/null - rm -f $DESTDIR/etc/rc.d/rc3.d/S80tentacle_serverd 2> /dev/null - rm -f $DESTDIR$MANDIR/pandora_server.1.gz 2>/dev/null - rm -f $DESTDIR$MANDIR/tentacle_server.1.gz 2>/dev/null - echo "Done" -} - -help () { - echo " --install To install Pandora FMS Servers on this system (You have to be root)" - echo " --uninstall To uninstall and remove Pandora FMS Servers on this System" - echo " " - echo " Additional second parameter (after --install) " - echo " " - echo " --force Ignore dependency problems and do the install" - echo " --no-tentacle Skip tentacle server installation (by default tentacle server installed)" - echo " --destdir DIR Specify root directory for \"fakeroot\" installation" - echo " --from-binary No compile Pandora Server and not execute Makefiles" - echo " " -} - -# Script banner at start -echo " " -echo "Pandora FMS Server Installer $PI_VERSION $PI_BUILD (c) 2008-2016 Artica ST" -echo "This program is licensed under GPL2 Terms. http://pandorafms.com" -echo " " - -case "$MODE" in - -'--install') - install "$@" - exit 0 - ;; - -'--uninstall') - uninstall "$@" - exit 0 - ;; - -*) - help -esac - diff --git a/pandora_server/util/pandora_db.pl.orig b/pandora_server/util/pandora_db.pl.orig deleted file mode 100644 index ca76fdf01a..0000000000 --- a/pandora_server/util/pandora_db.pl.orig +++ /dev/null @@ -1,1119 +0,0 @@ -#!/usr/bin/perl - -############################################################################### -# Pandora FMS DB Management -############################################################################### -# Copyright (c) 2005-2013 Artica Soluciones Tecnologicas S.L -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; version 2 -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,USA -############################################################################### - -# Includes list -use strict; -use warnings; -use Time::Local; # DateTime basic manipulation -use DBI; # DB interface with MySQL -use POSIX qw(strftime); -use File::Path qw(rmtree); -use Time::HiRes qw(usleep); - -# Default lib dir for RPM and DEB packages -use lib '/usr/lib/perl5'; - -use PandoraFMS::Tools; -use PandoraFMS::DB; - -# version: define current version -<<<<<<< HEAD -my $version = "7.0NG PS170406"; -======= -my $version = "7.0NG PS170418"; ->>>>>>> develop - -# Pandora server configuration -my %conf; - -# Long operations are divided in XX steps for performance -my $BIG_OPERATION_STEP = 100; # 100 is default - -# Each long operations has a LIMIT of SMALL_OPERATION_STEP to avoid locks. -#Increate to 3000~5000 in fast systems decrease to 500 or 250 on systems with locks -my $SMALL_OPERATION_STEP = 1000; # 1000 is default - -# FLUSH in each IO -$| = 1; - -######################################################################## -# Print the given message with a preceding timestamp. -######################################################################## -sub log_message ($$;$) { - my ($source, $message, $eol) = @_; - - # Set a default end of line - $eol = "\n" unless defined ($eol); - - if ($source eq '') { - print $message; - } - else { - print strftime("%H:%M:%S", localtime()) . ' [' . $source . '] ' . $message . $eol; - } -} - -######################################################################## -# Delete old data from the database. -######################################################################## -sub pandora_purgedb ($$) { - my ($conf, $dbh) = @_; - - # 1) Obtain last value for date limit - # 2) Delete all elements below date limit - # 3) Insert last value in date_limit position - - # Calculate limit for deletion, today - $conf->{'_days_purge'} - - my $timestamp = strftime ("%Y-%m-%d %H:%M:%S", localtime()); - my $ulimit_access_timestamp = time() - 86400; - my $ulimit_timestamp = time() - (86400 * $conf->{'_days_purge'}); - my $first_mark; - my $total_time; - my $purge_steps; - my $purge_count; - - # Delete extended session data - if (enterprise_load (\%conf) != 0) { - db_do ($dbh, "DELETE FROM tsesion_extended - WHERE id_sesion NOT IN ( SELECT id_sesion FROM tsesion )"); - log_message ('PURGE', 'Deleting old extended session data.'); - } - - # Delete old inventory data - if ($conf->{'_inventory_purge'} > 0) { - if (enterprise_load (\%conf) != 0) { - my $ulimit_timestamp_inventory = time() - (86400 * $conf->{'_inventory_purge'}); - - log_message ('PURGE', 'Deleting old inventory data.'); - - # This could be very timing consuming, so make - # this operation in $BIG_OPERATION_STEP - # steps (100 fixed by default) - # Starting from the oldest record on the table - - $first_mark = get_db_value_limit ($dbh, 'SELECT utimestamp FROM tagente_datos_inventory ORDER BY utimestamp ASC', 1); - if (defined ($first_mark)) { - $total_time = $ulimit_timestamp_inventory - $first_mark; - $purge_steps = int($total_time / $BIG_OPERATION_STEP); - if ($purge_steps > 0) { - for (my $ax = 1; $ax <= $BIG_OPERATION_STEP; $ax++) { - db_do ($dbh, "DELETE FROM tagente_datos_inventory WHERE utimestamp < ". ($first_mark + ($purge_steps * $ax)) . " AND utimestamp >= ". $first_mark ); - log_message ('PURGE', "Inventory data deletion Progress %$ax\r"); - # Do a nanosleep here for 0,01 sec - usleep (10000); - } - log_message ('', "\n"); - } else { - log_message ('PURGE', 'No data to purge in tagente_datos_inventory.'); - } - } else { - log_message ('PURGE', 'No data in tagente_datos_inventory.'); - } - } - } - - # Delete old data - if ($conf->{'_days_purge'} > 0) { - - # Delete old numeric data - pandora_delete_old_module_data ($dbh, 'tagente_datos', $ulimit_access_timestamp, $ulimit_timestamp); - - # Delete old export data - pandora_delete_old_export_data ($dbh, $ulimit_timestamp); - - # Delete sessions data - pandora_delete_old_session_data ($dbh, $ulimit_timestamp); - - # Delete old inventory data - - # - # Now the log4x data - # - $first_mark = get_db_value_limit ($dbh, 'SELECT utimestamp FROM tagente_datos_log4x ORDER BY utimestamp ASC', 1); - if (defined ($first_mark)) { - $total_time = $ulimit_timestamp - $first_mark; - $purge_steps = int($total_time / $BIG_OPERATION_STEP); - if ($purge_steps > 0) { - for (my $ax = 1; $ax <= $BIG_OPERATION_STEP; $ax++){ - db_do ($dbh, "DELETE FROM tagente_datos_log4x WHERE utimestamp < ". ($first_mark + ($purge_steps * $ax)) . " AND utimestamp >= ". $first_mark ); - log_message ('PURGE', "Log4x data deletion progress %$ax\r"); - # Do a nanosleep here for 0,01 sec - usleep (10000); - } - log_message ('', "\n"); - } else { - log_message ('PURGE', 'No data to purge in tagente_datos_log4x.'); - } - } - else { - log_message ('PURGE', 'No data in tagente_datos_log4x.'); - } - } - else { - log_message ('PURGE', 'days_purge is set to 0. Old data will not be deleted.'); - } - - # String data deletion - if (!defined($conf->{'_string_purge'})){ - $conf->{'_string_purge'} = 7; - } - # Update alert with last_fired older than today - time_threshold - my @templates = get_db_rows ($dbh, 'SELECT t1.id,t1.time_threshold FROM talert_templates t1 WHERE EXISTS ( SELECT * FROM talert_template_modules t2 WHERE t1.id = t2.id_alert_template );'); - foreach my $template(@templates) { - db_do($dbh, 'UPDATE talert_template_modules SET times_fired = 0 WHERE id_alert_template = ? AND times_fired > 0 AND last_fired < (? - ?)',$template->{'id'},time(),$template->{'time_threshold'}); - } - - if ($conf->{'_string_purge'} > 0) { - $ulimit_access_timestamp = time() - 86400; - $ulimit_timestamp = time() - (86400 * $conf->{'_days_purge'}); - pandora_delete_old_module_data ($dbh, 'tagente_datos_string', $ulimit_access_timestamp, $ulimit_timestamp); - } - else { - log_message ('PURGE', 'string_purge is set to 0. Old string data will not be deleted.'); - } - - # Delete event data - if (!defined($conf->{'_event_purge'})){ - $conf->{'_event_purge'}= 10; - } - if ($conf->{'_event_purge'} > 0) { - my $event_limit = time() - 86400 * $conf->{'_event_purge'}; - my $events_table = 'tevento'; - - # If is installed enterprise version and enabled metaconsole, - # check the events history copy and set the name of the metaconsole events table - if (defined($conf->{'_enterprise_installed'}) && $conf->{'_enterprise_installed'} eq '1' && - defined($conf->{'_metaconsole'}) && $conf->{'_metaconsole'} eq '1'){ - - # If events history is enabled, save the new events (not validated or in process) to history database - if(defined($conf->{'_metaconsole_events_history'}) && $conf->{'_metaconsole_events_history'} eq '1') { - log_message ('PURGE', "Moving old not validated events to history table (More than " . $conf->{'_event_purge'} . " days)."); - - my @events = get_db_rows ($dbh, 'SELECT * FROM tmetaconsole_event WHERE estado = 0 AND utimestamp < ?', $event_limit); - foreach my $event (@events) { - db_process_insert($dbh, 'id_evento', 'tmetaconsole_event_history', $event); - db_do($dbh, "DELETE FROM tmetaconsole_event WHERE id_evento =".$event->{'id_evento'}); - } - } - - $events_table = 'tmetaconsole_event'; - } - - log_message ('PURGE', "Deleting old event data at $events_table table (More than " . $conf->{'_event_purge'} . " days).", ''); - - # Delete with buffer to avoid problems with performance - my $events_to_delete = get_db_value ($dbh, "SELECT COUNT(*) FROM $events_table WHERE utimestamp < ?", $event_limit); - while($events_to_delete > 0) { - db_delete_limit($dbh, $events_table, "utimestamp < ?", $BIG_OPERATION_STEP, $event_limit); - $events_to_delete = $events_to_delete - $BIG_OPERATION_STEP; - - # Mark the progress - log_message ('', "."); - - # Do not overload the MySQL server - usleep (10000); - } - log_message ('', "\n"); - - if (defined($conf->{'_enterprise_installed'}) && $conf->{'_enterprise_installed'} eq '1' && - defined($conf->{'_metaconsole'}) && $conf->{'_metaconsole'} eq '1'){ - log_message ('PURGE', "Deleting validated events from tmetaconsole_event_history.", ''); - $events_to_delete = get_db_value ($dbh, "SELECT COUNT(*) FROM tmetaconsole_event_history WHERE estado = 1"); - while($events_to_delete > 0) { - db_delete_limit($dbh, 'tmetaconsole_event_history', 'estado = 1', $BIG_OPERATION_STEP); - $events_to_delete = $events_to_delete - $BIG_OPERATION_STEP; - - # Mark the progress - log_message ('', "."); - - # Do not overload the MySQL server - usleep (10000); - } - log_message ('', "\n"); - } - } - else { - log_message ('PURGE', 'event_purge is set to 0. Old events will not be deleted.'); - } - - # Delete audit data - $conf->{'_audit_purge'}= 7 if (!defined($conf->{'_audit_purge'})); - if ($conf->{'_audit_purge'} > 0) { - log_message ('PURGE', "Deleting old audit data (More than " . $conf->{'_audit_purge'} . " days)."); - my $audit_limit = time() - 86400 * $conf->{'_audit_purge'}; - db_do($dbh, "DELETE FROM tsesion WHERE utimestamp < $audit_limit"); - } - else { - log_message ('PURGE', 'audit_purge is set to 0. Old audit data will not be deleted.'); - } - - # Delete SNMP trap data - $conf->{'_trap_purge'}= 7 if (!defined($conf->{'_trap_purge'})); - if ($conf->{'_trap_purge'} > 0) { - log_message ('PURGE', "Deleting old SNMP traps (More than " . $conf->{'_trap_purge'} . " days)."); - - my $trap_limit = strftime ("%Y-%m-%d %H:%M:%S", localtime(time() - 86400 * $conf->{'_trap_purge'})); - db_do($dbh, "DELETE FROM ttrap WHERE timestamp < '$trap_limit'"); - } - else { - log_message ('PURGE', 'trap_purge is set to 0. Old SNMP traps will not be deleted.'); - } - - # Delete policy queue data - enterprise_hook("pandora_purge_policy_queue", [$dbh, $conf]); - - # Delete policy queue data - enterprise_hook("pandora_purge_service_elements", [$dbh, $conf]); - - # Delete GIS data - $conf->{'_gis_purge'}= 15 if (!defined($conf->{'_gis_purge'})); - if ($conf->{'_gis_purge'} > 0) { - log_message ('PURGE', "Deleting old GIS data (More than " . $conf->{'_gis_purge'} . " days)."); - my $gis_limit = strftime ("%Y-%m-%d %H:%M:%S", localtime(time() - 86400 * $conf->{'_gis_purge'})); - db_do($dbh, "DELETE FROM tgis_data_history WHERE end_timestamp < '$gis_limit'"); - } - else { - log_message ('PURGE', 'gis_purge is set to 0. Old GIS data will not be deleted.'); - } - - # Delete pending modules - log_message ('PURGE', "Deleting pending delete modules (data table).", ''); - my @deleted_modules = get_db_rows ($dbh, 'SELECT id_agente_modulo FROM tagente_modulo WHERE delete_pending = 1'); - foreach my $module (@deleted_modules) { - - my $buffer = 1000; - my $id_module = $module->{'id_agente_modulo'}; - - log_message ('', "."); - - while(1) { - my $nstate = get_db_value ($dbh, 'SELECT count(id_agente_modulo) FROM tagente_estado WHERE id_agente_modulo=?', $id_module); - last if($nstate == 0); - - db_delete_limit ($dbh, 'tagente_estado', 'id_agente_modulo=?', $buffer, $id_module); - } - } - log_message ('', "\n"); - - log_message ('PURGE', "Deleting pending delete modules (status, module table)."); - db_do ($dbh, "DELETE FROM tagente_estado WHERE id_agente_modulo IN (SELECT id_agente_modulo FROM tagente_modulo WHERE delete_pending = 1)"); - db_do ($dbh, "DELETE FROM tagente_modulo WHERE delete_pending = 1"); - - log_message ('PURGE', "Deleting old access data (More than 24hr)"); - - $first_mark = get_db_value_limit ($dbh, 'SELECT utimestamp FROM tagent_access ORDER BY utimestamp ASC', 1); - if (defined ($first_mark)) { - $total_time = $ulimit_access_timestamp - $first_mark; - $purge_steps = int( $total_time / $BIG_OPERATION_STEP); - if ($purge_steps > 0) { - for (my $ax = 1; $ax <= $BIG_OPERATION_STEP; $ax++){ - db_do ($dbh, "DELETE FROM tagent_access WHERE utimestamp < ". ( $first_mark + ($purge_steps * $ax)) . " AND utimestamp >= ". $first_mark); - log_message ('PURGE', "Agent access deletion progress %$ax", "\r"); - # Do a nanosleep here for 0,01 sec - usleep (10000); - } - log_message ('', "\n"); - } else { - log_message ('PURGE', "No agent access data to purge."); - } - } else { - log_message ('PURGE', "No agent access data."); - } - - - - # Purge the reports - if (defined($conf->{'_enterprise_installed'}) && $conf->{'_enterprise_installed'} eq '1' && - defined($conf->{'_metaconsole'}) && $conf->{'_metaconsole'} eq '1'){ - log_message ('PURGE', "Metaconsole enabled, ignoring reports."); - } else { - my @blacklist_types = ("'SLA_services'", "'custom_graph'", "'sql_graph_vbar'", "'sql_graph_hbar'", - "'sql_graph_pie'", "'database_serialized'", "'sql'", "'inventory'", "'inventory_changes'", - "'netflow_area'", "'netflow_pie'", "'netflow_data'", "'netflow_statistics'", "'netflow_summary'"); - my $blacklist_types_str = join(',', @blacklist_types); - - # Deleted modules - log_message ('PURGE', "Delete contents in report that have some deleted modules."); - db_do ($dbh, "DELETE FROM treport_content - WHERE id_agent_module != 0 - AND id_agent_module NOT IN (SELECT id_agente_modulo FROM tagente_modulo) - AND ${RDBMS_QUOTE}type${RDBMS_QUOTE} NOT IN ($blacklist_types_str)"); - db_do ($dbh, "DELETE FROM treport_content_item - WHERE id_agent_module != 0 - AND id_agent_module NOT IN (SELECT id_agente_modulo FROM tagente_modulo) - AND id_report_content NOT IN (SELECT id_rc FROM treport_content WHERE ${RDBMS_QUOTE}type${RDBMS_QUOTE} IN ($blacklist_types_str))"); - db_do ($dbh, "DELETE FROM treport_content_sla_combined - WHERE id_agent_module != 0 - AND id_agent_module NOT IN (SELECT id_agente_modulo FROM tagente_modulo) - AND id_report_content NOT IN (SELECT id_rc FROM treport_content WHERE ${RDBMS_QUOTE}type${RDBMS_QUOTE} = 'SLA_services')"); - - # Deleted agents - log_message ('PURGE', "Delete contents in report that have some deleted agents."); - db_do ($dbh, "DELETE FROM treport_content - WHERE id_agent != 0 - AND id_agent NOT IN (SELECT id_agente FROM tagente) - AND ${RDBMS_QUOTE}type${RDBMS_QUOTE} NOT IN ($blacklist_types_str)"); - - # Empty contents - log_message ('PURGE', "Delete empty contents in report (like SLA or Exception)."); - db_do ($dbh, "DELETE FROM treport_content - WHERE ${RDBMS_QUOTE}type${RDBMS_QUOTE} LIKE 'exception' - AND id_rc NOT IN (SELECT id_report_content FROM treport_content_item)"); - db_do ($dbh, "DELETE FROM treport_content - WHERE ${RDBMS_QUOTE}type${RDBMS_QUOTE} IN ('SLA', 'SLA_monthly', 'SLA_services') - AND id_rc NOT IN (SELECT id_report_content FROM treport_content_sla_combined)"); - } - - - # Delete disabled autodisable agents after some period - log_message ('PURGE', 'Delete autodisabled agents where last contact is bigger than ' . $conf->{'_days_autodisable_deletion'} . ' days.'); - db_do ($dbh, "DELETE FROM tagente - WHERE UNIX_TIMESTAMP(ultimo_contacto) + ? < UNIX_TIMESTAMP(NOW()) - AND disabled=1 - AND modo=2", $conf->{'_days_autodisable_deletion'}*8600); - - - # Delete old netflow data - if ($conf->{'_netflow_max_lifetime'} > 0) { - log_message ('PURGE', "Deleting old netflow data."); - if (! defined ($conf->{'_netflow_path'}) || ! -d $conf->{'_netflow_path'}) { - log_message ('!', "Netflow data directory does not exist, skipping."); - } - elsif (! -x $conf->{'_netflow_nfexpire'}) { - log_message ('!', "Cannot execute " . $conf->{'_netflow_nfexpire'} . ", skipping."); - } - else { - `yes 2>/dev/null | $conf->{'_netflow_nfexpire'} -e "$conf->{'_netflow_path'}" -t $conf->{'_netflow_max_lifetime'}d`; - } - } - else { - log_message ('PURGE', 'netflow_max_lifetime is set to 0. Old netflow data will not be deleted.'); - } - - - - # Delete old log data - log_message ('PURGE', "Deleting old log data."); - if (! defined ($conf->{'_log_dir'}) || ! -d $conf->{'_log_dir'}) { - log_message ('!', "Log data directory does not exist, skipping."); - } - elsif ($conf->{'_log_max_lifetime'} > 0) { - log_message ('PURGE', 'Deleting log data older than ' . $conf->{'_log_max_lifetime'} . ' days.'); - - # Calculate the limit date - my ($sec,$min,$hour,$mday,$mon,$year) = localtime(time() - $conf->{'_log_max_lifetime'} * 86400); - - # Fix the year - $year += 1900; - - # Fix the month - $mon += 1; - $mon = sprintf("%02d", $mon); - - # Fix the day - $mday = sprintf("%02d", $mday); - - # Fix the hour - $hour = sprintf("%02d", $hour); - - # Set the per-depth limits - my $limits = [$year, $mon, $mday, $hour]; - - # Purge the log dir - pandora_purge_log_dir ($conf->{'_log_dir'}, $limits); - } - else { - log_message ('PURGE', 'log_max_lifetime is set to 0. Old log data will not be deleted.'); - } - - # Delete old special days - log_message ('PURGE', "Deleting old special days."); - if ($conf->{'_num_past_special_days'} > 0) { - log_message ('PURGE', 'Deleting special days older than ' . $conf->{'_num_past_special_days'} . ' days.'); - if (${RDBMS} eq 'oracle') { - db_do ($dbh, "DELETE FROM talert_special_days - WHERE \"date\" < SYSDATE - $conf->{'_num_past_special_days'} AND \"date\" > '0001-01-01'"); - } - elsif (${RDBMS} eq 'mysql') { - db_do ($dbh, "DELETE FROM talert_special_days - WHERE date < CURDATE() - $conf->{'_num_past_special_days'} AND date > '0001-01-01'"); - } - } -} - -######################################################################## -# Recursively delete old log files by sub directory. -######################################################################## -sub pandora_purge_log_dir ($$;$) { - my ($dir, $limits, $depth) = @_; - - # Initial call - if (! defined ($depth)) { - $depth = 0; - } - - # No limit for this depth - if (! defined ($limits->[$depth])) { - return; - } - - # Open the dir - my $dir_dh; - if (! opendir($dir_dh, $dir)) { - return; - } - - # Purge sub dirs - while (my $sub_dir = readdir ($dir_dh)) { - - next if ($sub_dir eq '.' || $sub_dir eq '..' || ! -d $dir . '/' . $sub_dir); - - # Sub dirs have names that represent a year, month, day or hour - if ($sub_dir < $limits->[$depth]) { - rmtree ($dir . '/' . $sub_dir); - } elsif ($sub_dir == $limits->[$depth]) { - &pandora_purge_log_dir ($dir . '/' . $sub_dir, $limits, $depth + 1) - } - } - - # Close the dir - closedir ($dir_dh); -} - -############################################################################### -# Compact agent data. -############################################################################### -sub pandora_compactdb ($$) { - my ($conf, $dbh) = @_; - - my %count_hash; - my %id_agent_hash; - my %value_hash; - my %module_proc_hash; - - return if ($conf->{'_days_compact'} == 0 || $conf->{'_step_compact'} < 1); - - # Convert compact interval length from hours to seconds - my $step = $conf->{'_step_compact'} * 3600; - - # The oldest timestamp will be the lower limit - my $limit_utime = get_db_value ($dbh, 'SELECT min(utimestamp) as min FROM tagente_datos'); - return unless (defined ($limit_utime) && $limit_utime > 0); - - # Calculate the start date - my $start_utime = time() - $conf->{'_days_compact'} * 24 * 60 * 60; - my $last_compact = $start_utime; - my $stop_utime; - - # Do not compact the same data twice! - if (defined ($conf->{'_last_compact'}) && $conf->{'_last_compact'} > $limit_utime) { - $limit_utime = $conf->{'_last_compact'}; - } - - if ($start_utime <= $limit_utime) { - log_message ('COMPACT', "Data already compacted."); - return; - } - - log_message ('COMPACT', "Compacting data from " . strftime ("%Y-%m-%d %H:%M:%S", localtime($limit_utime)) . " to " . strftime ("%Y-%m-%d %H:%M:%S", localtime($start_utime)) . '.', ''); - - # Prepare the query to retrieve data from an interval - while (1) { - - # Calculate the stop date for the interval - $stop_utime = $start_utime - $step; - - # Out of limits - last if ($start_utime < $limit_utime); - - # Mark the progress - log_message ('', "."); - - my @data = get_db_rows ($dbh, 'SELECT * FROM tagente_datos WHERE utimestamp < ? AND utimestamp >= ?', $start_utime, $stop_utime); - # No data, move to the next interval - if ($#data == 0) { - $start_utime = $stop_utime; - next; - } - - # Get interval data - foreach my $data (@data) { - my $id_module = $data->{'id_agente_modulo'}; - if (! defined($module_proc_hash{$id_module})) { - my $module_type = get_db_value ($dbh, 'SELECT id_tipo_modulo FROM tagente_modulo WHERE id_agente_modulo = ?', $id_module); - next unless defined ($module_type); - - # Mark proc modules. - if ($module_type == 2 || $module_type == 6 || $module_type == 9 || $module_type == 18 || $module_type == 21 || $module_type == 31) { - $module_proc_hash{$id_module} = 1; - } - else { - $module_proc_hash{$id_module} = 0; - } - } - - # Skip proc modules! - next if ($module_proc_hash{$id_module} == 1); - - if (! defined($value_hash{$id_module})) { - $value_hash{$id_module} = 0; - $count_hash{$id_module} = 0; - - if (! defined($id_agent_hash{$id_module})) { - $id_agent_hash{$id_module} = $data->{'id_agente'}; - } - } - - $value_hash{$id_module} += $data->{'datos'}; - $count_hash{$id_module}++; - } - - # Delete interval from the database - db_do ($dbh, 'DELETE FROM tagente_datos WHERE utimestamp < ? AND utimestamp >= ?', $start_utime, $stop_utime); - - # Insert interval average value - foreach my $key (keys(%value_hash)) { - $value_hash{$key} /= $count_hash{$key}; - db_do ($dbh, 'INSERT INTO tagente_datos (id_agente_modulo, datos, utimestamp) VALUES (?, ?, ?)', $key, $value_hash{$key}, $stop_utime); - delete($value_hash{$key}); - delete($count_hash{$key}); - } - - usleep (1000); # Very small usleep, just to don't burn the DB - # Move to the next interval - $start_utime = $stop_utime; - } - log_message ('', "\n"); - - # Mark the last compact date - if (defined ($conf->{'_last_compact'})) { - db_do ($dbh, 'UPDATE tconfig SET value=? WHERE token=?', $last_compact, 'last_compact'); - } else { - db_do ($dbh, 'INSERT INTO tconfig (value, token) VALUES (?, ?)', $last_compact, 'last_compact'); - } -} - -######################################################################## -# Check command line parameters. -######################################################################## -sub pandora_init ($) { - my $conf = shift; - - log_message ('', "\nPandora FMS DB Tool $version Copyright (c) 2004-2015 Artica ST\n"); - log_message ('', "This program is Free Software, licensed under the terms of GPL License v2\n"); - log_message ('', "You can download latest versions and documentation at http://www.pandorafms.org\n\n"); - - # Load config file from command line - help_screen () if ($#ARGV < 0); - - $conf->{'_pandora_path'} = shift(@ARGV); - $conf->{'_onlypurge'} = 0; - $conf->{'_force'} = 0; - - # If there are valid parameters store it - foreach my $param (@ARGV) { - # help! - help_screen () if ($param =~ m/--*h\w*\z/i ); - if ($param =~ m/-p\z/i) { - $conf->{'_onlypurge'} = 1; - } - elsif ($param =~ m/-v\z/i) { - $conf->{'_verbose'} = 1; - } - elsif ($param =~ m/-q\z/i) { - $conf->{'_quiet'} = 1; - } - elsif ($param =~ m/-d\z/i) { - $conf->{'_debug'} = 1; - } - elsif ($param =~ m/-f\z/i) { - $conf->{'_force'} = 1; - } - } - - help_screen () if ($conf->{'_pandora_path'} eq ''); -} - - -######################################################################## -# Read external configuration file. -######################################################################## -sub pandora_load_config ($) { - my $conf = shift; - - # Read conf file - open (CFG, '< ' . $conf->{'_pandora_path'}) or die ("[ERROR] Could not open configuration file: $!\n"); - while (my $line = ){ - next unless ($line =~ /^(\S+)\s+(.*)\s+$/); - $conf->{$1} = clean_blank($2); - } - close (CFG); - - # Check conf tokens - foreach my $param ('dbuser', 'dbpass', 'dbname', 'dbhost', 'log_file') { - die ("[ERROR] Bad config values. Make sure " . $conf->{'_pandora_path'} . " is a valid config file.\n\n") unless defined ($conf->{$param}); - } - $conf->{'dbengine'} = 'mysql' unless defined ($conf->{'dbengine'}); - $conf->{'dbport'} = '3306' unless defined ($conf->{'dbport'}); - $conf->{'claim_back_snmp_modules'} = '1' unless defined ($conf->{'claim_back_snmp_modules'}); - - # Dynamic interval configuration. - $conf->{"dynamic_constant"} = 0.10 unless defined($conf->{"dynamic_constant"}); - $conf->{"dynamic_warning"} = 0.10 unless defined($conf->{"dynamic_warning"}); - $conf->{"dynamic_updates"} = 5 unless defined($conf->{"dynamic_updates"}); - - # workaround for name unconsistency (corresponding entry at pandora_server.conf is 'errorlog_file') - $conf->{'errorlogfile'} = $conf->{'errorlog_file'}; - $conf->{'errorlogfile'} = "/var/log/pandora_server.error" unless defined ($conf->{'errorlogfile'}); - - # Read additional tokens from the DB - my $dbh = db_connect ($conf->{'dbengine'}, $conf->{'dbname'}, $conf->{'dbhost'}, $conf->{'dbport'}, $conf->{'dbuser'}, $conf->{'dbpass'}); - - $conf->{'_event_purge'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'event_purge'"); - $conf->{'_trap_purge'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'trap_purge'"); - $conf->{'_audit_purge'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'audit_purge'"); - $conf->{'_string_purge'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'string_purge'"); - $conf->{'_gis_purge'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'gis_purge'"); - - $conf->{'_days_purge'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'days_purge'"); - $conf->{'_days_compact'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'days_compact'"); - $conf->{'_last_compact'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'last_compact'"); - $conf->{'_step_compact'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'step_compact'"); - $conf->{'_history_db_enabled'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'history_db_enabled'"); - $conf->{'_history_event_enabled'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'history_event_enabled'"); - $conf->{'_history_db_host'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'history_db_host'"); - $conf->{'_history_db_port'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'history_db_port'"); - $conf->{'_history_db_name'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'history_db_name'"); - $conf->{'_history_db_user'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'history_db_user'"); - $conf->{'_history_db_pass'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'history_db_pass'"); - $conf->{'_history_db_days'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'history_db_days'"); - $conf->{'_history_event_days'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'history_event_days'"); - $conf->{'_history_db_step'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'history_db_step'"); - $conf->{'_history_db_delay'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'history_db_delay'"); - $conf->{'_days_delete_unknown'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'days_delete_unknown'"); - $conf->{'_inventory_purge'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'inventory_purge'"); - $conf->{'_enterprise_installed'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'enterprise_installed'"); - $conf->{'_metaconsole'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'metaconsole'"); - $conf->{'_metaconsole_events_history'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'metaconsole_events_history'"); - $conf->{'_netflow_max_lifetime'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'netflow_max_lifetime'"); - $conf->{'_netflow_nfexpire'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'netflow_nfexpire'"); - $conf->{'_netflow_path'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'netflow_path'"); - $conf->{'_log_dir'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'log_dir'"); - $conf->{'_log_max_lifetime'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'log_max_lifetime'"); - $conf->{'_delete_notinit'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'delete_notinit'"); - - $conf->{'_big_operation_step_datos_purge'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'big_operation_step_datos_purge'"); - $conf->{'_small_operation_step_datos_purge'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'small_operation_step_datos_purge'"); - $conf->{'_days_autodisable_deletion'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'days_autodisable_deletion'"); - - $BIG_OPERATION_STEP = $conf->{'_big_operation_step_datos_purge'} - if ( $conf->{'_big_operation_step_datos_purge'} ); - $SMALL_OPERATION_STEP = $conf->{'_small_operation_step_datos_purge'} - if ( $conf->{'_small_operation_step_datos_purge'} ); - - $conf->{'_num_past_special_days'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'num_past_special_days'"); - - db_disconnect ($dbh); - - log_message ('', "Pandora DB now initialized and running (PURGE=" . $conf->{'_days_purge'} . " days, COMPACT=$conf->{'_days_compact'} days, STEP=" . $conf->{'_step_compact'} . ") . \n\n"); -} - - -############################################################################### -# Check database integrity -############################################################################### - -sub pandora_checkdb_integrity { - my $dbh = shift; - - log_message ('INTEGRITY', "Cleaning up group stats."); - - # Delete all records on tgroup_stats - db_do ($dbh, 'DELETE FROM tgroup_stat'); - - - #print "[INTEGRITY] Deleting non-used IP addresses \n"; - # DISABLED - Takes too much time and benefits of this are unclear.. - # Delete all non-used IP addresses from taddress - #db_do ($dbh, 'DELETE FROM taddress WHERE id_a NOT IN (SELECT id_a FROM taddress_agent)'); - - log_message ('INTEGRITY', "Deleting orphan alerts."); - - # Delete alerts assigned to inexistant modules - db_do ($dbh, 'DELETE FROM talert_template_modules WHERE id_agent_module NOT IN (SELECT id_agente_modulo FROM tagente_modulo)'); - - log_message ('INTEGRITY', "Deleting orphan modules."); - - # Delete orphan modules in tagente_modulo - db_do ($dbh, 'DELETE FROM tagente_modulo WHERE id_agente NOT IN (SELECT id_agente FROM tagente)'); - - # Delete orphan modules in tagente_estado - while (defined (get_db_value ($dbh, 'SELECT id_agente FROM tagente_estado WHERE id_agente NOT IN (SELECT id_agente FROM tagente)'))) { - db_delete_limit ($dbh, 'tagente_estado', 'id_agente NOT IN (SELECT id_agente FROM tagente)', $BIG_OPERATION_STEP); - } - - # Delete orphan data_inc reference records - db_do ($dbh, 'DELETE FROM tagente_datos_inc WHERE id_agente_modulo NOT IN (SELECT id_agente_modulo FROM tagente_modulo)'); - - # Check enterprise tables - enterprise_hook ('pandora_checkdb_integrity_enterprise', [$dbh]); -} - -############################################################################### -# Check database consistency. -############################################################################### -sub pandora_checkdb_consistency { - my ($conf, $dbh) = @_; - - #------------------------------------------------------------------- - # 1. Check for modules that do not have tagente_estado but have - # tagente_module - #------------------------------------------------------------------- - if (defined($conf->{'_delete_notinit'}) && $conf->{'_delete_notinit'} == 1) { - log_message ('CHECKDB', "Deleting not-init data."); - my @modules = get_db_rows ($dbh, - 'SELECT id_agente_modulo, id_agente - FROM tagente_estado - WHERE estado = 4'); - - foreach my $module (@modules) { - my $id_agente_modulo = $module->{'id_agente_modulo'}; - my $id_agente = $module->{'id_agente'}; - - # Skip policy modules - my $is_policy_module = enterprise_hook('is_policy_module', - [$dbh, $id_agente_modulo]); - next if (defined($is_policy_module) && $is_policy_module); - - # Skip if agent is disabled - my $is_agent_disabled = get_db_value ($dbh, - 'SELECT disabled - FROM tagente - WHERE id_agente = ?', $module->{'id_agente'}); - next if (defined($is_agent_disabled) && $is_agent_disabled); - - # Skip if module is disabled - my $is_module_disabled = get_db_value ($dbh, - 'SELECT disabled - FROM tagente_modulo - WHERE id_agente_modulo = ?', $module->{'id_agente_modulo'}); - next if (defined($is_module_disabled) && $is_module_disabled); - - - #--------------------------------------------------------------- - # Delete the module - #--------------------------------------------------------------- - # Mark the agent for module and alert counters update - db_do ($dbh, - 'UPDATE tagente - SET update_module_count = 1, update_alert_count = 1 - WHERE id_agente = ?', $id_agente); - - # Delete the module - db_do ($dbh, - 'DELETE FROM tagente_modulo - WHERE id_agente_modulo = ?', $id_agente_modulo); - - # Do a nanosleep here for 0,001 sec - usleep (100000); - - # Delete any alerts associated to the module - db_do ($dbh, - 'DELETE FROM talert_template_modules - WHERE id_agent_module = ?', $id_agente_modulo); - } - } else { - log_message ('CHECKDB', "Ignoring not-init data."); - } - - log_message ('CHECKDB', - "Deleting unknown data (More than " . $conf{'_days_delete_unknown'} . " days)."); - - if (defined($conf{'_days_delete_unknown'}) && $conf{'_days_delete_unknown'} > 0) { - my @modules = get_db_rows($dbh, - 'SELECT tagente_modulo.id_agente_modulo, tagente_modulo.id_agente - FROM tagente_modulo, tagente_estado - WHERE tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo - AND estado = 3 - AND utimestamp < UNIX_TIMESTAMP() - ?', - 86400 * $conf{'_days_delete_unknown'}); - - foreach my $module (@modules) { - my $id_agente = $module->{'id_agente'}; - my $id_agente_modulo = $module->{'id_agente_modulo'}; - - # Skip policy modules - my $is_policy_module = enterprise_hook('is_policy_module', - [$dbh, $id_agente_modulo]); - next if (defined($is_policy_module) && $is_policy_module); - - # Mark the agent for module and alert counters update - db_do ($dbh, - 'UPDATE tagente - SET update_module_count = 1, update_alert_count = 1 - WHERE id_agente = ?', $id_agente); - - # Delete the module - db_do ($dbh, - 'DELETE FROM tagente_modulo - WHERE disabled = 0 - AND id_agente_modulo = ?', $id_agente_modulo); - - # Do a nanosleep here for 0,001 sec - usleep (100000); - - # Delete any alerts associated to the module - db_do ($dbh, 'DELETE FROM talert_template_modules - WHERE id_agent_module = ? - AND NOT EXISTS (SELECT id_agente_modulo - FROM tagente_modulo - WHERE id_agente_modulo = ?)', - $id_agente_modulo, $id_agente_modulo); - - # Do a nanosleep here for 0,001 sec - usleep (100000); - } - } - log_message ('CHECKDB', - "Checking database consistency (Missing status)."); - - my @modules = get_db_rows ($dbh, 'SELECT * FROM tagente_modulo'); - foreach my $module (@modules) { - my $id_agente_modulo = $module->{'id_agente_modulo'}; - my $id_agente = $module->{'id_agente'}; - - # check if exist in tagente_estado and create if not - my $count = get_db_value ($dbh, - 'SELECT COUNT(*) - FROM tagente_estado - WHERE id_agente_modulo = ?', $id_agente_modulo); - next if (defined ($count) && $count > 0); - - db_do ($dbh, - 'INSERT INTO tagente_estado (id_agente_modulo, datos, timestamp, estado, id_agente, last_try, utimestamp, current_interval, running_by, last_execution_try) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', $id_agente_modulo, 0, '1970-01-01 00:00:00', 1, $id_agente, '1970-01-01 00:00:00', 0, 0, 0, 0); - log_message ('CHECKDB', - "Inserting module $id_agente_modulo in state table."); - } - - log_message ('CHECKDB', - "Checking database consistency (Missing module)."); - - #------------------------------------------------------------------- - # 2. Check for modules in tagente_estado that do not have - # tagente_modulo, if there is any, delete it - #------------------------------------------------------------------- - - @modules = get_db_rows ($dbh, 'SELECT * FROM tagente_estado'); - foreach my $module (@modules) { - my $id_agente_modulo = $module->{'id_agente_modulo'}; - - # check if exist in tagente_estado and create if not - my $count = get_db_value ($dbh, - 'SELECT COUNT(*) - FROM tagente_modulo - WHERE id_agente_modulo = ?', $id_agente_modulo); - next if (defined ($count) && $count > 0); - - db_do ($dbh, 'DELETE FROM tagente_estado - WHERE id_agente_modulo = ?', $id_agente_modulo); - - # Do a nanosleep here for 0,001 sec - usleep (100000); - - log_message ('CHECKDB', - "Deleting non-existing module $id_agente_modulo in state table."); - } - - #------------------------------------------------------------------- - # 3. Update empty aliases. - #------------------------------------------------------------------- - log_message ('CHECKDB', "Updating empty aliases."); - db_do ($dbh, "UPDATE tagente SET alias=nombre WHERE alias=''"); -} - -############################################################################## -# Print a help screen and exit. -############################################################################## -sub help_screen{ - log_message ('', "Usage: $0 [options]\n\n"); - log_message ('', "\t\t-p Only purge and consistency check, skip compact.\n"); - log_message ('', "\t\t-f Force execution event if another instance of $0 is running.\n\n"); - exit -1; -} - -############################################################################## -# Delete old module data. -############################################################################## -sub pandora_delete_old_module_data { - my ($dbh, $table, $ulimit_access_timestamp, $ulimit_timestamp) = @_; - - my $first_mark; - my $total_time; - my $purge_steps; - my $purge_count; - - my $mark1; - my $mark2; - - # This could be very timing consuming, so make this operation in $BIG_OPERATION_STEP - # steps (100 fixed by default) - # Starting from the oldest record on the table - - # WARNING. This code is EXTREMELLY important. This block (data deletion) could KILL a database if - # you alter code and you don't know exactly what are you doing. Please take in mind this code executes each hour - # and has been patches MANY times. Before altering anything, think twice ! - - $first_mark = get_db_value_limit ($dbh, "SELECT utimestamp FROM $table ORDER BY utimestamp ASC", 1); - if (defined ($first_mark)) { - $total_time = $ulimit_timestamp - $first_mark; - $purge_steps = int($total_time / $BIG_OPERATION_STEP); - if ($purge_steps > 0) { - for (my $ax = 1; $ax <= $BIG_OPERATION_STEP; $ax++){ - - $mark1 = $first_mark + ($purge_steps * $ax); - $mark2 = $first_mark + ($purge_steps * ($ax -1)); - - # Let's split the intervals in $SMALL_OPERATION_STEP deletes each - $purge_count = get_db_value ($dbh, "SELECT COUNT(id_agente_modulo) FROM $table WHERE utimestamp < $mark1 AND utimestamp >= $mark2"); - while ($purge_count > 0){ - db_delete_limit ($dbh, $table, 'utimestamp < ? AND utimestamp >= ?', $SMALL_OPERATION_STEP, $mark1, $mark2); - # Do a nanosleep here for 0,001 sec - usleep (10000); - $purge_count = $purge_count - $SMALL_OPERATION_STEP; - } - - log_message ('PURGE', "Deleting old data from $table. $ax%", "\r"); - } - log_message ('', "\n"); - } else { - log_message ('PURGE', "No data to purge in $table."); - } - } else { - log_message ('PURGE', "No data in $table."); - } -} - -############################################################################## -# Delete old export data. -############################################################################## -sub pandora_delete_old_export_data { - my ($dbh, $ulimit_timestamp) = @_; - - log_message ('PURGE', "Deleting old export data from tserver_export_data\n"); - while((my $rc = db_delete_limit ($dbh, 'tserver_export_data', 'UNIX_TIMESTAMP(timestamp) < ?', $SMALL_OPERATION_STEP, $ulimit_timestamp)) ne '0E0') { - print "RC:$rc\n"; - usleep (10000); - }; -} - -############################################################################## -# Delete old session data. -############################################################################## -sub pandora_delete_old_session_data { - my ($dbh, $ulimit_timestamp) = @_; - - log_message ('PURGE', "Deleting old session data from tsessions_php\n"); - while(db_delete_limit ($dbh, 'tsessions_php', 'last_active < ?', $SMALL_OPERATION_STEP, $ulimit_timestamp) ne '0E0') { - usleep (10000); - }; -} - -############################################################################### -# Main -############################################################################### -sub pandoradb_main ($$$) { - my ($conf, $dbh, $history_dbh) = @_; - - log_message ('', "Starting at ". strftime ("%Y-%m-%d %H:%M:%S", localtime()) . "\n"); - - # Purge - pandora_purgedb ($conf, $dbh); - - # Consistency check - pandora_checkdb_consistency ($conf, $dbh); - - # Maintain Referential integrity and other stuff - pandora_checkdb_integrity ($dbh); - - # Move old data to the history DB - if (defined ($history_dbh)) { - undef ($history_dbh) unless defined (enterprise_hook ('pandora_historydb', [$dbh, $history_dbh, $conf->{'_history_db_days'}, $conf->{'_history_db_step'}, $conf->{'_history_db_delay'}])); - if (defined($conf{'_history_event_enabled'})) { - undef ($history_dbh) unless defined (enterprise_hook ('pandora_history_event', [$dbh, $history_dbh, $conf->{'_history_event_days'}, $conf->{'_history_db_step'}, $conf->{'_history_db_delay'}])); - } - } - - # Compact on if enable and DaysCompact are below DaysPurge - if (($conf->{'_onlypurge'} == 0) && ($conf->{'_days_compact'} < $conf->{'_days_purge'})) { - pandora_compactdb ($conf, defined ($history_dbh) ? $history_dbh : $dbh); - } - - # Update tconfig with last time of database maintance time (now) - db_do ($dbh, "DELETE FROM tconfig WHERE token = 'db_maintance'"); - db_do ($dbh, "INSERT INTO tconfig (token, value) VALUES ('db_maintance', '".time()."')"); - - # Move SNMP modules back to the Enterprise server - enterprise_hook("claim_back_snmp_modules", [$dbh, $conf]); - - # Recalculating dynamic intervals. - enterprise_hook("update_min_max", [$dbh, $conf]); - - log_message ('', "Ending at ". strftime ("%Y-%m-%d %H:%M:%S", localtime()) . "\n"); -} - -# Init -pandora_init(\%conf); - -# Read config file -pandora_load_config (\%conf); - -# Load enterprise module -if (enterprise_load (\%conf) == 0) { - log_message ('', " [*] Pandora FMS Enterprise module not available.\n\n"); -} -else { - log_message ('', " [*] Pandora FMS Enterprise module loaded.\n\n"); -} - -# Connect to the DB -my $dbh = db_connect ($conf{'dbengine'}, $conf{'dbname'}, $conf{'dbhost'}, $conf{'dbport'}, $conf{'dbuser'}, $conf{'dbpass'}); -my $history_dbh = ($conf{'_history_db_enabled'} eq '1') ? db_connect ($conf{'dbengine'}, $conf{'_history_db_name'}, - $conf{'_history_db_host'}, $conf{'_history_db_port'}, $conf{'_history_db_user'}, $conf{'_history_db_pass'}) : undef; - -# Get a lock -my $lock = db_get_lock ($dbh, 'pandora_db'); -if ($lock == 0 && $conf{'_force'} == 0) { - log_message ('', " [*] Another instance of pandora_db seems to be running.\n\n"); - exit 1; -} - -# Main -pandoradb_main(\%conf, $dbh, $history_dbh); - -# Cleanup and exit -db_disconnect ($history_dbh) if defined ($history_dbh); -db_disconnect ($dbh); - -# Release the lock -if ($lock == 1) { - db_release_lock ($dbh, 'pandora_db'); -} - -exit 0; diff --git a/pandora_server/util/pandora_manage.pl.orig b/pandora_server/util/pandora_manage.pl.orig deleted file mode 100644 index 0173794d59..0000000000 --- a/pandora_server/util/pandora_manage.pl.orig +++ /dev/null @@ -1,5529 +0,0 @@ -#!/usr/bin/perl - -############################################################################### -# Pandora FMS General Management Tool -############################################################################### -# Copyright (c) 2015 Artica Soluciones Tecnologicas S.L -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License version 2 -############################################################################### - -# Includes list -use strict; -use Time::Local; # DateTime basic manipulation -use DBI; # DB interface with MySQL -use POSIX qw(strftime); -use POSIX; -use HTML::Entities; # Encode or decode strings with HTML entities -use File::Basename; -use JSON qw(decode_json encode_json); -use MIME::Base64; -use Encode qw(decode encode_utf8); -use LWP::Simple; - -# Default lib dir for RPM and DEB packages -use lib '/usr/lib/perl5'; - -use PandoraFMS::Tools; -use PandoraFMS::DB; -use PandoraFMS::Core; -use PandoraFMS::Config; - -# To handle 'UTF-8' encoded string in command like arguments (similar to "-CA" option for perl) -use Encode::Locale; -Encode::Locale::decode_argv; - -# version: define current version -<<<<<<< HEAD -my $version = "7.0NG PS170406"; -======= -my $version = "7.0NG PS170418"; ->>>>>>> develop - -# save program name for logging -my $progname = basename($0); - -# Parameter -my $param; - -# Initialize MD5 variables -md5_init (); - -# Pandora server configuration -my %conf; - -# FLUSH in each IO -$| = 0; - -# Init -pandora_manage_init(\%conf); - -# Read config file -pandora_load_config (\%conf); - -# Load enterprise module -my $enterprise_msg; -if (enterprise_load (\%conf) == 0) { - $enterprise_msg = "[*] Pandora FMS Enterprise module not available."; -} else { - $enterprise_msg = "[*] Pandora FMS Enterprise module loaded."; -} - -# Connect to the DB -my $dbh = db_connect ($conf{'dbengine'}, $conf{'dbname'}, $conf{'dbhost'}, $conf{'dbport'}, $conf{'dbuser'}, $conf{'dbpass'}); -my $history_dbh = ($conf{'_history_db_enabled'} eq '1') ? db_connect ('mysql', $conf{'_history_db_name'}, - $conf{'_history_db_host'}, '3306', $conf{'_history_db_user'}, $conf{'_history_db_pass'}) : undef; - -# Read shared config file -pandora_get_sharedconfig (\%conf, $dbh); - -my $conf = \%conf; - -# Main -pandora_manage_main(\%conf, $dbh, $history_dbh); - -# Cleanup and exit -db_disconnect ($history_dbh) if defined ($history_dbh); -db_disconnect ($dbh); -exit; - -######################################################################## -######################################################################## -# GENERAL FUNCTIONS -######################################################################## -######################################################################## - -######################################################################## -# Print a help screen and exit. -######################################################################## -sub help_screen{ - print "\nPandora FMS CLI $version Copyright (c) 2013-2015 Artica ST\n"; - print "This program is Free Software, licensed under the terms of GPL License v2\n"; - print "You can download latest versions and documentation at http://www.pandorafms.org\n\n"; - print "$enterprise_msg\n\n"; - print "Usage: $0 [options] \n\n" unless $param ne ''; - print "Available options by category:\n\n" unless $param ne ''; - print "Available options for $param:\n\n" unless $param eq ''; - print "AGENTS:\n\n" unless $param ne ''; - help_screen_line('--create_agent', " \n\t [
]", 'Create agent'); - help_screen_line('--update_agent', ' ', "Update an agent field. The fields can be \n\t the following: agent_name, address, description, group_name, interval, os_name, disabled (0-1), \n\t parent_name, cascade_protection (0-1), icon_path, update_gis_data (0-1), custom_id"); - help_screen_line('--delete_agent', '', 'Delete agent'); - help_screen_line('--disable_group', '', 'Disable agents from an entire group'); - help_screen_line('--enable_group', '', 'Enable agents from an entire group'); - help_screen_line('--create_group', ' [ ]', 'Create an agent group'); - help_screen_line('--delete_group', '', 'Delete an agent group'); - help_screen_line('--update_group', '','[ ]', 'Update an agent group'); - help_screen_line('--stop_downtime', '', 'Stop a planned downtime'); - help_screen_line('--create_downtime', " \n\t \n\t ", 'Create a planned downtime'); - help_screen_line('--add_item_planned_downtime', " ", 'Add a items planned downtime'); - help_screen_line('--get_all_planned_downtimes', ' [ ]', 'Get all planned downtime'); - help_screen_line('--get_planned_downtimes_items', ' [ ]', 'Get all items of planned downtimes'); - help_screen_line('--set_planned_downtimes_deleted', ' ', 'Deleted a planned downtime'); - help_screen_line('--get_module_id', ' ', 'Get the id of an module'); - help_screen_line('--get_agent_group', '', 'Get the group name of an agent'); - help_screen_line('--get_agent_group_id', '', 'Get the group ID of an agent'); - help_screen_line('--get_agent_modules', '', 'Get the modules of an agent'); - help_screen_line('--get_agents', '[ ]', "Get \n\t list of agents with optative filter parameters"); - help_screen_line('--delete_conf_file', '', 'Delete a local conf of a given agent'); - help_screen_line('--clean_conf_file', '', "Clean a local conf of a given agent deleting all modules, \n\t policies, file collections and comments"); - help_screen_line('--get_bad_conf_files', '', 'Get the files bad configured (without essential tokens)'); - help_screen_line('--locate_agent', '', 'Search a agent into of nodes of metaconsole. Only Enterprise.'); - print "\nMODULES:\n\n" unless $param ne ''; - help_screen_line('--create_data_module', " [ \n\t \n\t \n\t \n\t \n\t ]", 'Add data server module to agent'); - help_screen_line('--create_web_module', " [ \n\t \n\t \n\t \n\t \n\t ].\n\t The valid data types are web_data, web_proc, web_content_data or web_content_string", 'Add web server module to agent'); - help_screen_line('--create_network_module', " \n\t [ \n\t \n\t \n\t \n\t \n\t ]", 'Add not snmp network module to agent'); - help_screen_line('--create_snmp_module', " \n\t [ \n\t \n\t \n\t \n\t \n\t - \n\t \n\t ]", 'Add snmp network module to agent'); - help_screen_line('--create_plugin_module', " \n\t [ \n\t \n\t \n\t \n\t \n\t \n\t ]", 'Add plug-in module to agent'); - help_screen_line('--create_module_group', ''); - help_screen_line('--delete_module', 'Delete module from agent', ' '); - help_screen_line('--data_module', " \n\t []", 'Insert data to module'); - help_screen_line('--get_module_data', " []", "\n\t Show the data of a module in the last X seconds (interval) in CSV format"); - help_screen_line('--delete_data', '-m | -a | -g ', "Delete historic \n\t data of a module, the modules of an agent or the modules of the agents of a group"); - help_screen_line('--update_module', ' ', 'Update a module field'); - help_screen_line('--get_agents_module_current_data', '', "Get the agent and current data \n\t of all the modules with a given name"); - help_screen_line('--create_network_module_from_component', ' ', "Create a new network \n\t module from a network component"); - help_screen_line('--create_synthetic', " ,,|, \n\t [ , | ,, ]", "Create a new Synthetic module"); - print "\nALERTS:\n\n" unless $param ne ''; - help_screen_line('--create_template_module', ' ', 'Add alert template to module'); - help_screen_line('--delete_template_module', ' ', 'Delete alert template from module'); - help_screen_line('--create_template_action', " \n\t [ ]', 'Add alert action to module-template"); - help_screen_line('--delete_template_action', " \n\t ", 'Delete alert action from module-template'); - help_screen_line('--disable_alerts', '', 'Disable alerts in all groups (system wide)'); - help_screen_line('--enable_alerts', '', 'Enable alerts in all groups (system wide)'); - help_screen_line('--create_alert_template', " \n\t [ \n\t \n\t \n\t ]", 'Create alert template'); - help_screen_line('--delete_alert_template', '', 'Delete alert template'); - help_screen_line('--update_alert_template', " \n\t ", 'Update a field of an alert template'); - help_screen_line('--validate_all_alerts', '', 'Validate all the alerts'); - help_screen_line('--create_special_day', " ", 'Create special day'); - help_screen_line('--delete_special_day', '', 'Delete special day'); - help_screen_line('--update_special_day', " ", 'Update a field of a special day'); - help_screen_line('--create_data_module_from_local_component', ' ', "Create a new data \n\t module from a local component"); - help_screen_line('--create_web_module_from_local_component', ' ', "Create a new web \n\t module from a local component"); - help_screen_line('--create_local_component', " [ \n\t \n\t \n\t \n\t \n\t \n\t \n\t \n\t ]", 'Create local component'); - - print "\nUSERS:\n\n" unless $param ne ''; - help_screen_line('--create_user', ' []', 'Create user'); - help_screen_line('--delete_user', '', 'Delete user'); - help_screen_line('--update_user', ' ', "Update a user field. The fields\n\t can be the following: email, phone, is_admin (0-1), language, id_skin, flash_chart (0-1)\n\t , comments, fullname, password"); - help_screen_line('--enable_user', '', 'Enable a given user'); - help_screen_line('--disable_user', '', 'Disable a given user'); - help_screen_line('--add_profile', ' ', 'Add perfil to user'); - help_screen_line('--delete_profile', ' ', 'Delete perfil from user'); - help_screen_line('--add_profile_to_user', ' []', 'Add a profile in group to a user'); - help_screen_line('--create_profile', " \n\t \n\t \n\t \n\t ", 'Create profile'); - help_screen_line('--disable_eacl', '', 'Disable enterprise ACL system'); - help_screen_line('--enable_eacl', '', 'Enable enterprise ACL system'); - help_screen_line('--disable_double_auth', '', 'Disable the double authentication for the specified user'); - print "\nEVENTS:\n\n" unless $param ne ''; - help_screen_line('--create_event', " [ \n\t \n\t ]", 'Add event'); - help_screen_line('--validate_event', " \n\t ", 'Validate events'); - help_screen_line('--validate_event_id', '', 'Validate event given a event id'); - help_screen_line('--get_event_info', '[]', 'Show info about a event given a event id'); - help_screen_line('--add_event_comment', ' ', 'Add event\'s comment'); - print "\nINCIDENTS:\n\n" unless $param ne ''; - help_screen_line('--create_incident', " <description> <origin> <status> <priority 0 for Informative, \n\t 1 for Low, 2 for Medium, 3 for Serious, 4 for Very serious or 5 for Maintenance>\n\t <group> [<owner>]", 'Create incidents'); - print "\nPOLICIES:\n\n" unless $param ne ''; - help_screen_line('--apply_policy', '<policy_name>', 'Force apply a policy'); - help_screen_line('--apply_all_policies', '', 'Force apply to all the policies'); - help_screen_line('--add_agent_to_policy', '<agent_name> <policy_name>', 'Add an agent to a policy'); - help_screen_line('--delete_not_policy_modules', '', 'Delete all modules without policy from configuration file'); - help_screen_line('--disable_policy_alerts', '<policy_name>', 'Disable all the alerts of a policy'); - help_screen_line('--create_policy', '<policy_name> <group_name> <description>'); - help_screen_line('--create_policy_data_module', "<policy_name> <module_name> <module_type> [<description> \n\t <module_group> <min> <max> <post_process> <interval> <warning_min> <warning_max> \n\t <critical_min> <critical_max> <history_data> <data_configuration> <warning_str> \n\t <critical_str> <unknown_events> <ff_threshold> <each_ff>\n\t <ff_threshold_normal> <ff_threshold_warning> <ff_threshold_critical>\n\t <ff_timeout> <critical_instructions> <warning_instructions> <unknown_instructions>\n\t <warning_inverse> <critical_inverse>]", 'Add data server module to policy'); - help_screen_line('--create_policy_web_module', "<policy_name> <module_name> <module_type> [<description> \n\t <module_group> <min> <max> <post_process> <interval> <warning_min> <warning_max> \n\t <critical_min> <critical_max> <history_data> <data_configuration> <warning_str> \n\t <critical_str> <unknown_events> <ff_threshold> <each_ff>\n\t <ff_threshold_normal> <ff_threshold_warning> <ff_threshold_critical>\n\t <ff_timeout> <critical_instructions> <warning_instructions> <unknown_instructions>\n\t <warning_inverse> <critical_inverse>].\n\t The valid data types are web_data, web_proc, web_content_data or web_content_string", 'Add web server module to policy'); - help_screen_line('--create_policy_network_module', "<policy_name> <module_name> <module_type> [<module_port> \n\t <description> <module_group> <min> <max> <post_process> <interval> \n\t <warning_min> <warning_max> <critical_min> <critical_max> <history_data> <ff_threshold> \n\t <warning_str> <critical_str> <unknown_events> <each_ff>\n\t <ff_threshold_normal> <ff_threshold_warning> <ff_threshold_critical>\n\t <critical_instructions> <warning_instructions> <unknown_instructions>\n\t <warning_inverse> <critical_inverse>]", "Add not snmp network module to policy"); - help_screen_line('--create_policy_snmp_module', "<policy_name> <module_name> <module_type> <module_port> \n\t <version> [<community> <oid> <description> <module_group> <min> <max> \n\t <post_process> <interval> <warning_min> <warning_max> <critical_min> <critical_max> <history_data>\n\t <snmp3_priv_method> <snmp3_priv_pass> <snmp3_sec_level> <snmp3_auth_method> <snmp3_auth_user> \n\t <snmp3_priv_pass> <ff_threshold> <warning_str> <critical_str>\n\t <unknown_events> <each_ff> <ff_threshold_normal>\n\t <ff_threshold_warning> <ff_threshold_critical>\n\t - <critical_instructions> <warning_instructions> <unknown_instructions>\n\t <warning_inverse> <critical_inverse>]", 'Add snmp network module to policy'); - help_screen_line('--create_policy_plugin_module', "<policy_name> <module_name> <module_type> \n\t <module_port> <plugin_name> <user> <password> <parameters> [<description> <module_group> <min> \n\t <max> <post_process> <interval> <warning_min> <warning_max> <critical_min> <critical_max>\n\t <history_data> <ff_threshold> <warning_str> <critical_str>\n\t <unknown_events> <each_ff> <ff_threshold_normal>\n\t <ff_threshold_warning> <ff_threshold_critical>\n\t <critical_instructions> <warning_instructions> <unknown_instructions>\n\t <warning_inverse> <critical_inverse>]", 'Add plug-in module to policy'); - help_screen_line('--create_policy_data_module_from_local_component', '<policy_name> <component_name>'); - help_screen_line('--create_policy_web_module_from_local_component', '<policy_name> <component_name>'); - help_screen_line('--add_collection_to_policy', "<policy_name> <collection_name>"); - help_screen_line('--validate_policy_alerts', '<policy_name>', 'Validate the alerts of a given policy'); - help_screen_line('--get_policy_modules', '<policy_name>', 'Get the modules of a policy'); - help_screen_line('--get_policies', '[<agent_name>]', "Get all the policies (without parameters) or \n\tthe policies of a given agent (agent name as parameter)"); - help_screen_line('--recreate_collection', '<collection_id>', 'Recreate the files of a collection'); - - print "\nNETFLOW:\n\n" unless $param ne ''; - help_screen_line('--create_netflow_filter', "<filter_name> <group_name> <filter> \n\t <aggregate_by dstip|dstport|none|proto|srcip|srcport> <output_format kilobytes|kilobytespersecond|\n\t megabytes|megabytespersecond>", "Create a new netflow filter"); - print "\nTOOLS:\n\n" unless $param ne ''; - help_screen_line('--exec_from_file', '<file_path> <option_to_execute> <option_params>', "Execute any CLI option \n\t with macros from CSV file"); - help_screen_line('--create_snmp_trap', '<name> <oid> <description> <severity>', "Create a new trap definition. \n\tSeverity 0 (Maintenance), 1(Info) , 2 (Normal), 3 (Warning), 4 (Critical), 5 (Minor) and 6 (Major)"); - print "\nSETUP:\n\n" unless $param ne ''; - help_screen_line('--set_event_storm_protection', '<value>', "Enable (1) or disable (0) event \n\t storm protection"); - - print "\nTAGS\n\n" unless $param ne ''; - help_screen_line('--create_tag', '<tag_name> <tag_description> [<tag_url>] [<tag_email>]', 'Create a new tag'); - help_screen_line('--add_tag_to_user_profile', '<user_id> <tag_name> <group_name> <profile_name>', 'Add a tag to the given user profile'); - help_screen_line('--add_tag_to_module', '<agent_name> <module_name> <tag_name>', 'Add a tag to the given module'); - - print "\n"; - exit; -} - -######################################################################## -# -######################################################################## -sub api_call($$$;$$$) { - my ($pa_config, $op, $op2, $id, $id2, $other) = @_; - my $content = undef; - - eval { - # Set the parameters for the POST request. - my $params = {}; - $params->{"apipass"} = $pa_config->{"console_api_pass"}; - $params->{"user"} = $pa_config->{"console_user"}; - $params->{"pass"} = $pa_config->{"console_pass"}; - $params->{"op"} = $op; - $params->{"op2"} = $op2; - $params->{"id"} = $id; - $params->{"id2"} = $id2; - $params->{"other"} = $other; - $params->{"other_mode"} = "url_encode_separator_|"; - - # Call the API. - my $ua = new LWP::UserAgent; - my $url = $pa_config->{"console_api_url"}; - my $response = $ua->post($url, $params); - - if ($response->is_success) { - $content = $response->decoded_content(); - } - else { - $content = $response->decoded_content(); - } - }; - - return $content; -} - -############################################################################### -# Disable a entire group -############################################################################### -sub pandora_disable_group ($$$) { - my ($conf, $dbh, $group) = @_; - - if ($group == 0){ - db_do ($dbh, "UPDATE tagente SET disabled = 1"); - } - else { - db_do ($dbh, "UPDATE tagente SET disabled = 1 WHERE id_grupo = $group"); - } - exit; -} - -############################################################################### -# Enable a entire group -############################################################################### -sub pandora_enable_group ($$$) { - my ($conf, $dbh, $group) = @_; - - if ($group == 0){ - db_do ($dbh, "UPDATE tagente SET disabled = 0"); - } - else { - db_do ($dbh, "UPDATE tagente SET disabled = 0 WHERE id_grupo = $group"); - } - exit; -} - -############################################################################## -# Init screen -############################################################################## -sub pandora_manage_init ($) { - my $conf = shift; - - $conf->{"verbosity"}=0; # Verbose 1 by default - $conf->{"daemon"}=0; # Daemon 0 by default - $conf->{'PID'}=""; # PID file not exist by default - $conf->{"quiet"}=0; # Daemon 0 by default - - - # Load config file from command line - help_screen () if ($#ARGV < 0); - - $conf->{'pandora_path'} = $ARGV[0]; - - help_screen () if ($conf->{'pandora_path'} =~ m/--*h\w*\z/i ); -} - -########################################################################## -## Delete a template module. -########################################################################## -sub pandora_delete_template_module ($$) { - my ($dbh, $template_module_id) = @_; - - # Delete the template module - db_do ($dbh, 'DELETE FROM talert_template_modules WHERE id = ?', $template_module_id); - - # - db_do ($dbh, 'DELETE FROM talert_template_module_actions WHERE id_alert_template_module = ?', $template_module_id); -} - -########################################################################## -## Delete a policy template module action. -########################################################################## -sub pandora_delete_template_module_action ($$$) { - my ($dbh, $template_module_id, $action_id) = @_; - - return db_do ($dbh, 'DELETE FROM talert_template_module_actions WHERE id_alert_template_module = ? AND id_alert_action = ?', $template_module_id, $action_id); -} - -########################################################################## -## Create an alert template from hash -########################################################################## -sub pandora_create_alert_template_from_hash ($$$) { - my ($pa_config, $parameters, $dbh) = @_; - - logger($pa_config, "Creating alert_template '$parameters->{'name'}'", 10); - - my $template_id = db_process_insert($dbh, 'id', 'talert_templates', $parameters); - - return $template_id; -} - -########################################################################## -# Assign a profile in a group to user -########################################################################## -sub pandora_add_profile_to_user ($$$;$) { - my ($dbh, $user_id, $profile_id, $group_id) = @_; - - $group_id = 0 unless defined($group_id); - - db_do ($dbh, 'INSERT INTO tusuario_perfil (id_usuario, id_perfil, id_grupo) - VALUES (?, ?, ?)', safe_input($user_id), $profile_id, $group_id); -} - - -########################################################################## -## Create a SNMP trap, given OID name description -########################################################################## - -sub cli_create_snmp_trap ($$) { - my ($conf, $dbh) = @_; - - my ($name, $oid, $description, $severity); - - ($name, $oid, $description, $severity) = @ARGV[2..5]; - - db_do ($dbh, 'INSERT INTO ttrap_custom_values (`oid`, `text`, `description`, `severity`) - VALUES (?, ?, ?, ?)', $oid, $name, $description, $severity); - - print "Creando $name $oid $description $severity \n"; - exit; -} - -########################################################################## -## Create a user. -########################################################################## -sub pandora_create_user ($$$$$) { - my ($dbh, $name, $password, $is_admin, $comments) = @_; - - -return db_insert ($dbh, 'id_user', 'INSERT INTO tusuario (id_user, fullname, password, comments, is_admin) - VALUES (?, ?, ?, ?, ?)', safe_input($name), safe_input($name), $password, safe_input($comments), $is_admin); -} - -########################################################################## -## Delete a user. -########################################################################## -sub pandora_delete_user ($$) { -my ($dbh, $name) = @_; - -# Delete user profiles -db_do ($dbh, 'DELETE FROM tusuario_perfil WHERE id_usuario = ?', $name); - -# Delete the user -my $return = db_do ($dbh, 'DELETE FROM tusuario WHERE id_user = ?', $name); - -if($return eq '0E0') { - return -1; -} -else { - return 0; -} -} - -########################################################################## -## Delete an alert template. -########################################################################## -sub pandora_delete_alert_template ($$) { -my ($dbh, $template_name) = @_; - -# Delete the alert_template -my $return = db_do ($dbh, 'DELETE FROM talert_templates WHERE name = ?', safe_input($template_name)); - -if($return eq '0E0') { - return -1; -} -else { - return 0; -} -} - -########################################################################## -## Assign a profile to the given user/group. -########################################################################## -sub pandora_create_user_profile ($$$$) { - my ($dbh, $user_id, $profile_id, $group_id) = @_; - - return db_insert ($dbh, 'id_up', 'INSERT INTO tusuario_perfil (id_usuario, id_perfil, id_grupo) VALUES (?, ?, ?)', $user_id, $profile_id, $group_id); -} - -########################################################################## -## Create profile. -########################################################################## -sub pandora_create_profile ($$$$$$$$$$$$$$$$$$$$$$$$$) { - my ($dbh, $profile_name, $incident_view,$incident_edit, $incident_management, $agent_view, - $agent_edit, $agent_disable, $alert_edit, $alert_management, $user_management, $db_management, - $event_view, $event_edit, $event_management, $report_view, $report_edit, $report_management, - $map_view, $map_edit, $map_management, $vconsole_view, $vconsole_edit, $vconsole_management, $pandora_management) = @_; - - return db_insert ($dbh, 'id_up', 'INSERT INTO tperfil (name,incident_edit,incident_view,incident_management,agent_view,agent_edit,alert_edit,user_management,db_management,alert_management,pandora_management,report_view,report_edit,report_management,event_view,event_edit,event_management,agent_disable,map_view,map_edit,map_management,vconsole_view,vconsole_edit,vconsole_management) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);', - $profile_name, $incident_view,$incident_edit, $incident_management, $agent_view, - $agent_edit, $agent_disable, $alert_edit, $alert_management, $user_management, $db_management, - $event_view, $event_edit, $event_management, $report_view, $report_edit, $report_management, - $map_view, $map_edit, $map_management, $vconsole_view, $vconsole_edit, $vconsole_management, $pandora_management); -} - -########################################################################## -## Delete a profile from the given user/group. -########################################################################## -sub pandora_delete_user_profile ($$$$) { - my ($dbh, $user_id, $profile_id, $group_id) = @_; - - return db_do ($dbh, 'DELETE FROM tusuario_perfil WHERE id_usuario=? AND id_perfil=? AND id_grupo=?', $user_id, $profile_id, $group_id); -} - -########################################################################## -## Delete a planned downtime -########################################################################## -sub pandora_delete_planned_downtime ($$) { - my ($dbh, $id_downtime) = @_; - - my $execute = get_db_single_row($dbh, 'SELECT executed FROM tplanned_downtime WHERE id = ? ', $id_downtime); - - if ( !$execute->{'executed'} ) { - my $result = db_do ($dbh, 'DELETE FROM tplanned_downtime WHERE id = ? ', $id_downtime); - - if ($result) { - return "This planned downtime is deleted"; - } - else { - return "Problems with this planned downtime"; - } - } - else { - return "The scheduled downtime is still being executed"; - } -} - -########################################################################## -## Delete all the data of module, agent's modules or group's agent's modules -########################################################################## -sub pandora_delete_data ($$$) { - my ($dbh, $type, $id) = @_; - - if($type eq 'group') { - my @delete_agents = get_db_rows ($dbh, 'SELECT id_agente FROM tagente WHERE id_grupo = ?', $id); - foreach my $agent (@delete_agents) { - my @delete_modules = get_db_rows ($dbh, 'SELECT id_agente_modulo FROM tagente_modulo WHERE id_agente = ?', $agent->{'id_agente'}); - foreach my $module (@delete_modules) { - pandora_delete_module_data($dbh, $module->{'id_agente_modulo'}); - } - } - } - elsif ($type eq 'agent') { - my @delete_modules = get_db_rows ($dbh, 'SELECT id_agente_modulo FROM tagente_modulo WHERE id_agente = ?', $id); - foreach my $module (@delete_modules) { - pandora_delete_module_data($dbh, $module->{'id_agente_modulo'}); - } - } - elsif ($type eq 'module'){ - pandora_delete_module_data($dbh, $id); - } - else { - return 0; - } -} - -########################################################################## -## Delete all the data of module -########################################################################## -sub pandora_delete_module_data ($$) { - my ($dbh, $id_module) = @_; - my $buffer = 1000; - - while(1) { - my $nd = get_db_value ($dbh, 'SELECT count(id_agente_modulo) FROM tagente_datos_string WHERE id_agente_modulo=?', $id_module); - my $ndinc = get_db_value ($dbh, 'SELECT count(id_agente_modulo) FROM tagente_datos_string WHERE id_agente_modulo=?', $id_module); - my $ndlog4x = get_db_value ($dbh, 'SELECT count(id_agente_modulo) FROM tagente_datos_string WHERE id_agente_modulo=?', $id_module); - my $ndstring = get_db_value ($dbh, 'SELECT count(id_agente_modulo) FROM tagente_datos_string WHERE id_agente_modulo=?', $id_module); - - my $ntot = $nd + $ndinc + $ndlog4x + $ndstring; - - if($ntot == 0) { - last; - } - - if($nd > 0) { - db_do ($dbh, 'DELETE FROM tagente_datos WHERE id_agente_modulo=? LIMIT ?', $id_module, $buffer); - } - - if($ndinc > 0) { - db_do ($dbh, 'DELETE FROM tagente_datos_inc WHERE id_agente_modulo=? LIMIT ?', $id_module, $buffer); - } - - if($ndlog4x > 0) { - db_do ($dbh, 'DELETE FROM tagente_datos_log4x WHERE id_agente_modulo=? LIMIT ?', $id_module, $buffer); - } - - if($ndstring > 0) { - db_do ($dbh, 'DELETE FROM tagente_datos_string WHERE id_agente_modulo=? LIMIT ?', $id_module, $buffer); - } - } - - return 1; -} - -########################################################################## -# Validate event. -# This validates all events pending to ACK for the same id_agent_module -########################################################################## -sub pandora_validate_event_filter ($$$$$$$$$) { - my ($pa_config, $id_agentmodule, $id_agent, $timestamp_min, $timestamp_max, $id_user, $id_alert_agent_module, $criticity, $dbh) = @_; - my $filter = ''; - - if ($id_agentmodule ne ''){ - $filter .= " AND id_agentmodule = $id_agentmodule"; - } - if ($id_agent ne ''){ - $filter .= " AND id_agente = $id_agent"; - } - if ($timestamp_min ne ''){ - $filter .= " AND timestamp >= '$timestamp_min'"; - } - if ($timestamp_max ne ''){ - $filter .= " AND timestamp <= '$timestamp_max'"; - } - if ($id_user ne ''){ - $filter .= " AND id_usuario = '$id_user'"; - } - - if ($id_alert_agent_module ne ''){ - $filter .= " AND id_alert_am = $id_alert_agent_module"; - } - - if ($criticity ne ''){ - $filter .= " AND criticity = $criticity"; - } - - logger($pa_config, "Validating events", 10); - db_do ($dbh, "UPDATE tevento SET estado = 1 WHERE estado = 0".$filter); -} - -########################################################################## -# Validate event given a event id -########################################################################## -sub pandora_validate_event_id ($$$) { - my ($pa_config, $id_event, $dbh) = @_; - my $filter = ''; - - if ($id_event ne ''){ - $filter .= " AND id_evento = $id_event"; - } - - logger($pa_config, "Validating events", 10); - db_do ($dbh, "UPDATE tevento SET estado = 1 WHERE estado = 0".$filter); -} - -########################################################################## -## Update a user from hash -########################################################################## -sub pandora_update_user_from_hash ($$$$) { - my ($parameters, $where_column, $where_value, $dbh) = @_; - - my $user_id = db_process_update($dbh, 'tusuario', $parameters, {$where_column => $where_value}); - return $user_id; -} - -########################################################################## -## Update an alert template from hash -########################################################################## -sub pandora_update_alert_template_from_hash ($$$$) { - my ($parameters, $where_column, $where_value, $dbh) = @_; - - my $template_id = db_process_update($dbh, 'talert_templates', $parameters, {$where_column => $where_value}); - return $template_id; -} - -############################################################################### -# Get list of all downed agents -############################################################################### -sub pandora_get_downed_agents () { - my @downed_agents = get_db_rows ($dbh, "SELECT tagente.id_agente, tagente.nombre, truncate((NOW() - tagente.ultimo_contacto/60),0) as downed_time, tagente.server_name from tagente -where UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(tagente.ultimo_contacto)>(tagente.intervalo*2) -OR tagente.ultimo_contacto=0"); - - return \@downed_agents; -} - -############################################################################### -# Get the agent (id of agent and module and agent name) list with a given module -############################################################################### -sub pandora_get_module_agents ($$) { - my ($dbh,$module_name) = @_; - - my @agents = get_db_rows ($dbh, "SELECT tagente_modulo.id_agente_modulo, tagente.id_agente, tagente.nombre FROM tagente, tagente_modulo - WHERE tagente.id_agente = tagente_modulo.id_agente AND tagente_modulo.nombre = ?", safe_input($module_name)); - - return \@agents; -} - -############################################################################### -# Get agent status (critical, warning, unknown or normal) -############################################################################### -sub pandora_get_agent_status ($$) { - my ($dbh,$agent_id) = @_; - - my $critical = get_db_value ($dbh, "SELECT COUNT(tagente_estado.id_agente_estado) FROM tagente_estado, tagente, tagente_modulo WHERE tagente.id_agente = $agent_id AND tagente.disabled = 0 AND tagente_estado.id_agente = tagente.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 AND estado = 1 AND (utimestamp >= ( UNIX_TIMESTAMP() - (current_interval * 2)) OR tagente_modulo.id_tipo_modulo IN (21,22,23,100))"); - return 'critical' unless $critical == 0; - - my $warning = get_db_value ($dbh, "SELECT COUNT(tagente_estado.id_agente_estado) FROM tagente_estado, tagente, tagente_modulo WHERE tagente.id_agente = $agent_id AND tagente.disabled = 0 AND tagente_estado.id_agente = tagente.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 AND estado = 2 AND (utimestamp >= ( UNIX_TIMESTAMP() - (current_interval * 2)) OR tagente_modulo.id_tipo_modulo IN (21,22,23,100))"); - return 'warning' unless $warning == 0; - - my $unknown = get_db_value ($dbh, "SELECT COUNT(tagente_estado.id_agente_estado) FROM tagente_estado, tagente, tagente_modulo WHERE tagente.id_agente = $agent_id AND tagente.disabled = 0 AND tagente.id_agente = tagente_estado.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 AND tagente_modulo.id_tipo_modulo NOT IN (21,22,23,100) AND utimestamp < ( UNIX_TIMESTAMP() - (current_interval * 2)) AND utimestamp != 0"); - return 'unknown' unless $unknown == 0; - - my $normal = get_db_value ($dbh, "SELECT COUNT(tagente_estado.id_agente_estado) FROM tagente_estado, tagente, tagente_modulo WHERE tagente.id_agente = $agent_id AND tagente.disabled = 0 AND tagente_estado.id_agente = tagente.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 AND estado = 0 AND (utimestamp != 0 OR tagente_modulo.id_tipo_modulo IN (21,22,23)) AND (utimestamp >= ( UNIX_TIMESTAMP() - (current_interval * 2)) OR tagente_modulo.id_tipo_modulo IN (21,22,23,100))"); - return 'normal' unless $normal == 0; - return 'normal' unless $normal == 0; - - return ''; -} - -########################################################################## -## Return the modules of a given agent -########################################################################## -sub pandora_get_agent_modules ($$) { - my ($dbh, $agent_id) = @_; - - my @modules = get_db_rows ($dbh, "SELECT id_agente_modulo, nombre FROM tagente_modulo WHERE delete_pending = 0 AND id_agente = ?", $agent_id); - - return \@modules; -} - -############################################################################### -# Get module current data -############################################################################### -sub pandora_get_module_current_data ($$) { - my ($dbh,$id_agent_module) = @_; - - my $current_data = get_db_value ($dbh, "SELECT datos FROM tagente_estado WHERE id_agente_modulo = ?", $id_agent_module); - - return $current_data; -} - -########################################################################## -## SUB get_alert_template_id(id) -## Return the alert template id, given "template_name" -########################################################################## -sub pandora_get_alert_template_id ($$) { - my ($dbh, $template_name) = @_; - - my $template_id = get_db_value ($dbh, "SELECT id FROM talert_templates WHERE name = ?", safe_input($template_name)); - - return defined ($template_id) ? $template_id : -1; -} - -########################################################################## -## SUB get_planned_downtime_id(id) -## Return the planned downtime id, given "downtime_name" -########################################################################## -sub pandora_get_planned_downtime_id ($$) { - my ($dbh, $downtime_name) = @_; - - my $downtime_id = get_db_value ($dbh, "SELECT id FROM tplanned_downtime WHERE name = ?", safe_input($downtime_name)); - - return defined ($downtime_id) ? $downtime_id : -1; -} - -########################################################################## -## SUB get_all_planned_downtime -## Return the planned downtime id, given "downtime_name" -########################################################################## -sub pandora_get_all_planned_downtime ($$$$$$) { - my ($dbh, $downtime_name, $id_group, $type_downtime, $type_execution, $type_periodicity) = @_; - my $sql = "SELECT * FROM tplanned_downtime WHERE name LIKE '%".safe_input($downtime_name)."%' "; - my $text_sql = ''; - - if (defined($id_group) && $id_group ne '') { - $text_sql .= " id_group = $id_group "; - } - if ( defined($type_downtime) && $type_downtime ne '' ) { - $text_sql .= " type_downtime = $type_downtime "; - } - if (defined($type_execution) && $type_execution ne '') { - $text_sql .= " type_execution = $type_execution "; - } - if (defined($type_periodicity) && $type_periodicity ne '') { - $text_sql .= " type_periodicity = $type_periodicity "; - } - - if ($text_sql eq '') { - $text_sql = ''; - } - - $sql .= $text_sql; - my @downtimes = get_db_rows ($dbh, $sql); - - return @downtimes; -} - -########################################################################## -## SUB get_planned_downtimes_items -## Return the planned downtime id, given "downtime_name" -########################################################################## -sub pandora_get_planned_downtimes_items ($$) { - my ($dbh, $downtime) = @_; - my $sql = "SELECT * FROM tplanned_downtime_agents WHERE id_downtime = ?"; - my @agents_items = get_db_rows ($dbh, $sql, $downtime->{"id"}); - my @modules_downtime; - my @return; - my $text_modules; - foreach my $agents_item (@agents_items) { - - if ( $downtime->{"type_downtime"} eq 'quiet' ) { - if ( !$agents_item->{'all_modules'} ) { - $sql = "SELECT id_agent_module FROM tplanned_downtime_modules WHERE id_downtime = ? AND id_agent = ?"; - my @modules_items = get_db_rows ($dbh, $sql, $downtime->{"id"}, $agents_item->{"id_agent"}); - foreach my $modules_item (@modules_items) { - push(@modules_downtime,$modules_item->{"id_agent_module"}); - } - } - } - - if ( @modules_downtime != undef ) { - $text_modules = join(",", @modules_downtime); - $agents_item->{"modules"} = $text_modules; - @modules_downtime = undef; - - } - push (@return,$agents_item); - } - return @return; -} - -########################################################################## -## Create a special day from hash -########################################################################## -sub pandora_create_special_day_from_hash ($$$) { - my ($pa_config, $parameters, $dbh) = @_; - - logger($pa_config, "Creating special_day '$parameters->{'date'}'", 10); - - my $template_id = db_process_insert($dbh, 'id', 'talert_special_days', $parameters); - - return $template_id; -} - -########################################################################## -## Update a special day from hash -########################################################################## -sub pandora_update_special_day_from_hash ($$$$) { - my ($parameters, $where_column, $where_value, $dbh) = @_; - - my $special_day_id = db_process_update($dbh, 'talert_special_days', $parameters, {$where_column => $where_value}); - return $special_day_id; -} - -########################################################################## -## SUB get_special_day_id(id) -## Return the special day id, given "special_day" -########################################################################## -sub pandora_get_special_day_id ($$) { - my ($dbh, $special_day) = @_; - - my $special_day_id = get_db_value ($dbh, "SELECT id FROM talert_special_days WHERE ${RDBMS_QUOTE}date${RDBMS_QUOTE} = ?", $special_day); - - return defined ($special_day_id) ? $special_day_id : -1; -} - -########################################################################## -## Delete a special day. -########################################################################## -sub pandora_delete_special_day ($$) { - my ($dbh, $date) = @_; - - # Delete the special_day - my $return = db_do ($dbh, 'DELETE FROM talert_special_days WHERE date = ?', safe_input($date)); - - if($return eq '0E0') { - return -1; - } - else { - return 0; - } -} - - -############################################################################### -############################################################################### -# PRINT HELP AND CHECK ERRORS FUNCTIONS -############################################################################### -############################################################################### - -############################################################################### -# log wrapper -############################################################################### -sub print_log ($) { - my ($msg) = @_; - - print $msg; # show message - - $msg =~ s/\n+$//; - logger( $conf, "($progname) $msg", 10); # save to logging file -} - -############################################################################### -# Print a parameter error and exit the program. -############################################################################### -sub param_error ($$) { - print (STDERR "[ERROR] Parameters error: $_[1] received | $_[0] necessary.\n\n"); - logger( $conf, "($progname) [ERROR] Parameters error: $_[1] received | $_[0] necessary.", 10); - - help_screen (); - exit 1; -} - -############################################################################### -# Print a 'not exists' error and exit the program. -############################################################################### -sub notexists_error ($$) { - print (STDERR "[ERROR] Error: The $_[0] '$_[1]' not exists.\n\n"); - logger( $conf, "($progname) [ERROR] Error: The $_[0] '$_[1]' not exists.", 10); - exit 1; -} - -############################################################################### -# Print a 'exists' error and exit the program. -############################################################################### -sub exists_error ($$) { - print (STDERR "[ERROR] Error: The $_[0] '$_[1]' already exists.\n\n"); - logger( $conf, "($progname) [ERROR] Error: The $_[0] '$_[1]' already exists.", 10); - exit 1; -} - -############################################################################### -# Check the return of 'get id' and call the error if its equal to -1. -############################################################################### -sub exist_check ($$$) { - if($_[0] == -1) { - notexists_error($_[1],$_[2]); - } -} - -############################################################################### -# Check the return of 'get id' and call the error if its not equal to -1. -############################################################################### -sub non_exist_check ($$$) { - if($_[0] != -1) { - exists_error($_[1],$_[2]); - } -} - -############################################################################### -# Check the parameters. -# Param 0: # of received parameters -# Param 1: # of acceptable parameters -# Param 2: # of optional parameters -############################################################################### -sub param_check ($$;$) { - my ($ltotal, $laccept, $lopt) = @_; - $ltotal = $ltotal - 1; - - if(!defined($lopt)){ - $lopt = 0; - } - - if( $ltotal < $laccept - $lopt || $ltotal > $laccept) { - if( $lopt == 0 ) { - param_error ($laccept, $ltotal); - } - else { - param_error (($laccept-$lopt)."-".$laccept, $ltotal); - } - } -} - -############################################################################## -# Print a help line. -############################################################################## -sub help_screen_line($$$){ - my ($option, $parameters, $help) = @_; - print "\n\t$option $parameters : $help.\n" unless ($param ne '' && $param ne $option); -} - -############################################################################### -############################################################################### -# CLI FUNCTIONS -############################################################################### -############################################################################### - -############################################################################## -# Disable group -# Related option: --disable_group -############################################################################## - -sub cli_disable_group() { - my $group_name = @ARGV[2]; - my $id_group; - - if($group_name eq "All") { - print_log "[INFO] Disabling all groups\n\n"; - $id_group = 0; - } - else { - $id_group = get_group_id($dbh, $group_name); - exist_check($id_group,'group',$group_name); - print_log "[INFO] Disabling group '$group_name'\n\n"; - } - - pandora_disable_group ($conf, $dbh, $id_group); -} - -############################################################################## -# Enable group -# Related option: --enable_group -############################################################################## - -sub cli_enable_group() { - my $group_name = @ARGV[2]; - my $id_group; - - if($group_name eq "All") { - $id_group = 0; - print_log "[INFO] Enabling all groups\n\n"; - } - else { - $id_group = get_group_id($dbh, $group_name); - exist_check($id_group,'group',$group_name); - print_log "[INFO] Enabling group '$group_name'\n\n"; - } - - pandora_enable_group ($conf, $dbh, $id_group); -} - -############################################################################## -# Create an agent. -# Related option: --created_agent -############################################################################## - -sub cli_create_agent() { - my ($agent_name,$os_name,$group_name,$server_name,$address,$description,$interval) = @ARGV[2..8]; - - print_log "[INFO] Creating agent '$agent_name'\n\n"; - - $address = '' unless defined ($address); - $description = (defined ($description) ? safe_input($description) : '' ); # safe_input() might be better at pandora_create_agent() (when passing 'description' to db_insert()) - $interval = 300 unless defined ($interval); - - my $id_group = get_group_id($dbh,$group_name); - exist_check($id_group,'group',$group_name); - my $os_id = get_os_id($dbh,$os_name); - exist_check($id_group,'operating system',$group_name); - my $agent_exists = get_agent_id($dbh,$agent_name); - non_exist_check($agent_exists, 'agent name', $agent_name); - pandora_create_agent ($conf, $server_name, $agent_name, $address, $id_group, 0, $os_id, $description, $interval, $dbh); -} - -############################################################################## -# Delete an agent. -# Related option: --delete_agent -############################################################################## - -sub cli_delete_agent() { - my $agent_name = @ARGV[2]; - - $agent_name = decode_entities($agent_name); - - if (is_metaconsole($conf) == 1) { - my $agents_groups = enterprise_hook('get_metaconsole_agent',[$dbh, $agent_name]); - - if (scalar(@{$agents_groups}) != 0) { - foreach my $agent (@{$agents_groups}) { - my $return = enterprise_hook('delete_metaconsole_agent',[$dbh,$agent->{'id_agente'}]); - print_log "[INFO] Deleting agent '$agent_name' \n\n"; - } - } - my $servers = enterprise_hook('get_metaconsole_setup_servers',[$dbh]); - my @servers_id = split(',',$servers); - my @list_servers; - my $list_names_servers; - foreach my $server (@servers_id) { - my $dbh_metaconsole = enterprise_hook('get_node_dbh',[$conf, $server, $dbh]); - - my $id_agent = get_agent_id($dbh_metaconsole,$agent_name); - - if ($id_agent == -1) { - next; - } - else { - print_log "[INFO] Deleting agent '$agent_name' in ID server: '$server'\n\n"; - pandora_delete_agent($dbh_metaconsole,$id_agent,$conf); - } - } - } - else { - - my $id_agent = get_agent_id($dbh,$agent_name); - exist_check($id_agent,'agent',$agent_name); - - print_log "[INFO] Deleting agent '$agent_name'\n\n"; - pandora_delete_agent($dbh,$id_agent,$conf); - } -} - - -############################################################################## -# Create alert template -# Related option: --create_alert_template -############################################################################## - -sub cli_create_alert_template() { - my ($template_name, $condition_type_serialized, $time_from, $time_to, - $description,$group_name,$field1, $field2, $field3, $priority, $default_action, $days, $time_threshold, - $min_alerts, $max_alerts, $alert_recovery, $field2_recovery, $field3_recovery, $condition_type_separator) = @ARGV[2..20]; - - my $template_exists = pandora_get_alert_template_id ($dbh, $template_name); - non_exist_check($template_exists,'alert template',$template_name); - - my $id_alert_action = 0; - - $id_alert_action = get_action_id ($dbh, safe_input($default_action)) unless $default_action eq ''; - - my $group_id = 0; - - # If group name is not defined, we assign group All (0) - if(defined($group_name)) { - $group_id = get_group_id($dbh, $group_name); - exist_check($group_id,'group',$group_name); - } - else { - $group_name = 'All'; - } - - $condition_type_separator = ';' unless defined $condition_type_separator; - - my %parameters; - - my @condition_array = split($condition_type_separator, $condition_type_serialized); - - my $type = $condition_array[0]; - - if($type eq 'regex') { - $parameters{'matches_value'} = $condition_array[1]; - $parameters{'value'} = $condition_array[1]; - } - elsif($type eq 'max_min') { - $parameters{'matches_value'} = $condition_array[1]; - $parameters{'min_value'} = $condition_array[2]; - $parameters{'max_value'} = $condition_array[3]; - } - elsif($type eq 'max') { - $parameters{'max_value'} = $condition_array[1]; - } - elsif($type eq 'min') { - $parameters{'min_value'} = $condition_array[1]; - } - elsif($type eq 'equal') { - $parameters{'value'} = $condition_array[1]; - } - elsif($type eq 'not_equal') { - $parameters{'value'} = $condition_array[1]; - } - elsif($type eq 'onchange') { - $parameters{'matches_value'} = $condition_array[1]; - } - elsif($type eq 'warning' || $type eq 'critical' || $type eq 'unknown' || $type eq 'always') { - # Only type is stored - } - else { - $type = 'always'; - } - - $parameters{'name'} = $template_name; - $parameters{'type'} = $type; - $parameters{'time_from'} = $time_from; - $parameters{'time_to'} = $time_to; - - $parameters{'id_alert_action'} = $id_alert_action unless $id_alert_action <= 0; - - $parameters{'id_group'} = $group_id; - $parameters{'field1'} = defined ($field1) ? safe_input($field1) : ''; - $parameters{'field2'} = defined ($field2) ? safe_input($field2) : ''; - $parameters{'field3'} = defined ($field3) ? safe_input($field3) : ''; - $parameters{'priority'} = defined ($priority) ? $priority : 1; # Informational by default - $parameters{'description'} = defined ($description) ? safe_input($description) : ''; - $parameters{'time_threshold'} = defined ($time_threshold) ? $time_threshold : 86400; - $parameters{'min_alerts'} = defined ($min_alerts) ? $min_alerts : 0; - $parameters{'max_alerts'} = defined ($max_alerts) ? $max_alerts : 1; - $parameters{'recovery_notify'} = defined ($alert_recovery) ? $alert_recovery : 0; - $parameters{'field2_recovery'} = defined ($field2_recovery) ? safe_input($field2_recovery) : ''; - $parameters{'field3_recovery'} = defined ($field3_recovery) ? safe_input($field3_recovery) : ''; - - $days = '1111111' unless defined($days); # Al days actived by default - - my @days_array = split('',$days); - - $parameters{'monday'} = $days_array[0]; - $parameters{'tuesday'} = $days_array[1]; - $parameters{'wednesday'} = $days_array[2]; - $parameters{'thursday'} = $days_array[3]; - $parameters{'friday'} = $days_array[4]; - $parameters{'saturday'} = $days_array[5]; - $parameters{'sunday'} = $days_array[6]; - - pandora_create_alert_template_from_hash ($conf, \%parameters, $dbh); -} - -############################################################################## -# Create data module. -# Related option: --create_data_module -############################################################################## - -sub cli_create_data_module($) { - my $in_policy = shift; - my ($policy_name, $module_name, $module_type, $agent_name, $description, $module_group, - $min,$max,$post_process, $interval, $warning_min, $warning_max, $critical_min, - $critical_max, $history_data, $definition_file, $configuration_data, $warning_str, $critical_str, $enable_unknown_events, - $ff_threshold, $each_ff, $ff_threshold_normal, $ff_threshold_warning, $ff_threshold_critical, $ff_timeout, - $warning_inverse, $critical_inverse, $critical_instructions, $warning_instructions, $unknown_instructions); - - if ($in_policy == 0) { - ($module_name, $module_type, $agent_name, $description, $module_group, - $min,$max,$post_process, $interval, $warning_min, $warning_max, $critical_min, - $critical_max, $history_data, $definition_file, $warning_str, $critical_str, $enable_unknown_events, $ff_threshold, - $each_ff, $ff_threshold_normal, $ff_threshold_warning, $ff_threshold_critical, $ff_timeout, - $warning_inverse, $critical_inverse, $critical_instructions, $warning_instructions, $unknown_instructions) = @ARGV[2..30]; - } - else { - ($policy_name, $module_name, $module_type, $description, $module_group, - $min,$max,$post_process, $interval, $warning_min, $warning_max, $critical_min, - $critical_max, $history_data, $configuration_data, $warning_str, $critical_str, $enable_unknown_events, $ff_threshold, - $each_ff, $ff_threshold_normal, $ff_threshold_warning, $ff_threshold_critical, $ff_timeout, - $warning_inverse, $critical_inverse, $critical_instructions, $warning_instructions, $unknown_instructions) = @ARGV[2..31]; - } - - my $module_name_def; - my $module_type_def; - - my $agent_id; - my $policy_id; - - my $disabled_types_event = {}; - if ($enable_unknown_events) { - $disabled_types_event->{'going_unknown'} = 0; - } - else { - $disabled_types_event->{'going_unknown'} = 1; - } - my $disabled_types_event_json = encode_json($disabled_types_event); - - if ($in_policy == 0) { - $agent_id = get_agent_id($dbh,$agent_name); - exist_check($agent_id,'agent',$agent_name); - - my $module_exists = get_agent_module_id($dbh, $module_name, $agent_id); - non_exist_check($module_exists, 'module name', $module_name); - - #~ print_log "[INFO] Adding module '$module_name' to agent '$agent_name'\n\n"; - } - else { - $policy_id = enterprise_hook('get_policy_id',[$dbh, safe_input($policy_name)]); - exist_check($policy_id,'policy',$policy_name); - - my $policy_module_exist = enterprise_hook('get_policy_module_id',[$dbh, $policy_id, $module_name]); - non_exist_check($policy_module_exist,'policy module',$module_name); - - #~ print_log "[INFO] Adding module '$module_name' to policy '$policy_name'\n\n"; - } - - $module_name_def = $module_name; - $module_type_def = $module_type; - # If the module is local and is not to policy, we add it to the conf file - if (defined($definition_file) && (-e $definition_file) && (-e $conf->{incomingdir}.'/conf/'.md5($agent_name).'.conf')){ - open (FILE, $definition_file); - my @file = <FILE>; - my $definition = join("", @file); - close (FILE); - - # If the parameter name or type and the definition file name or type - # dont match will be set the file definitions - open (FILE, $definition_file); - while (<FILE>) { - chomp; - my ($key, $val) = split / /; - if ($key eq 'module_name') { - $module_name_def = $val; - } - if ($key eq 'module_type') { - $module_type_def = $val; - } - } - close (FILE); - - open (FILE, $conf->{incomingdir}.'/conf/'.md5($agent_name).'.conf'); - my @file = <FILE>; - my $conf_file = join("", @file); - close(FILE); - - open FILE, "> ".$conf->{incomingdir}.'/conf/'.md5($agent_name).'.conf'; - print FILE "$conf_file\n$definition"; - close(FILE); - - enterprise_hook('pandora_update_md5_file', [$conf, $agent_name]); - } - - if ($in_policy == 0) { - my $module_exists = get_agent_module_id($dbh, $module_name_def, $agent_id); - non_exist_check($module_exists, 'module name', $module_name_def); - print_log "[INFO] Adding module '$module_name' to agent '$agent_name'\n\n"; - } - else { - my $policy_module_exist = enterprise_hook('get_policy_module_id',[$dbh, $policy_id, $module_name_def]); - non_exist_check($policy_module_exist,'policy module',$module_name_def); - print_log "[INFO] Adding module '$module_name' to policy '$policy_name'\n\n"; - } - - if (defined($definition_file) && $module_type ne $module_type_def) { - $module_type = $module_type_def; - print_log "[INFO] The module type has been forced to '$module_type' by the definition file\n\n"; - } - - if (defined($definition_file) && $module_name ne $module_name_def) { - $module_name = $module_name_def; - print_log "[INFO] The module name has been forced to '$module_name' by the definition file\n\n"; - } - - # The get_module_id has wrong name. Change in future - my $module_type_id = get_module_id($dbh,$module_type); - exist_check($module_type_id,'module type',$module_type); - - if ($module_type !~ m/.?generic.?/ && $module_type !~ m/.?async.?/ && $module_type ne 'log4x' && $module_type ne 'keep_alive') { - print_log "[ERROR] '$module_type' is not valid type for data modules. Try with generic, asyncronous, keep alive or log4x types\n\n"; - exit; - } - - my $module_group_id = 0; - - if (defined($module_group)) { - $module_group_id = get_module_group_id($dbh,$module_group); - exist_check($module_group_id,'module group',$module_group); - } - - my %parameters; - - $parameters{'id_tipo_modulo'} = $module_type_id; - - if ($in_policy == 0) { - $parameters{'nombre'} = safe_input($module_name); - $parameters{'id_agente'} = $agent_id; - } - else { - $parameters{'name'} = safe_input($module_name); - $parameters{'id_policy'} = $policy_id; - } - - # Optional parameters - $parameters{'id_module_group'} = $module_group_id unless !defined ($module_group); - $parameters{'min_warning'} = $warning_min unless !defined ($warning_min); - $parameters{'max_warning'} = $warning_max unless !defined ($warning_max); - $parameters{'min_critical'} = $critical_min unless !defined ($critical_min); - $parameters{'max_critical'} = $critical_max unless !defined ($critical_max); - $parameters{'history_data'} = $history_data unless !defined ($history_data); - if ($in_policy == 0) { - $parameters{'descripcion'} = safe_input($description) unless !defined ($description); - $parameters{'id_modulo'} = 1; - } - else { - $parameters{'description'} = safe_input($description) unless !defined ($description); - $parameters{'id_module'} = 1; - $configuration_data !~ s/\\n/\n/g; - $parameters{'configuration_data'} = safe_input($configuration_data); - } - $parameters{'min'} = $min unless !defined ($min); - $parameters{'max'} = $max unless !defined ($max); - $parameters{'post_process'} = $post_process unless !defined ($post_process); - $parameters{'module_interval'} = $interval unless !defined ($interval); - $parameters{'str_warning'} = safe_input($warning_str) unless !defined ($warning_str); - $parameters{'str_critical'} = safe_input($critical_str) unless !defined ($critical_str); - $parameters{'disabled_types_event'} = $disabled_types_event_json; - $parameters{'min_ff_event'} = $ff_threshold unless !defined ($ff_threshold); - $parameters{'each_ff'} = $each_ff unless !defined ($each_ff); - $parameters{'min_ff_event_normal'} = $ff_threshold_normal unless !defined ($ff_threshold_normal); - $parameters{'min_ff_event_warning'} = $ff_threshold_warning unless !defined ($ff_threshold_warning); - $parameters{'min_ff_event_critical'} = $ff_threshold_critical unless !defined ($ff_threshold_critical); - $parameters{'ff_timeout'} = $ff_timeout unless !defined ($ff_timeout); - $parameters{'critical_inverse'} = $critical_inverse unless !defined ($critical_inverse); - $parameters{'warning_inverse'} = $warning_inverse unless !defined ($warning_inverse); - $parameters{'critical_instructions'} = $critical_instructions unless !defined ($critical_instructions); - $parameters{'warning_instructions'} = $warning_instructions unless !defined ($warning_instructions); - $parameters{'unknown_instructions'} = $unknown_instructions unless !defined ($unknown_instructions); - - if ($in_policy == 0) { - pandora_create_module_from_hash ($conf, \%parameters, $dbh); - } - else { - enterprise_hook('pandora_create_policy_module_from_hash', [$conf, \%parameters, $dbh]); - } -} - -############################################################################## -# Create web module. -# Related option: --create_web_module -############################################################################## - -sub cli_create_web_module($) { - my $in_policy = shift; - my ($policy_name, $module_name, $module_type, $agent_name, $description, $module_group, - $min,$max,$post_process, $interval, $warning_min, $warning_max, $critical_min, - $critical_max, $history_data, $definition_file, $configuration_data, $warning_str, $critical_str, $enable_unknown_events, - $ff_threshold, $each_ff, $ff_threshold_normal, $ff_threshold_warning, $ff_threshold_critical, $ff_timeout, - $warning_inverse, $critical_inverse, $critical_instructions, $warning_instructions, $unknown_instructions); - - if ($in_policy == 0) { - ($module_name, $module_type, $agent_name, $description, $module_group, - $min,$max,$post_process, $interval, $warning_min, $warning_max, $critical_min, - $critical_max, $history_data, $definition_file, $warning_str, $critical_str, $enable_unknown_events, $ff_threshold, - $each_ff, $ff_threshold_normal, $ff_threshold_warning, $ff_threshold_critical, $ff_timeout, - $warning_inverse, $critical_inverse, $critical_instructions, $warning_instructions, $unknown_instructions) = @ARGV[2..30]; - } - else { - ($policy_name, $module_name, $module_type, $description, $module_group, - $min,$max,$post_process, $interval, $warning_min, $warning_max, $critical_min, - $critical_max, $history_data, $configuration_data, $warning_str, $critical_str, $enable_unknown_events, $ff_threshold, - $each_ff, $ff_threshold_normal, $ff_threshold_warning, $ff_threshold_critical, $ff_timeout, - $warning_inverse, $critical_inverse, $critical_instructions, $warning_instructions, $unknown_instructions) = @ARGV[2..31]; - } - - my $module_name_def; - my $module_type_def; - - my $agent_id; - my $policy_id; - - my $disabled_types_event = {}; - if ($enable_unknown_events) { - $disabled_types_event->{'going_unknown'} = 0; - } - else { - $disabled_types_event->{'going_unknown'} = 1; - } - my $disabled_types_event_json = encode_json($disabled_types_event); - - if ($in_policy == 0) { - $agent_id = get_agent_id($dbh,$agent_name); - exist_check($agent_id,'agent',$agent_name); - - my $module_exists = get_agent_module_id($dbh, $module_name, $agent_id); - non_exist_check($module_exists, 'module name', $module_name); - - #~ print_log "[INFO] Adding module '$module_name' to agent '$agent_name'\n\n"; - } - else { - $policy_id = enterprise_hook('get_policy_id',[$dbh, safe_input($policy_name)]); - exist_check($policy_id,'policy',$policy_name); - - my $policy_module_exist = enterprise_hook('get_policy_module_id',[$dbh, $policy_id, $module_name]); - non_exist_check($policy_module_exist,'policy module',$module_name); - - #~ print_log "[INFO] Adding module '$module_name' to policy '$policy_name'\n\n"; - } - - $module_name_def = $module_name; - $module_type_def = $module_type; - # If the module is local and is not to policy, we add it to the conf file - if (defined($definition_file) && (-e $definition_file) && (-e $conf->{incomingdir}.'/conf/'.md5($agent_name).'.conf')){ - open (FILE, $definition_file); - my @file = <FILE>; - my $definition = join("", @file); - close (FILE); - - # If the parameter name or type and the definition file name or type - # dont match will be set the file definitions - open (FILE, $definition_file); - while (<FILE>) { - chomp; - my ($key, $val) = split / /; - if ($key eq 'module_name') { - $module_name_def = $val; - } - if ($key eq 'module_type') { - $module_type_def = $val; - } - } - close (FILE); - - #open (FILE, $conf->{incomingdir}.'/conf/'.md5($agent_name).'.conf'); - #my @file = <FILE>; - #my $conf_file = join("", @file); - #close(FILE); - - #open FILE, "> ".$conf->{incomingdir}.'/conf/'.md5($agent_name).'.conf'; - #print FILE "$conf_file\n$definition"; - #close(FILE); - - enterprise_hook('pandora_update_md5_file', [$conf, $agent_name]); - } - - if ($in_policy == 0) { - my $module_exists = get_agent_module_id($dbh, $module_name_def, $agent_id); - non_exist_check($module_exists, 'module name', $module_name_def); - print_log "[INFO] Adding module '$module_name' to agent '$agent_name'\n\n"; - } - else { - my $policy_module_exist = enterprise_hook('get_policy_module_id',[$dbh, $policy_id, $module_name_def]); - non_exist_check($policy_module_exist,'policy module',$module_name_def); - print_log "[INFO] Adding module '$module_name' to policy '$policy_name'\n\n"; - } - - if (defined($definition_file) && $module_type ne $module_type_def) { - $module_type = $module_type_def; - print_log "[INFO] The module type has been forced to '$module_type' by the definition file\n\n"; - } - - if (defined($definition_file) && $module_name ne $module_name_def) { - $module_name = $module_name_def; - print_log "[INFO] The module name has been forced to '$module_name' by the definition file\n\n"; - } - - # The get_module_id has wrong name. Change in future - my $module_type_id = get_module_id($dbh,$module_type); - exist_check($module_type_id,'module type',$module_type); - - if ($module_type !~ m/.?web.?/) { - print_log "[ERROR] '$module_type' is not valid type for web modules. Try with web_data, web_proc, web_content_data or web_content_string types\n\n"; - exit; - } - - my $module_group_id = 0; - - if (defined($module_group)) { - $module_group_id = get_module_group_id($dbh,$module_group); - exist_check($module_group_id,'module group',$module_group); - } - - my %parameters; - - $parameters{'id_tipo_modulo'} = $module_type_id; - - if ($in_policy == 0) { - $parameters{'nombre'} = safe_input($module_name); - $parameters{'id_agente'} = $agent_id; - } - else { - $parameters{'name'} = safe_input($module_name); - $parameters{'id_policy'} = $policy_id; - } - - # Optional parameters - $parameters{'id_module_group'} = $module_group_id unless !defined ($module_group); - $parameters{'min_warning'} = $warning_min unless !defined ($warning_min); - $parameters{'max_warning'} = $warning_max unless !defined ($warning_max); - $parameters{'min_critical'} = $critical_min unless !defined ($critical_min); - $parameters{'max_critical'} = $critical_max unless !defined ($critical_max); - $parameters{'history_data'} = $history_data unless !defined ($history_data); - if ($in_policy == 0) { - $parameters{'descripcion'} = safe_input($description) unless !defined ($description); - $parameters{'id_modulo'} = 7; - } - else { - $parameters{'description'} = safe_input($description) unless !defined ($description); - $parameters{'id_module'} = 7; - $configuration_data !~ s/\\n/\n/g; - $parameters{'configuration_data'} = safe_input($configuration_data); - } - $parameters{'min'} = $min unless !defined ($min); - $parameters{'max'} = $max unless !defined ($max); - $parameters{'post_process'} = $post_process unless !defined ($post_process); - $parameters{'module_interval'} = $interval unless !defined ($interval); - $parameters{'str_warning'} = safe_input($warning_str) unless !defined ($warning_str); - $parameters{'str_critical'} = safe_input($critical_str) unless !defined ($critical_str); - $parameters{'disabled_types_event'} = $disabled_types_event_json; - $parameters{'min_ff_event'} = $ff_threshold unless !defined ($ff_threshold); - $parameters{'each_ff'} = $each_ff unless !defined ($each_ff); - $parameters{'min_ff_event_normal'} = $ff_threshold_normal unless !defined ($ff_threshold_normal); - $parameters{'min_ff_event_warning'} = $ff_threshold_warning unless !defined ($ff_threshold_warning); - $parameters{'min_ff_event_critical'} = $ff_threshold_critical unless !defined ($ff_threshold_critical); - $parameters{'ff_timeout'} = $ff_timeout unless !defined ($ff_timeout); - $parameters{'critical_inverse'} = $critical_inverse unless !defined ($critical_inverse); - $parameters{'warning_inverse'} = $warning_inverse unless !defined ($warning_inverse); - $parameters{'critical_instructions'} = $critical_instructions unless !defined ($critical_instructions); - $parameters{'warning_instructions'} = $warning_instructions unless !defined ($warning_instructions); - $parameters{'unknown_instructions'} = $unknown_instructions unless !defined ($unknown_instructions); - - if ($in_policy == 0) { - pandora_create_module_from_hash ($conf, \%parameters, $dbh); - } - else { - enterprise_hook('pandora_create_policy_module_from_hash', [$conf, \%parameters, $dbh]); - } - - #Begin Insert module definition from file_definition in bd - if (defined($definition_file)){ - - open(my $fh, '<', $definition_file) or die($!); - my @lines = <$fh>; - close ($fh); - - my $sql = get_db_value ($dbh, "SELECT MAX(id_agente_modulo) FROM tagente_modulo"); - my $sql2 = "UPDATE tagente_modulo SET plugin_parameter = '".join("",@lines)."' WHERE id_agente_modulo = ".$sql; - my $create = $dbh->do($sql2); - if($create){ - print "Success"; - } - else{ - print "Failure<br/>$DBI::errstr"; - } - } - #End Insert module definition from file_definition in bd - -} - -############################################################################## -# Create module group. -# Related option: --create_module_group -############################################################################## -sub cli_create_module_group () { - my $module_group_name = @ARGV[2]; - - my $id_module_group = get_module_group_id($dbh, $module_group_name); - non_exist_check($id_module_group,'group',$module_group_name); - - db_insert ($dbh, 'id_mg', 'INSERT INTO tmodule_group (name) VALUES (?)', safe_input($module_group_name)); -} - -############################################################################## -# Create network module from component. -# Related option: --create_network_module_from_component -############################################################################## - -sub cli_create_network_module_from_component() { - my ($agent_name, $component_name) = @ARGV[2..3]; - - my $agent_id = get_agent_id($dbh,$agent_name); - exist_check($agent_id,'agent',$agent_name); - - my $nc_id = pandora_get_network_component_id($dbh, $component_name); - exist_check($nc_id,'network component',$component_name); - - my $module_exists = get_agent_module_id($dbh, $component_name, $agent_id); - non_exist_check($module_exists, 'module name', $component_name); - - # Get network component data - my $component = get_db_single_row ($dbh, 'SELECT * FROM tnetwork_component WHERE id_nc = ?', $nc_id); - - pandora_create_module_from_network_component ($conf, $component, $agent_id, $dbh); -} - -############################################################################## -# Create netflow filter -# Related option: --create_netflow_filter -############################################################################## - -sub cli_create_netflow_filter() { - my ($filter_name, $group_name, $filter, $aggregate_by, $output_format) = @ARGV[2..6]; - - my $group_id = get_group_id($dbh, $group_name); - exist_check($group_id,'group',$group_name); - - logger($conf, 'Creating netflow filter "' . $filter_name . '"', 10); - - # Create the module - my $module_id = db_insert ($dbh, 'id_sg', 'INSERT INTO tnetflow_filter (id_name, id_group, advanced_filter, filter_args, aggregate, output) - VALUES (?, ?, ?, ?, ?, ?)', - safe_input($filter_name), $group_id, safe_input($filter), - '"(' . $filter . ')"', $aggregate_by, $output_format); -} - -############################################################################## -# Create network module. -# Related option: --create_network_module -############################################################################## - -sub cli_create_network_module($) { - my $in_policy = shift; - my ($policy_name, $module_name, $module_type, $agent_name, $module_address, $module_port, $description, - $module_group, $min, $max, $post_process, $interval, $warning_min, $warning_max, $critical_min, - $critical_max, $history_data, $ff_threshold, $warning_str, $critical_str, $enable_unknown_events, $each_ff, - $ff_threshold_normal, $ff_threshold_warning, $ff_threshold_critical, $timeout, $retries, $critical_instructions, - $warning_instructions, $unknown_instructions, $warning_inverse, $critical_inverse); - - if ($in_policy == 0) { - ($module_name, $module_type, $agent_name, $module_address, $module_port, $description, - $module_group, $min, $max, $post_process, $interval, $warning_min, $warning_max, $critical_min, - $critical_max, $history_data, $ff_threshold, $warning_str, $critical_str, $enable_unknown_events, - $each_ff, $ff_threshold_normal, $ff_threshold_warning, - $ff_threshold_critical, $timeout, $retries,$critical_instructions, $warning_instructions, $unknown_instructions, - $warning_inverse, $critical_inverse) = @ARGV[2..32]; - } - else { - ($policy_name, $module_name, $module_type, $module_port, $description, - $module_group, $min, $max, $post_process, $interval, $warning_min, $warning_max, $critical_min, - $critical_max, $history_data, $ff_threshold, $warning_str, $critical_str, $enable_unknown_events, - $each_ff, $ff_threshold_normal, $ff_threshold_warning, - $ff_threshold_critical, $timeout, $retries, $critical_instructions, $warning_instructions, $unknown_instructions, - $warning_inverse, $critical_inverse) = @ARGV[2..31]; - } - - my $module_name_def; - my $module_type_def; - my $agent_id; - my $policy_id; - - my $disabled_types_event = {}; - if ($enable_unknown_events) { - $disabled_types_event->{'going_unknown'} = 0; - } - else { - $disabled_types_event->{'going_unknown'} = 1; - } - my $disabled_types_event_json = encode_json($disabled_types_event); - - if ($in_policy == 0) { - $agent_id = get_agent_id($dbh,$agent_name); - exist_check($agent_id,'agent',$agent_name); - - my $module_exists = get_agent_module_id($dbh, $module_name, $agent_id); - non_exist_check($module_exists, 'module name', $module_name); - - print_log "[INFO] Adding module '$module_name' to agent '$agent_name'\n\n"; - } - else { - $policy_id = enterprise_hook('get_policy_id',[$dbh, safe_input($policy_name)]); - exist_check($policy_id,'policy',$policy_name); - - my $policy_module_exist = enterprise_hook('get_policy_module_id',[$dbh, $policy_id, $module_name]); - non_exist_check($policy_module_exist,'policy module',$module_name); - - print_log "[INFO] Adding module '$module_name' to policy '$policy_name'\n\n"; - } - - if ($module_type =~ m/.?snmp.?/) { - print_log "[ERROR] '$module_type' is not a valid type. For snmp modules use --create_snmp_module parameter\n\n"; - $param = '--create_snmp_module'; - help_screen (); - exit 1; - } - if ($module_type !~ m/.?icmp.?/ && $module_type !~ m/.?tcp.?/) { - print_log "[ERROR] '$module_type' is not valid type for (not snmp) network modules. Try with icmp or tcp types\n\n"; - exit; - } - - # The get_module_id has wrong name. Change in future - my $module_type_id = get_module_id($dbh,$module_type); - exist_check($module_type_id,'module type',$module_type); - - my $module_group_id = 0; - - if(defined($module_group)) { - $module_group_id = get_module_group_id($dbh,$module_group); - exist_check($module_group_id,'module group',$module_group); - } - - if ($module_type !~ m/.?icmp.?/) { - if (not defined($module_port)) { - print_log "[ERROR] Port error. Agents of type distinct of icmp need port\n\n"; - exit; - } - if ($module_port > 65535 || $module_port < 1) { - print_log "[ERROR] Port error. Port must into [1-65535]\n\n"; - exit; - } - } - my %parameters; - - $parameters{'id_tipo_modulo'} = $module_type_id; - - if ($in_policy == 0) { - $parameters{'nombre'} = safe_input($module_name); - $parameters{'id_agente'} = $agent_id; - $parameters{'ip_target'} = $module_address; - } - else { - $parameters{'name'} = safe_input($module_name); - $parameters{'id_policy'} = $policy_id; - } - - # Optional parameters - $parameters{'id_module_group'} = $module_group_id unless !defined ($module_group); - $parameters{'min_warning'} = $warning_min unless !defined ($warning_min); - $parameters{'max_warning'} = $warning_max unless !defined ($warning_max); - $parameters{'min_critical'} = $critical_min unless !defined ($critical_min); - $parameters{'max_critical'} = $critical_max unless !defined ($critical_max); - $parameters{'history_data'} = $history_data unless !defined ($history_data); - $parameters{'tcp_port'} = $module_port unless !defined ($module_port); - if ($in_policy == 0) { - $parameters{'descripcion'} = safe_input($description) unless !defined ($description); - $parameters{'id_modulo'} = 2; - } - else { - $parameters{'description'} = safe_input($description) unless !defined ($description); - $parameters{'id_module'} = 2; - } - $parameters{'min'} = $min unless !defined ($min); - $parameters{'max'} = $max unless !defined ($max); - $parameters{'post_process'} = $post_process unless !defined ($post_process); - $parameters{'module_interval'} = $interval unless !defined ($interval); - $parameters{'min_ff_event'} = $ff_threshold unless !defined ($ff_threshold); - $parameters{'str_warning'} = safe_input($warning_str) unless !defined ($warning_str); - $parameters{'str_critical'} = safe_input($critical_str) unless !defined ($critical_str); - $parameters{'disabled_types_event'} = $disabled_types_event_json; - $parameters{'each_ff'} = $each_ff unless !defined ($each_ff); - $parameters{'min_ff_event_normal'} = $ff_threshold_normal unless !defined ($ff_threshold_normal); - $parameters{'min_ff_event_warning'} = $ff_threshold_warning unless !defined ($ff_threshold_warning); - $parameters{'min_ff_event_critical'} = $ff_threshold_critical unless !defined ($ff_threshold_critical); - $parameters{'max_timeout'} = $timeout unless !defined ($timeout); - $parameters{'max_retries'} = $retries unless !defined ($retries); - $parameters{'critical_instructions'} = $critical_instructions unless !defined ($critical_instructions); - $parameters{'warning_instructions'} = $warning_instructions unless !defined ($warning_instructions); - $parameters{'unknown_instructions'} = $unknown_instructions unless !defined ($unknown_instructions); - $parameters{'critical_inverse'} = $critical_inverse unless !defined ($critical_inverse); - $parameters{'warning_inverse'} = $warning_inverse unless !defined ($warning_inverse); - - if ($in_policy == 0) { - pandora_create_module_from_hash ($conf, \%parameters, $dbh); - } - else { - enterprise_hook('pandora_create_policy_module_from_hash', [$conf, \%parameters, $dbh]); - } -} - -############################################################################## -# Create snmp module. -# Related option: --create_snmp_module -############################################################################## - -sub cli_create_snmp_module($) { - my $in_policy = shift; - my ($policy_name, $module_name, $module_type, $agent_name, $module_address, $module_port, $version, $community, - $oid, $description, $module_group, $min, $max, $post_process, $interval, $warning_min, - $warning_max, $critical_min, $critical_max, $history_data, $snmp3_priv_method, $snmp3_priv_pass, - $snmp3_sec_level, $snmp3_auth_method, $snmp3_auth_user, $snmp3_auth_pass, $ff_threshold, $warning_str, $critical_str, $enable_unknown_events, - $each_ff, $ff_threshold_normal, $ff_threshold_warning, $ff_threshold_critical, $timeout, $retries, - $critical_instructions, $warning_instructions, $unknown_instructions, $warning_inverse, $critical_inverse); - - if ($in_policy == 0) { - ($module_name, $module_type, $agent_name, $module_address, $module_port, $version, $community, - $oid, $description, $module_group, $min, $max, $post_process, $interval, $warning_min, - $warning_max, $critical_min, $critical_max, $history_data, $snmp3_priv_method, $snmp3_priv_pass, - $snmp3_sec_level, $snmp3_auth_method, $snmp3_auth_user, $snmp3_auth_pass, $ff_threshold, $warning_str, $critical_str, $enable_unknown_events, - $each_ff, $ff_threshold_normal, $ff_threshold_warning, $ff_threshold_critical, $timeout, $retries, - $critical_instructions, $warning_instructions, $unknown_instructions, $warning_inverse, $critical_inverse) = @ARGV[2..41]; - } - else { - ($policy_name, $module_name, $module_type, $module_port, $version, $community, - $oid, $description, $module_group, $min, $max, $post_process, $interval, $warning_min, - $warning_max, $critical_min, $critical_max, $history_data, $snmp3_priv_method, $snmp3_priv_pass, - $snmp3_sec_level, $snmp3_auth_method, $snmp3_auth_user, $snmp3_auth_pass, $ff_threshold, $warning_str, $critical_str, $enable_unknown_events, - $each_ff, $ff_threshold_normal, $ff_threshold_warning, $ff_threshold_critical, $timeout, $retries, - $critical_instructions, $warning_instructions, $unknown_instructions, $warning_inverse, $critical_inverse) = @ARGV[2..40]; - } - - my $module_name_def; - my $module_type_def; - my $agent_id; - my $policy_id; - - my $disabled_types_event = {}; - if ($enable_unknown_events) { - $disabled_types_event->{'going_unknown'} = 0; - } - else { - $disabled_types_event->{'going_unknown'} = 1; - } - my $disabled_types_event_json = encode_json($disabled_types_event); - - if ($in_policy == 0) { - $agent_id = get_agent_id($dbh,$agent_name); - exist_check($agent_id,'agent',$agent_name); - - my $module_exists = get_agent_module_id($dbh, $module_name, $agent_id); - non_exist_check($module_exists, 'module name', $module_name); - - print_log "[INFO] Adding module '$module_name' to agent '$agent_name'\n\n"; - } - else { - $policy_id = enterprise_hook('get_policy_id',[$dbh, safe_input($policy_name)]); - exist_check($policy_id,'policy',$policy_name); - - my $policy_module_exist = enterprise_hook('get_policy_module_id',[$dbh, $policy_id, $module_name]); - non_exist_check($policy_module_exist,'policy module',$module_name); - - print_log "[INFO] Adding module '$module_name' to policy '$policy_name'\n\n"; - } - - # The get_module_id has wrong name. Change in future - my $module_type_id = get_module_id($dbh,$module_type); - exist_check($module_type_id,'module type',$module_type); - - my $module_group_id = 0; - - if (defined($module_group)) { - $module_group_id = get_module_group_id($dbh,$module_group); - exist_check($module_group_id,'module group',$module_group); - } - - if ($module_type !~ m/.?snmp.?/) { - print_log "[ERROR] '$module_type' is not a valid snmp type\n\n"; - exit; - } - - if ($module_port > 65535 || $module_port < 1) { - print_log "[ERROR] Port error. Port must into [1-65535]\n\n"; - exit; - } - - my %parameters; - - $parameters{'id_tipo_modulo'} = $module_type_id; - - if ($in_policy == 0) { - $parameters{'nombre'} = safe_input($module_name); - $parameters{'id_agente'} = $agent_id; - $parameters{'ip_target'} = $module_address; - } - else { - $parameters{'name'} = safe_input($module_name); - $parameters{'id_policy'} = $policy_id; - } - - $parameters{'tcp_port'} = $module_port; - $parameters{'tcp_send'} = $version; - - # Optional parameters - $parameters{'id_module_group'} = $module_group_id unless !defined ($module_group); - $parameters{'min_warning'} = $warning_min unless !defined ($warning_min); - $parameters{'max_warning'} = $warning_max unless !defined ($warning_max); - $parameters{'min_critical'} = $critical_min unless !defined ($critical_min); - $parameters{'max_critical'} = $critical_max unless !defined ($critical_max); - $parameters{'history_data'} = $history_data unless !defined ($history_data); - if ($in_policy == 0) { - $parameters{'descripcion'} = safe_input($description) unless !defined ($description); - #2 for snmp modules - $parameters{'id_modulo'} = 2; - } - else { - $parameters{'description'} = safe_input($description) unless !defined ($description); - #2 for snmp modules - $parameters{'id_module'} = 2; - } - $parameters{'min'} = $min unless !defined ($min); - $parameters{'max'} = $max unless !defined ($max); - $parameters{'post_process'} = $post_process unless !defined ($post_process); - $parameters{'module_interval'} = $interval unless !defined ($interval); - $parameters{'snmp_community'} = $community unless !defined ($community); - $parameters{'snmp_oid'} = $oid unless !defined ($oid); - $parameters{'min_ff_event'} = $ff_threshold unless !defined ($ff_threshold); - $parameters{'str_warning'} = safe_input($warning_str) unless !defined ($warning_str); - $parameters{'str_critical'} = safe_input($critical_str) unless !defined ($critical_str); - - if ($version == 3) { - $parameters{'custom_string_1'} = $snmp3_priv_method; - $parameters{'custom_string_2'} = $snmp3_priv_pass; - $parameters{'custom_string_3'} = $snmp3_sec_level; - $parameters{'plugin_parameter'} = $snmp3_auth_method; - $parameters{'plugin_user'} = $snmp3_auth_user; - $parameters{'plugin_pass'} = $snmp3_auth_pass; - } - - $parameters{'disabled_types_event'} = $disabled_types_event_json; - $parameters{'each_ff'} = $each_ff unless !defined ($each_ff); - $parameters{'min_ff_event_normal'} = $ff_threshold_normal unless !defined ($ff_threshold_normal); - $parameters{'min_ff_event_warning'} = $ff_threshold_warning unless !defined ($ff_threshold_warning); - $parameters{'min_ff_event_critical'} = $ff_threshold_critical unless !defined ($ff_threshold_critical); - $parameters{'max_timeout'} = $timeout unless !defined ($timeout); - $parameters{'max_retries'} = $retries unless !defined ($retries); - $parameters{'critical_instructions'} = $critical_instructions unless !defined ($critical_instructions); - $parameters{'warning_instructions'} = $warning_instructions unless !defined ($warning_instructions); - $parameters{'unknown_instructions'} = $unknown_instructions unless !defined ($unknown_instructions); - $parameters{'critical_inverse'} = $critical_inverse unless !defined ($critical_inverse); - $parameters{'warning_inverse'} = $warning_inverse unless !defined ($warning_inverse); - - if ($in_policy == 0) { - pandora_create_module_from_hash ($conf, \%parameters, $dbh); - } - else { - enterprise_hook('pandora_create_policy_module_from_hash', [$conf, \%parameters, $dbh]); - } -} - -############################################################################## -# Create plugin module. -# Related option: --create_plugin_module -############################################################################## - -sub cli_create_plugin_module($) { - my $in_policy = shift; - my ($policy_name, $module_name, $module_type, $agent_name, $module_address, $module_port, $plugin_name, - $user, $password, $params, $description, $module_group, $min, $max, $post_process, - $interval, $warning_min, $warning_max, $critical_min, $critical_max, $history_data, - $ff_threshold, $warning_str, $critical_str, $enable_unknown_events, - $each_ff, $ff_threshold_normal, $ff_threshold_warning, $ff_threshold_critical, $timeout, - $critical_instructions, $warning_instructions, $unknown_instructions, $warning_inverse, $critical_inverse); - - if ($in_policy == 0) { - ($module_name, $module_type, $agent_name, $module_address, $module_port, $plugin_name, - $user, $password, $params, $description, $module_group, $min, $max, $post_process, - $interval, $warning_min, $warning_max, $critical_min, $critical_max, $history_data, - $ff_threshold, $warning_str, $critical_str, $enable_unknown_events, - $each_ff, $ff_threshold_normal, $ff_threshold_warning, $ff_threshold_critical, $timeout, - $critical_instructions, $warning_instructions, $unknown_instructions, $warning_inverse, $critical_inverse) = @ARGV[2..35]; - } - else { - ($policy_name, $module_name, $module_type, $module_port, $plugin_name, - $user, $password, $params, $description, $module_group, $min, $max, $post_process, - $interval, $warning_min, $warning_max, $critical_min, $critical_max, $history_data, - $ff_threshold, $warning_str, $critical_str, $enable_unknown_events, - $each_ff, $ff_threshold_normal, $ff_threshold_warning, $ff_threshold_critical, $timeout, - $critical_instructions, $warning_instructions, $unknown_instructions, $warning_inverse, $critical_inverse) = @ARGV[2..34]; - } - - my $module_name_def; - my $module_type_def; - my $agent_id; - my $policy_id; - - my $disabled_types_event = {}; - if ($enable_unknown_events) { - $disabled_types_event->{'going_unknown'} = 0; - } - else { - $disabled_types_event->{'going_unknown'} = 1; - } - my $disabled_types_event_json = encode_json($disabled_types_event); - - if ($in_policy == 0) { - $agent_id = get_agent_id($dbh,$agent_name); - exist_check($agent_id,'agent',$agent_name); - - my $module_exists = get_agent_module_id($dbh, $module_name, $agent_id); - non_exist_check($module_exists, 'module name', $module_name); - - print_log "[INFO] Adding module '$module_name' to agent '$agent_name'\n\n"; - } - else { - $policy_id = enterprise_hook('get_policy_id',[$dbh, safe_input($policy_name)]); - exist_check($policy_id,'policy',$policy_name); - - my $policy_module_exist = enterprise_hook('get_policy_module_id',[$dbh, $policy_id, $module_name]); - non_exist_check($policy_module_exist,'policy module',$module_name); - - print_log "[INFO] Adding module '$module_name' to policy '$policy_name'\n\n"; - } - - # The get_module_id has wrong name. Change in future - my $module_type_id = get_module_id($dbh,$module_type); - exist_check($module_type_id,'module type',$module_type); - - if ($module_type !~ m/.?generic.?/ && $module_type ne 'log4x') { - print_log "[ERROR] '$module_type' is not valid type for plugin modules. Try with generic or log4x types\n\n"; - exit; - } - - my $module_group_id = get_module_group_id($dbh,$module_group); - exist_check($module_group_id,'module group',$module_group); - - my $plugin_id = get_plugin_id($dbh,$plugin_name); - exist_check($plugin_id,'plugin',$plugin_name); - - if ($module_port > 65535 || $module_port < 1) { - print_log "[ERROR] Port error. Port must into [1-65535]\n\n"; - exit; - } - - my %parameters; - - $parameters{'id_tipo_modulo'} = $module_type_id; - - if ($in_policy == 0) { - $parameters{'nombre'} = safe_input($module_name); - $parameters{'id_agente'} = $agent_id; - $parameters{'ip_target'} = $module_address; - } - else { - $parameters{'name'} = safe_input($module_name); - $parameters{'id_policy'} = $policy_id; - } - - $parameters{'tcp_port'} = $module_port; - $parameters{'id_plugin'} = $plugin_id; - $parameters{'plugin_user'} = $user; - $parameters{'plugin_pass'} = $password; - #$parameters{'plugin_parameter'} = safe_input($params); - - my @user_params = split(/\s+/, $params); - - my $plug_params = get_db_value ($dbh, 'SELECT macros FROM tplugin WHERE id =?', $plugin_id); - - if ($plug_params eq undef) { - print "[ERROR] Error to create module\n\n"; - help_screen(); - } - - if (${RDBMS} eq 'oracle') { - $plug_params =~ s/\\//g; - } - - my $decode_params = decode_json($plug_params); - - my $user_params_size = scalar(@user_params); - - foreach (my $i=1; $i <= $user_params_size; $i++){ - $decode_params->{$i}->{'value'} = $user_params[$i-1]; - } - - my $p_params = encode_json($decode_params); - - $parameters{'macros'} = $p_params; - - # Optional parameters - $parameters{'id_module_group'} = $module_group_id unless !defined ($module_group); - $parameters{'min_warning'} = $warning_min unless !defined ($warning_min); - $parameters{'max_warning'} = $warning_max unless !defined ($warning_max); - $parameters{'min_critical'} = $critical_min unless !defined ($critical_min); - $parameters{'max_critical'} = $critical_max unless !defined ($critical_max); - $parameters{'history_data'} = $history_data unless !defined ($history_data); - if ($in_policy == 0) { - $parameters{'descripcion'} = safe_input($description) unless !defined ($description); - #4 for plugin modules - $parameters{'id_modulo'} = 4; - } - else { - $parameters{'description'} = safe_input($description) unless !defined ($description); - #4 for plugin modules - $parameters{'id_module'} = 4; - } - $parameters{'min'} = $min unless !defined ($min); - $parameters{'max'} = $max unless !defined ($max); - $parameters{'post_process'} = $post_process unless !defined ($post_process); - $parameters{'module_interval'} = $interval unless !defined ($interval); - $parameters{'min_ff_event'} = $ff_threshold unless !defined ($ff_threshold); - $parameters{'str_warning'} = safe_input($warning_str) unless !defined ($warning_str); - $parameters{'str_critical'} = safe_input($critical_str) unless !defined ($critical_str); - - $parameters{'disabled_types_event'} = $disabled_types_event_json; - $parameters{'each_ff'} = $each_ff unless !defined ($each_ff); - $parameters{'min_ff_event_normal'} = $ff_threshold_normal unless !defined ($ff_threshold_normal); - $parameters{'min_ff_event_warning'} = $ff_threshold_warning unless !defined ($ff_threshold_warning); - $parameters{'min_ff_event_critical'} = $ff_threshold_critical unless !defined ($ff_threshold_critical); - $parameters{'max_timeout'} = $timeout unless !defined ($timeout); - $parameters{'critical_instructions'} = $critical_instructions unless !defined ($critical_instructions); - $parameters{'warning_instructions'} = $warning_instructions unless !defined ($warning_instructions); - $parameters{'unknown_instructions'} = $unknown_instructions unless !defined ($unknown_instructions); - $parameters{'critical_inverse'} = $critical_inverse unless !defined ($critical_inverse); - $parameters{'warning_inverse'} = $warning_inverse unless !defined ($warning_inverse); - - if ($in_policy == 0) { - pandora_create_module_from_hash ($conf, \%parameters, $dbh); - } - else { - enterprise_hook('pandora_create_policy_module_from_hash', [$conf, \%parameters, $dbh]); - } -} - -############################################################################## -# Delete module. -# Related option: --delete_module -############################################################################## - -sub cli_delete_module() { - my ($module_name,$agent_name) = @ARGV[2..3]; - - print_log "[INFO] Deleting module '$module_name' from agent '$agent_name' \n\n"; - - my $id_agent = get_agent_id($dbh,$agent_name); - exist_check($id_agent,'agent',$agent_name); - my $id_module = get_agent_module_id($dbh,$module_name,$id_agent); - exist_check($id_module,'module',$module_name); - - pandora_delete_module($dbh,$id_module,$conf); -} - -############################################################################## -# Delete not policy modules. -# Related option: --delete_not_policy_modules -############################################################################## - -sub cli_delete_not_policy_modules() { - my $incomingdir; - my $incomingdirmd5; - - $incomingdir = $conf->{incomingdir}.'/conf/'; - $incomingdirmd5 = $conf->{incomingdir}.'/md5/'; - - # Open the folder - opendir FOLDER, $incomingdir || die "[ERROR] Opening incoming directory"; - - # Store the list of files - my @files = readdir(FOLDER); - my $file; - my $filemd5; - - print_log "[INFO] Deleting modules without policy from conf files \n\n"; - foreach $file (@files) - { - if($file ne '.' && $file ne '..') { - # Creates md5 filename of agent - $filemd5 = $file; - $filemd5 =~ s/\.conf/\.md5/g; - - my $ret = enterprise_hook('pandora_delete_not_policy_modules', [$incomingdir.$file, $incomingdirmd5.$filemd5]); - } - } - - my @local_modules_without_policies = get_db_rows ($dbh, 'SELECT * FROM tagente_modulo WHERE id_policy_module = 0 AND id_tipo_modulo = 1'); - - - foreach my $module (@local_modules_without_policies) { - pandora_delete_module ($dbh, $module->{'id_agente_modulo'}); - } -} - -############################################################################## -# Create template module. -# Related option: --create_template_module -############################################################################## - -sub cli_create_template_module() { - my ($template_name,$module_name,$agent_name) = @ARGV[2..4]; - - print_log "[INFO] Adding template '$template_name' to module '$module_name' from agent '$agent_name' \n\n"; - - my $id_agent = get_agent_id($dbh,$agent_name); - exist_check($id_agent,'agent',$agent_name); - my $module_id = get_agent_module_id($dbh,$module_name,$id_agent); - exist_check($module_id,'module',$module_name); - my $template_id = get_template_id($dbh,$template_name); - exist_check($template_id,'template',$template_name); - - pandora_create_template_module ($conf, $dbh, $module_id, $template_id); -} - -############################################################################## -# Delete template module. -# Related option: --delete_template_module -############################################################################## - -sub cli_delete_template_module() { - my ($template_name,$module_name,$agent_name) = @ARGV[2..4]; - - print_log "[INFO] Delete template '$template_name' from module '$module_name' from agent '$agent_name' \n\n"; - - my $id_agent = get_agent_id($dbh,$agent_name); - exist_check($id_agent,'agent',$agent_name); - my $module_id = get_agent_module_id($dbh,$module_name,$id_agent); - exist_check($module_id,'module',$module_name); - my $template_id = get_template_id($dbh,$template_name); - exist_check($template_id,'template',$template_name); - - my $template_module_id = get_template_module_id($dbh, $module_id, $template_id); - exist_check($template_module_id,"template '$template_name' on module",$module_name); - - pandora_delete_template_module ($dbh, $template_module_id); -} - -############################################################################## -# Create template action. -# Related option: --create_template_action -############################################################################## - -sub cli_create_template_action() { - my ($action_name,$template_name,$module_name,$agent_name,$fires_min,$fires_max) = @ARGV[2..7]; - - print_log "[INFO] Adding action '$action_name' to template '$template_name' in module '$module_name' from agent '$agent_name' with $fires_min min. fires and $fires_max max. fires\n\n"; - - my $id_agent = get_agent_id($dbh,$agent_name); - exist_check($id_agent,'agent',$agent_name); - my $module_id = get_agent_module_id($dbh,$module_name,$id_agent); - exist_check($module_id,'module',$module_name); - my $template_id = get_template_id($dbh,$template_name); - exist_check($template_id,'template',$template_name); - my $template_module_id = get_template_module_id($dbh,$module_id,$template_id); - exist_check($template_module_id,'template module',$template_name); - my $action_id = get_action_id($dbh,safe_input($action_name)); - exist_check($action_id,'action',$action_name); - - $fires_min = 0 unless defined ($fires_min); - $fires_max = 0 unless defined ($fires_max); - - my %parameters; - - $parameters{'id_alert_template_module'} = $template_module_id; - $parameters{'id_alert_action'} = $action_id; - $parameters{'fires_min'} = $fires_min; - $parameters{'fires_max'} = $fires_max; - - pandora_create_template_module_action ($conf, \%parameters, $dbh); -} - -############################################################################## -# Delete template action. -# Related option: --delete_template_action -############################################################################## - -sub cli_delete_template_action() { - my ($action_name,$template_name,$module_name,$agent_name) = @ARGV[2..5]; - - print_log "[INFO] Deleting action '$action_name' from template '$template_name' in module '$module_name' from agent '$agent_name')\n\n"; - - my $id_agent = get_agent_id($dbh,$agent_name); - exist_check($id_agent,'agent',$agent_name); - my $module_id = get_agent_module_id($dbh,$module_name,$id_agent); - exist_check($module_id,'module',$module_name); - my $template_id = get_template_id($dbh,$template_name); - exist_check($template_id,'template',$template_name); - my $template_module_id = get_template_module_id($dbh,$module_id,$template_id); - exist_check($template_module_id,'template module',$template_name); - my $action_id = get_action_id($dbh,safe_input($action_name)); - exist_check($action_id,'action',$action_name); - - pandora_delete_template_module_action ($dbh, $template_module_id, $action_id); -} - -############################################################################## -# Insert data to module. -# Related option: --data_module -############################################################################## - -sub cli_data_module() { - my ($server_name,$agent_name,$module_name,$module_type,$module_new_data,$datetime) = @ARGV[2..7]; - my $utimestamp; - - if(defined($datetime)) { - if ($datetime !~ /([0-9]{2,4})\-([0-1][0-9])\-([0-3][0-9]) +([0-2][0-9]):([0-5][0-9])/) { - print_log "[ERROR] Invalid datetime $datetime. (Correct format: YYYY-MM-DD HH:mm)\n"; - exit; - } - # Add the seconds - $datetime .= ":00"; - $utimestamp = dateTimeToTimestamp($datetime); - } - else { - $utimestamp = time(); - } - - # The get_module_id has wrong name. Change in future - my $module_type_id = get_module_id($dbh,$module_type); - exist_check($module_type_id,'module type',$module_type); - - my $id_agent = get_agent_id($dbh,$agent_name); - exist_check($id_agent,'agent',$agent_name); - - my $id_module = get_agent_module_id($dbh, $module_name, $id_agent); - exist_check($id_module, 'module name', $module_name); - - # Server_type 0 is dataserver - my $server_id = get_server_id($dbh,$server_name,0); - exist_check($server_id,'data server',$server_name); - - my $module = get_db_single_row ($dbh, 'SELECT * FROM tagente_modulo WHERE id_agente_modulo = ? AND id_tipo_modulo = ?', $id_module, $id_agent, $module_type_id); - - if(not defined($module->{'module_interval'})) { - print_log "[ERROR] No module found with this type. \n\n"; - exit; - } - - my %data = ('data' => $module_new_data); - - pandora_process_module ($conf, \%data, '', $module, $module_type, '', $utimestamp, $server_id, $dbh); - - print_log "[INFO] Inserting data to module '$module_name'\n\n"; -} - -############################################################################## -# Create a user. -# Related option: --create_user -############################################################################## - -sub cli_create_user() { - my ($user_name,$password,$is_admin,$comments) = @ARGV[2..5]; - - $comments = (defined ($comments) ? safe_input($comments) : '' ); - - my $user_exists = get_user_exists ($dbh, $user_name); - non_exist_check($user_exists,'user',$user_name); - - print_log "[INFO] Creating user '$user_name'\n\n"; - - pandora_create_user ($dbh, $user_name, md5($password), $is_admin, $comments); -} - -############################################################################## -# Update a user. -# Related option: --update_user -############################################################################## - -sub cli_user_update() { - my ($user_id,$field,$new_value) = @ARGV[2..4]; - - my $user_exists = get_user_exists ($dbh, $user_id); - exist_check($user_exists,'user',$user_id); - - if($field eq 'email' || $field eq 'phone' || $field eq 'is_admin' || $field eq 'language' || $field eq 'id_skin' || $field eq 'flash_chart') { - # Fields admited, no changes - } - elsif($field eq 'comments' || $field eq 'fullname') { - $new_value = safe_input($new_value); - } - elsif($field eq 'password') { - if($new_value eq '') { - print_log "[ERROR] Field '$field' cannot be empty\n\n"; - exit; - } - - $new_value = md5($new_value); - } - else { - print_log "[ERROR] Field '$field' doesnt exist\n\n"; - exit; - } - - print_log "[INFO] Updating field '$field' in user '$user_id'\n\n"; - - my $update; - - $update->{$field} = $new_value; - - pandora_update_user_from_hash ($update, 'id_user', safe_input($user_id), $dbh); -} - -############################################################################## -# Update an agent field. -# Related option: --update_agent -############################################################################## - -sub cli_agent_update() { - my ($agent_name,$field,$new_value) = @ARGV[2..4]; - - my $id_agent = get_agent_id($dbh,$agent_name); - exist_check($id_agent,'agent',$agent_name); - - # agent_name, address, description, group_name, interval, os_name, disabled, parent_name, cascade_protection, icon_path, update_gis_data, custom_id - - if($field eq 'disabled' || $field eq 'cascade_protection' || $field eq 'icon_path' || - $field eq 'update_gis_data' || $field eq 'custom_id') { - # Fields admited, no changes - } - elsif($field eq 'interval') { - $field = 'intervalo'; - } - elsif($field eq 'description') { - $field = 'comentarios'; - $new_value = safe_input($new_value); - } - elsif($field eq 'parent_name') { - my $id_parent = get_agent_id($dbh,$new_value); - exist_check($id_parent,'agent',$new_value); - $field = 'id_parent'; - $new_value = $id_parent; - } - elsif($field eq 'agent_name') { - my $agent_exists = get_agent_id($dbh,$new_value); - non_exist_check($agent_exists,'agent',$new_value); - $field = 'nombre'; - } - elsif($field eq 'group_name') { - my $id_group = get_group_id($dbh, $new_value); - exist_check($id_group,'group',$new_value); - $new_value = $id_group; - $field = 'id_grupo'; - } - elsif($field eq 'os_name') { - my $id_os = get_os_id($dbh, $new_value); - exist_check($id_os,'operating system',$new_value); - $new_value = $id_os; - $field = 'id_os'; - } - elsif($field eq 'address') { - # Check if the address already exist - my $address_id = get_addr_id($dbh,$new_value); - - # If the addres doesnt exist, we add it to the addresses list - if($address_id == -1) { - $address_id = add_address($dbh,$new_value); - } - - # Add the address to the agent - add_new_address_agent ($dbh, $address_id, $id_agent); - - $field = 'direccion'; - } - else { - print_log "[ERROR] Field '$field' doesnt exist\n\n"; - exit; - } - - print_log "[INFO] Updating field '$field' in agent '$agent_name'\n\n"; - - my $update; - - $update->{$field} = $new_value; - - pandora_update_table_from_hash ($conf, $update, 'id_agente', safe_input($id_agent), 'tagente', $dbh); -} - -############################################################################## -# Update an alert template. -# Related option: --update_alert_template -############################################################################## - -sub cli_alert_template_update() { - my ($template_name,$field,$new_value) = @ARGV[2..4]; - - my $template_id = pandora_get_alert_template_id ($dbh, $template_name); - exist_check($template_id,'alert template',$template_name); - - if($field eq 'matches_value' || $field eq 'value' || $field eq 'min_value' || - $field eq 'max_value' || $field eq 'type' || $field eq 'time_threshold' || - $field eq 'time_from' || $field eq 'time_to' || $field eq 'monday' || - $field eq 'tuesday' || $field eq 'wednesday' || $field eq 'thursday' || - $field eq 'friday' || $field eq 'saturday' || $field eq 'sunday' || - $field eq 'min_alerts' || $field eq 'max_alerts' || $field eq 'recovery_notify') { - # Fields admited, no changes - } - elsif($field eq 'name' || $field eq 'description' || $field eq 'field1' || $field eq 'field2' || $field eq 'field3' || $field eq 'recovery_field2' || $field eq 'recovery_field3') { - $new_value = safe_input($new_value); - } - elsif($field eq 'priority') { - if($new_value < 0 || $new_value > 4) { - print_log "[ERROR] Field '$field' is out of interval (0-4)\n\n"; - exit; - } - } - elsif($field eq 'default_action') { - # Check if exist - my $id_alert_action = get_action_id ($dbh, safe_input($new_value)); - exist_check($id_alert_action,'alert action',$new_value); - $new_value = $id_alert_action; - $field = 'id_alert_action'; - } - elsif($field eq 'group_name') { - # Check if exist - my $id_group = get_group_id($dbh, $new_value); - exist_check($id_group,'group',$new_value); - $new_value = $id_group; - $field = 'id_group'; - } - else { - print_log "[ERROR] Field '$field' doesnt exist\n\n"; - exit; - } - - print_log "[INFO] Updating field '$field' in alert template '$template_name'\n\n"; - - my $update; - - $update->{$field} = $new_value; - - pandora_update_alert_template_from_hash ($update, 'id', $template_id, $dbh); -} - -############################################################################## -# Check the specific fields of data module when update -############################################################################## - -sub pandora_check_data_module_fields($) { - my $field_value = shift; - - if($field_value->{'field'} eq 'ff_timeout') { - $field_value->{'field'} = 'ff_timeout'; - } - else { - print_log "[ERROR] The field '".$field_value->{'field'}."' is not available for data modules\n\n"; - exit; - } - -} - -############################################################################## -# Check the specific fields of network module when update -############################################################################## - -sub pandora_check_network_module_fields($) { - my $field_value = shift; - - if($field_value->{'field'} eq 'module_address') { - my $agent_name = @ARGV[3]; - - my $id_agent = get_agent_id($dbh,$agent_name); - - $field_value->{'field'} = 'ip_target'; - - # Check if the address already exist - my $address_id = get_addr_id($dbh,$field_value->{'new_value'}); - - # If the addres doesnt exist, we add it to the addresses list - if($address_id == -1) { - $address_id = add_address($dbh,$field_value->{'new_value'}); - } - - # Add the address to the agent - add_new_address_agent ($dbh, $address_id, $id_agent); - - # Only pending set as main address (Will be done at the end of the function) - } - elsif($field_value->{'field'} eq 'module_port') { - if ($field_value->{'new_value'} > 65535 || $field_value->{'new_value'} < 1) { - print_log "[ERROR] Port error. Port must into [1-65535]\n\n"; - exit; - } - $field_value->{'field'} = 'tcp_port'; - } - elsif($field_value->{'field'} eq 'timeout') { - $field_value->{'field'} = 'max_timeout'; - } - elsif($field_value->{'field'} eq 'retries') { - $field_value->{'field'} = 'max_retries'; - } - else { - print_log "[ERROR] The field '".$field_value->{'field'}."' is not available for network modules\n\n"; - exit; - } -} - -############################################################################## -# Check the specific fields of snmp module when update -############################################################################## - -sub pandora_check_snmp_module_fields($) { - my $field_value = shift; - - if($field_value->{'field'} eq 'version') { - $field_value->{'field'} = 'tcp_send'; - } - elsif($field_value->{'field'} eq 'community') { - $field_value->{'field'} = 'snmp_community'; - } - elsif($field_value->{'field'} eq 'oid') { - $field_value->{'field'} = 'snmp_oid'; - } - elsif($field_value->{'field'} eq 'snmp3_priv_method') { - $field_value->{'field'} = 'custom_string_1'; - } - elsif($field_value->{'field'} eq 'snmp3_priv_pass') { - $field_value->{'field'} = 'custom_string_2'; - } - elsif($field_value->{'field'} eq 'snmp3_sec_level') { - $field_value->{'field'} = 'custom_string_3'; - } - elsif($field_value->{'field'} eq 'snmp3_auth_method') { - $field_value->{'field'} = 'plugin_parameter'; - } - elsif($field_value->{'field'} eq 'snmp3_auth_user') { - $field_value->{'field'} = 'plugin_user'; - } - elsif($field_value->{'field'} eq 'snmp3_auth_pass') { - $field_value->{'field'} = 'plugin_pass'; - } - elsif($field_value->{'field'} eq 'module_address') { - my $agent_name = @ARGV[3]; - - my $id_agent = get_agent_id($dbh,$agent_name); - - $field_value->{'field'} = 'ip_target'; - - # Check if the address already exist - my $address_id = get_addr_id($dbh,$field_value->{'new_value'}); - - # If the addres doesnt exist, we add it to the addresses list - if($address_id == -1) { - $address_id = add_address($dbh,$field_value->{'new_value'}); - } - - # Add the address to the agent - add_new_address_agent ($dbh, $address_id, $id_agent); - - # Only pending set as main address (Will be done at the end of the function) - } - elsif($field_value->{'field'} eq 'module_port') { - if ($field_value->{'new_value'} > 65535 || $field_value->{'new_value'} < 1) { - print_log "[ERROR] Port error. Port must into [1-65535]\n\n"; - exit; - } - $field_value->{'field'} = 'tcp_port'; - } - elsif($field_value->{'field'} eq 'timeout') { - $field_value->{'field'} = 'max_timeout'; - } - elsif($field_value->{'field'} eq 'retries') { - $field_value->{'field'} = 'max_retries'; - } - else { - print_log "[ERROR] The field '".$field_value->{'field'}."' is not available for SNMP modules\n\n"; - exit; - } -} - -############################################################################## -# Check the specific fields of plugin module when update -############################################################################## - -sub pandora_check_plugin_module_fields($) { - my $field_value = shift; - - if($field_value->{'field'} eq 'plugin_name') { - my $plugin_id = get_plugin_id($dbh,$field_value->{'new_value'}); - exist_check($plugin_id,'plugin',$field_value->{'new_value'}); - - $field_value->{'new_value'} = $plugin_id; - $field_value->{'field'} = 'id_plugin'; - } - elsif($field_value->{'field'} eq 'user') { - $field_value->{'field'} = 'plugin_user'; - } - elsif($field_value->{'field'} eq 'password') { - $field_value->{'field'} = 'plugin_pass'; - } - elsif($field_value->{'field'} eq 'parameters') { - $field_value->{'field'} = 'plugin_parameter'; - $field_value->{'new_value'} = safe_input($field_value->{'new_value'}); - } - elsif($field_value->{'field'} eq 'module_address') { - my $agent_name = @ARGV[3]; - - my $id_agent = get_agent_id($dbh,$agent_name); - - $field_value->{'field'} = 'ip_target'; - - # Check if the address already exist - my $address_id = get_addr_id($dbh,$field_value->{'new_value'}); - - # If the addres doesnt exist, we add it to the addresses list - if($address_id == -1) { - $address_id = add_address($dbh,$field_value->{'new_value'}); - } - - # Add the address to the agent - add_new_address_agent ($dbh, $address_id, $id_agent); - - # Only pending set as main address (Will be done at the end of the function) - } - elsif($field_value->{'field'} eq 'module_port') { - $field_value->{'field'} = 'tcp_port'; - } - elsif($field_value->{'field'} eq 'timeout') { - $field_value->{'field'} = 'max_timeout'; - } - else { - print_log "[ERROR] The field '".$field_value->{'field'}."' is not available for plugin modules\n\n"; - exit; - } -} - -############################################################################## -# Add a profile to a User in a Group -# Related option: --update_module -############################################################################## - -sub cli_module_update() { - my ($module_name,$agent_name,$field,$new_value) = @ARGV[2..5]; - - my $id_agent = get_agent_id($dbh,$agent_name); - exist_check($id_agent,'agent',$agent_name); - my $id_agent_module = get_agent_module_id ($dbh, $module_name, $id_agent); - exist_check($id_agent_module,'agent module',$module_name); - - # Check and adjust parameters in common values - - if($field eq 'min' || $field eq 'max' || $field eq 'post_process' || $field eq 'history_data') { - # Fields admited, no changes - } - elsif($field eq 'interval') { - $field = 'module_interval'; - } - elsif($field eq 'warning_min') { - $field = 'min_warning'; - } - elsif($field eq 'warning_max') { - $field = 'max_warning'; - } - elsif($field eq 'critical_min') { - $field = 'min_critical'; - } - elsif($field eq 'critical_max') { - $field = 'max_critical'; - } - elsif($field eq 'warning_str') { - $field = 'str_warning'; - $new_value = safe_input($new_value); - } - elsif($field eq 'critical_str') { - $field = 'str_critical'; - $new_value = safe_input($new_value); - } - elsif($field eq 'agent_name') { - my $id_agent_change = get_agent_id($dbh,$new_value); - exist_check($id_agent_change,'agent',$new_value); - my $id_agent_module_exist = get_agent_module_id ($dbh, $module_name, $id_agent_change); - if($id_agent_module_exist != -1) { - print_log "[ERROR] A module called '$module_name' already exist in the agent '$new_value'\n\n"; - exit; - } - $field = 'id_agente'; - $new_value = $id_agent_change; - } - elsif ($field eq 'module_name') { - my $id_agent_module_change = get_agent_module_id ($dbh, $new_value, $id_agent); - if ($id_agent_module_change != -1) { - print_log "[ERROR] A module called '$new_value' already exist in the agent '$agent_name'\n\n"; - exit; - } - $field = 'nombre'; - $new_value = safe_input($new_value); - } - elsif ($field eq 'description') { - $field = 'descripcion'; - $new_value = safe_input($new_value); - } - elsif ($field eq 'module_group') { - my $module_group_id = get_module_group_id($dbh,$new_value); - - if ($module_group_id == -1) { - print_log "[ERROR] Module group '$new_value' doesnt exist\n\n"; - exit; - } - $field = 'id_module_group'; - $new_value = $module_group_id; - } - elsif ($field eq 'enable_unknown_events') { - my $disabled_types_event = {}; - if ($new_value) { - $disabled_types_event->{'going_unknown'} = 0; - } - else { - $disabled_types_event->{'going_unknown'} = 1; - } - $field = 'disabled_types_event'; - $new_value = encode_json($disabled_types_event); - } - elsif ($field eq 'ff_threshold') { - $field = 'min_ff_event'; - } - elsif ($field eq 'each_ff') { - $field = 'each_ff'; - } - elsif ($field eq 'ff_threshold_normal') { - $field = 'min_ff_event_normal'; - } - elsif ($field eq 'ff_threshold_warning') { - $field = 'min_ff_event_warning'; - } - elsif ($field eq 'ff_threshold_critical') { - $field = 'min_ff_event_critical'; - } - elsif ($field eq 'critical_instructions') { - $field = 'critical_instructions'; - } - elsif ($field eq 'warning_instructions') { - $field = 'warning_instructions'; - } - elsif ($field eq 'unknown_instructions') { - $field = 'unknown_instructions'; - } - else { - # If is not a common value, check type and call type update funtion - my $type = pandora_get_module_type($dbh,$id_agent_module); - - my %field_value; - $field_value{'field'} = $field; - $field_value{'new_value'} = $new_value; - - if($type eq 'data') { - pandora_check_data_module_fields(\%field_value); - } - elsif($type eq 'network') { - pandora_check_network_module_fields(\%field_value); - } - elsif($type eq 'snmp') { - pandora_check_snmp_module_fields(\%field_value); - } - elsif($type eq 'plugin') { - pandora_check_plugin_module_fields(\%field_value); - } - else { - print_log "[ERROR] The field '$field' is not available for this type of module\n\n"; - } - - $field = $field_value{'field'}; - $new_value = $field_value{'new_value'}; - } - - print_log "[INFO] Updating field '$field' in module '$module_name' of agent '$agent_name' with new value '$new_value'\n\n"; - - my $update; - - $update->{$field} = $new_value; - - my $policy_id = enterprise_hook('get_id_policy_module_agent_module',[$dbh, safe_input($id_agent_module)]); - if ( $policy_id > 0) { - $update->{policy_linked} = 0; - } - - pandora_update_module_from_hash ($conf, $update, 'id_agente_modulo', $id_agent_module, $dbh); -} - -############################################################################## -# Exec a CLI option from file -# Related option: --exec_from_file -############################################################################## - -sub cli_exec_from_file() { - my $c = 0; - my $command = $0; - my $file; - foreach my $opt (@ARGV) { - $c++; - - # First and second are the script and conf paths - if($c < 2) { - $command = "$command $opt"; - } - # Third param is ignored, because is --exec_from_file - # Fourth param is the file path - elsif($c == 3) { - $file = $opt; - if(!(-e $file)) { - print_log "[ERROR] File '$file' not exists or cannot be opened\n\n"; - exit; - } - } - # Fifth parameter is the option (we add -- before it) - elsif($c == 4) { - $command = "$command --$opt"; - } - # Next parameters are the option params, we add quotes to them to avoid errors - elsif($c > 4) { - if($opt =~ m/\s/g) { - $command = $command . ' "' . $opt .'"'; - } - else { - $command = $command . ' ' . $opt; - } - } - } - - open (FILE, $file); - while (<FILE>) { - my $command_tr = $command; - chomp; - my @fields = split(',',$_); - $c = 0; - foreach my $field (@fields) { - $c++; - my $macro_name = "__FIELD".$c."__"; - if($field =~ m/\s/g && $field !~ m/^"/) { - $field = '"'.$field.'"'; - } - $command_tr !~ s/$macro_name/$field/g; - } - print `./$command_tr`; - } - close (FILE); - - exit; -} - -############################################################################## -# Return the type of given module (data, network, snmp or plugin) -############################################################################## - -sub pandora_get_module_type($$) { - my ($dbh,$id_agent_module) = @_; - - my $id_modulo = get_db_value($dbh, 'SELECT id_modulo FROM tagente_modulo WHERE id_agente_modulo = ?',$id_agent_module); - - if($id_modulo == 1) { - return 'data'; - } - if($id_modulo == 2) { - my $id_module_type = get_db_value($dbh, 'SELECT id_tipo_modulo FROM tagente_modulo WHERE id_agente_modulo = ?',$id_agent_module); - if($id_module_type >= 15 && $id_module_type <= 18) { - return 'snmp'; - } - else { - return 'network'; - } - } - elsif($id_modulo == 4) { - return 'plugin'; - } - elsif($id_modulo == 6) { - return 'wmi'; - } - elsif($id_modulo == 7) { - return 'web'; - } - else { - return 'unknown'; - } -} - -############################################################################## -# Add a profile to a User in a Group -# Related option: --add_profile_to_user -############################################################################## - -sub cli_user_add_profile() { - my ($user_id,$profile_name,$group_name) = @ARGV[2..4]; - - my $user_exists = get_user_exists ($dbh, $user_id); - exist_check($user_exists,'user',$user_id); - - my $profile_id = get_profile_id($dbh, $profile_name); - exist_check($profile_id,'profile',$profile_name); - - my $group_id = 0; - - # If group name is not defined, we assign group All (0) - if(defined($group_name)) { - $group_id = get_group_id($dbh, $group_name); - exist_check($group_id,'group',$group_name); - } - else { - $group_name = 'All'; - } - - print_log "[INFO] Adding profile '$profile_name' to user '$user_id' in group '$group_name'\n\n"; - - pandora_add_profile_to_user ($dbh, $user_id, $profile_id, $group_id); -} - -############################################################################## -# Delete a user. -# Related option: --delete_user -############################################################################## - -sub cli_delete_user() { - my $user_name = @ARGV[2]; - - print_log "[INFO] Deleting user '$user_name' \n\n"; - - my $result = pandora_delete_user($dbh,$user_name); - exist_check($result,'user',$user_name); -} - -############################################################################## -# Delete an alert_template. -# Related option: --delete_user -############################################################################## - -sub cli_delete_alert_template() { - my $template_name = @ARGV[2]; - - print_log "[INFO] Deleting template '$template_name' \n\n"; - - my $result = pandora_delete_alert_template($dbh,$template_name); - exist_check($result,'alert template',$template_name); -} - -############################################################################## -# Add profile. -# Related option: --add_profile -############################################################################## - -sub cli_add_profile() { - my ($user_name,$profile_name,$group_name) = @ARGV[2..4]; - - my $id_profile = get_profile_id($dbh,$profile_name); - exist_check($id_profile,'profile',$profile_name); - - my $id_group; - - if($group_name eq "All") { - $id_group = 0; - print_log "[INFO] Adding profile '$profile_name' to all groups for user '$user_name') \n\n"; - } - else { - $id_group = get_group_id($dbh,$group_name); - exist_check($id_group,'group',$group_name); - print_log "[INFO] Adding profile '$profile_name' to group '$group_name' for user '$user_name') \n\n"; - } - - pandora_create_user_profile ($dbh, $user_name, $id_profile, $id_group); -} - -############################################################################## -# Create profile. -# Related option: --create_profile -############################################################################## - -sub cli_create_profile() { - my ($profile_name,$incident_view,$incident_edit,$incident_management,$agent_view, - $agent_edit,$agent_disable,$alert_edit,$alert_management,$user_management,$db_management, - $event_view,$event_edit,$event_management,$report_view,$report_edit,$report_management, - $map_view,$map_edit,$map_management,$vconsole_view,$vconsole_edit,$vconsole_management,$pandora_management) = @ARGV[2..25]; - - my $id_profile = get_profile_id($dbh,$profile_name); - non_exist_check($id_profile,'profile',$profile_name); - - pandora_create_profile ($dbh, $profile_name, $incident_view, $incident_edit, $incident_management, $agent_view, - $agent_edit, $agent_disable, $alert_edit, $alert_management, $user_management, $db_management, - $event_view, $event_edit, $event_management, $report_view, $report_edit, $report_management, - $map_view, $map_edit, $map_management, $vconsole_view, $vconsole_edit, $vconsole_management, $pandora_management); -} - -############################################################################## -# Delete profile. -# Related option: --delete_profile -############################################################################## - -sub cli_delete_profile() { - my ($user_name,$profile_name,$group_name) = @ARGV[2..4]; - - my $id_profile = get_profile_id($dbh,$profile_name); - exist_check($id_profile,'profile',$profile_name); - - my $id_group; - - if($group_name eq "All") { - $id_group = 0; - print_log "[INFO] Deleting profile '$profile_name' from all groups for user '$user_name') \n\n"; - } - else { - $id_group = get_group_id($dbh,$group_name); - exist_check($id_group,'group',$group_name); - print_log "[INFO] Deleting profile '$profile_name' from group '$group_name' for user '$user_name') \n\n"; - } - - pandora_delete_user_profile ($dbh, $user_name, $id_profile, $id_group); -} - -############################################################################## -# Create event -# Related option: --create_event -############################################################################## - -sub cli_create_event() { - my ($event,$event_type,$group_name,$agent_name,$module_name,$event_status,$severity,$template_name, $user_name, $comment, $source, $id_extra, $tags, $custom_data) = @ARGV[2..15]; - - $event_status = 0 unless defined($event_status); - $severity = 0 unless defined($severity); - - my $id_user; - - if (!defined($user_name)) { - $id_user = 0; - } - else { - $id_user = pandora_get_user_id($dbh,$user_name); - exist_check($id_user,'user',$user_name); - } - - my $id_group; - - if (! $group_name || $group_name eq "All") { - $id_group = 0; - } - else { - $id_group = get_group_id($dbh,$group_name); - exist_check($id_group,'group',$group_name); - } - - my $id_agent; - - if (! $agent_name) { - $id_agent = 0; - } - else { - $id_agent = get_agent_id($dbh,$agent_name); - exist_check($id_agent,'agent',$agent_name); - } - - my $id_agentmodule; - - if (! $module_name) { - $id_agentmodule = 0; - } - else { - $id_agentmodule = get_agent_module_id($dbh,$module_name,$id_agent); - exist_check($id_agentmodule,'module',$module_name); - } - - my $id_alert_agent_module; - - if(defined($template_name) && $template_name ne '') { - my $id_template = get_template_id($dbh,$template_name); - exist_check($id_template,'template',$template_name); - $id_alert_agent_module = get_template_module_id($dbh,$id_agentmodule,$id_template); - exist_check($id_alert_agent_module,'alert template module',$template_name); - } - else { - $id_alert_agent_module = 0; - } - - if (defined($comment) && $comment ne '') { - $comment = '<b>-- Added comment by '.$user_name. ' ['. localtime(time).'] --</b><br>'.$comment.'<br>'; - } - print_log "[INFO] Adding event '$event' for agent '$agent_name' \n\n"; - - # Base64 encode custom data - $custom_data = encode_base64 ($custom_data); - - pandora_event ($conf, $event, $id_group, $id_agent, $severity, - $id_alert_agent_module, $id_agentmodule, $event_type, $event_status, $dbh, $source, $user_name, $comment, $id_extra, $tags, '', '', '', $custom_data); -} - -############################################################################## -# Validate event. -# Related option: --validate_event -############################################################################## - -sub cli_validate_event() { - my ($agent_name, $module_name, $datetime_min, $datetime_max, $user_name, $criticity, $template_name) = @ARGV[2..8]; - my $id_agent = ''; - my $id_agentmodule = ''; - - if(defined($agent_name) && $agent_name ne '') { - $id_agent = get_agent_id($dbh,$agent_name); - exist_check($id_agent,'agent',$agent_name); - - if($module_name ne '') { - $id_agentmodule = get_agent_module_id($dbh, $module_name, $id_agent); - exist_check($id_agentmodule,'module',$module_name); - } - } - - if(defined($datetime_min) && $datetime_min ne '') { - if ($datetime_min !~ /([0-9]{2,4})\-([0-1][0-9])\-([0-3][0-9]) +([0-2][0-9]):([0-5][0-9])/) { - print_log "[ERROR] Invalid datetime_min format. (Correct format: YYYY-MM-DD HH:mm)\n"; - exit; - } - # Add the seconds - $datetime_min .= ":00"; - } - - if(defined($datetime_max) && $datetime_max ne '') { - if ($datetime_max !~ /([0-9]{2,4})\-([0-1][0-9])\-([0-3][0-9]) +([0-2][0-9]):([0-5][0-9])/) { - print_log "[ERROR] Invalid datetime_max $datetime_max. (Correct format: YYYY-MM-DD HH:mm)\n"; - exit; - } - # Add the seconds - $datetime_max .= ":00"; - } - - my $id_alert_agent_module = ''; - - if(defined($template_name) && $template_name ne '') { - my $id_template = get_template_id($dbh,$template_name); - exist_check($id_template,'template',$template_name); - $id_alert_agent_module = get_template_module_id($dbh,$id_agentmodule,$id_template); - exist_check($id_alert_agent_module,'template module',$template_name); - } - - pandora_validate_event_filter ($conf, $id_agentmodule, $id_agent, $datetime_min, $datetime_max, $user_name, $id_alert_agent_module, $criticity, $dbh); - print_log "[INFO] Validating event for agent '$agent_name'\n\n"; -} - -############################################################################## -# Validate event. -# Related option: --validate_event_id -############################################################################## - -sub cli_validate_event_id() { - my $id_event = @ARGV[2]; - - my $event_name = pandora_get_event_name($dbh, $id_event); - exist_check($event_name,'event',$id_event); - - print_log "[INFO] Validating event '$id_event'\n\n"; - - my $result = pandora_validate_event_id ($conf, $id_event, $dbh); - exist_check($result,'event',$id_event); - -} - -############################################################################### -# Get event info -# Related option: --get_event_info -############################################################################### -sub cli_get_event_info () { - my ($id_event,$csv_separator) = @ARGV[2..3]; - - my $event_name = pandora_get_event_name($dbh, $id_event); - exist_check($event_name,'event',$id_event); - - $csv_separator = '|' unless defined($csv_separator); - - my $query = "SELECT * FROM tevento where id_evento=".$id_event; - - my $header = "Event ID".$csv_separator."Event name".$csv_separator."Agent ID".$csv_separator."User ID".$csv_separator. - "Group ID".$csv_separator."Status".$csv_separator."Timestamp".$csv_separator."Event type".$csv_separator. - "Agent module ID".$csv_separator."Alert module ID".$csv_separator."Criticity".$csv_separator. - "Comment".$csv_separator."Tags".$csv_separator."Source".$csv_separator."Extra ID"."\n"; - print $header; - - my @result = get_db_single_row($dbh, $query); - foreach my $event_data (@result) { - print $event_data->{'id_evento'}; - print $csv_separator; - print $event_data->{'evento'}; - print $csv_separator; - print $event_data->{'id_agente'}; - print $csv_separator; - print $event_data->{'id_usuario'}; - print $csv_separator; - print $event_data->{'id_grupo'}; - print $csv_separator; - print $event_data->{'estado'}; - print $csv_separator; - print $event_data->{'timestamp'}; - print $csv_separator; - print $event_data->{'event_type'}; - print $csv_separator; - print $event_data->{'id_agentmodule'}; - print $csv_separator; - print $event_data->{'id_alert_am'}; - print $csv_separator; - print $event_data->{'criticity'}; - print $csv_separator; - print $event_data->{'user_comment'}; - print $csv_separator; - print $event_data->{'tags'}; - print $csv_separator; - print $event_data->{'source'}; - print $csv_separator; - print $event_data->{'id_extra'}; - print "\n"; - } - - exit; -} - -############################################################################### -# Add event comment -# Related option: --add_event_comment -############################################################################### -sub cli_add_event_comment() { - my ($id_event, $user_name, $comment) = @ARGV[2..4]; - - my $id_user; - if (!defined($user_name) || $user_name eq '') { - $id_user = 'admin'; - } - else { - $id_user = pandora_get_user_id($dbh,$user_name); - exist_check($id_user,'user',$user_name); - } - - my $event_name = pandora_get_event_name($dbh, $id_event); - exist_check($event_name,'event',$id_event); - - my $current_comment = encode_utf8(pandora_get_event_comment($dbh, $id_event)); - my $utimestamp = time (); - my @additional_comment = ({ comment => $comment, action => "Added comment", id_user => $id_user, utimestamp => $utimestamp}); - - print_log "[INFO] Adding event comment for event '$id_event'. \n\n"; - - my $decoded_comment; - my $update; - if ($current_comment eq '') { - $update->{'user_comment'} = encode_json \@additional_comment; - } - else { - $decoded_comment = decode_json($current_comment); - - push(@{$decoded_comment}, @additional_comment); - - $update->{'user_comment'} = encode_json($decoded_comment); - } - - pandora_update_event_from_hash ($update, 'id_evento', $id_event, $dbh); -} - -############################################################################## -# Create incident. -# Related option: --create_incident -############################################################################## - -sub cli_create_incident() { - my ($title, $description, $origin, $status, $priority, $group_name, $owner) = @ARGV[2..8]; - - my $id_group = get_group_id($dbh,$group_name); - exist_check($id_group,'group',$group_name); - - pandora_create_incident ($conf, $dbh, $title, $description, $priority, $status, $origin, $id_group, $owner); - print_log "[INFO] Creating incident '$title'\n\n"; -} - -############################################################################## -# Delete data. -# Related option: --delete_data -############################################################################## - -sub cli_delete_data($) { - my $ltotal = shift; - my ($opt, $name, $name2) = @ARGV[2..4]; - - if($opt eq '-m' || $opt eq '--m') { - # Delete module data - param_check($ltotal, 3) unless ($name2 ne ''); - my $id_agent = get_agent_id($dbh,$name2); - exist_check($id_agent,'agent',$name2); - - my $id_module = get_agent_module_id($dbh,$name,$id_agent); - exist_check($id_module,'module',$name); - - print_log "DELETING THE DATA OF THE MODULE $name OF THE AGENT $name2\n\n"; - - pandora_delete_data($dbh, 'module', $id_module); - } - elsif($opt eq '-a' || $opt eq '--a') { - # Delete agent's modules data - my $id_agent = get_agent_id($dbh,$name); - exist_check($id_agent,'agent',$name); - - print_log "DELETING THE DATA OF THE AGENT $name\n\n"; - - pandora_delete_data($dbh, 'module', $id_agent); - } - elsif($opt eq '-g' || $opt eq '--g') { - # Delete group's modules data - my $id_group = get_group_id($dbh,$name); - exist_check($id_group,'group',$name); - - print_log "DELETING THE DATA OF THE GROUP $name\n\n"; - - pandora_delete_data($dbh, 'group', $id_group); - } - else { - print_log "[ERROR] Invalid parameter '$opt'.\n\n"; - help_screen (); - exit; - } -} - -############################################################################## -# Add policy to apply queue. -# Related option: --apply_policy -############################################################################## - -sub cli_apply_policy() { - my $policy_name = @ARGV[2]; - - my $policy_id = enterprise_hook('get_policy_id',[$dbh, safe_input($policy_name)]); - exist_check($policy_id,'policy',$policy_name); - - my $ret = enterprise_hook('pandora_add_policy_queue', [$dbh, $conf, $policy_id, 'apply']); - - if($ret == -1) { - print_log "[ERROR] Operation 'apply' cannot be added to policy '$policy_name' because is duplicated in queue or incompatible with others operations\n\n"; - exit; - } - - print_log "[INFO] Added operation 'apply' to policy '$policy_name'\n\n"; -} - -############################################################################## -# Add all policies to apply queue. -# Related option: --apply_all_policies -############################################################################## - -sub cli_apply_all_policies() { - my $policies = enterprise_hook('get_policies', [$dbh, 0]); - - my $npolicies = scalar(@{$policies}); - - print_log "[INFO] $npolicies policies found\n\n"; - - my $added = 0; - foreach my $policy (@{$policies}) { - my $ret = enterprise_hook('pandora_add_policy_queue', [$dbh, $conf, $policy->{'id'}, 'apply']); - if($ret != -1) { - $added++; - print_log "[INFO] Added operation 'apply' to policy '".safe_output($policy->{'name'})."'\n"; - } - } - - if($npolicies > $added) { - my $failed = $npolicies - $added; - print_log "[ERROR] $failed policies cannot be added to apply queue. Maybe the queue already contains these operations.\n"; - } -} - -############################################################################## -# Recreate the files of a collection. -# Related option: --recreate_collection -############################################################################## - -sub cli_recreate_collection () { - my $collection_id = @ARGV[2]; - - my $result = enterprise_hook('pandora_recreate_collection', [$conf, $collection_id, $dbh]); - - if ($result == 1) { - print_log "[INFO] Collection recreated successfully.\n"; - } - elsif ($result == 0) { - print_log "[ERROR] Collection not recreated.\n"; - } -} - -############################################################################## -# Validate all the alerts -# Related option: --validate_all_alerts -############################################################################## - -sub cli_validate_all_alerts() { - print_log "[INFO] Validating all the alerts\n\n"; - - my $res = db_update ($dbh, "UPDATE talert_template_modules SET times_fired = 0, internal_counter = 0"); - - if($res == -1) { - print_log "[ERROR] Alerts cannot be validated\n\n"; - } - else { - # Update fired alerts count in agents - db_update ($dbh, "UPDATE tagente SET fired_count = 0"); - } -} - -############################################################################## -# Validate the alerts of a given policy -# Related option: --validate_policy_alerts -############################################################################## - -sub cli_validate_policy_alerts() { - my $policy_name = @ARGV[2]; - - my $policy_id = enterprise_hook('get_policy_id',[$dbh, safe_input($policy_name)]); - exist_check($policy_id,'policy',$policy_name); - - my $policy_alerts = enterprise_hook('get_policy_alerts',[$dbh, $policy_id]); - - my @policy_alerts_id_array; - my $policy_alerts_id = ''; - - my $cont = 0; - foreach my $alert (@{$policy_alerts}) { - $policy_alerts_id_array[$cont] = $alert->{'id'}; - $cont++; - } - - if($#policy_alerts_id_array == -1) { - print_log "[INFO] No alerts found in the policy '$policy_name'\n\n"; - return; - } - - $policy_alerts_id = join(',',@policy_alerts_id_array); - - #Get the fired alerts that match with the filter to update counts after validate it - my @fired_alerts = get_db_rows ($dbh, "SELECT id_agent_module, count(id) alerts FROM talert_template_modules WHERE id_policy_alerts IN (?) AND times_fired > 0 GROUP BY id_agent_module", $policy_alerts_id); - - print_log "[INFO] Validating the alerts of the policy '$policy_name'\n\n"; - - my $res = db_update ($dbh, "UPDATE talert_template_modules SET times_fired = 0, internal_counter = 0 WHERE id_policy_alerts IN (?)", $policy_alerts_id); - - if($res == -1) { - print_log "[ERROR] Alerts cannot be validated\n\n"; - } - else { - # Update fired alerts count in agents if necessary - if($#fired_alerts > -1) { - foreach my $fired_alert (@fired_alerts) { - my $id_agent = get_module_agent_id($dbh, $fired_alert->{'id_agent_module'}); - db_update ($dbh, 'UPDATE tagente SET fired_count=fired_count-? WHERE id_agente=?', $fired_alert->{'alerts'}, $id_agent); - } - } - } -} - - -############################################################################## -# Show the module id where is a given agent -# Related option: --get_module_id -# perl pandora_manage.pl /etc/pandora/pandora_server.conf --get_module_id 4 'host alive' -############################################################################## - -sub cli_get_module_id() { - (my $agent_id,my $module_name) = @ARGV[2..3]; - - exist_check($agent_id,'agent',$agent_id); - - my $module_id = get_agent_module_id($dbh, $module_name, $agent_id); - exist_check($module_id, 'module name', $module_name); - - print $module_id; - -} - - -############################################################################## -# Show the group name where is a given agent -# Related option: --get_agent_group -############################################################################## - -sub cli_get_agent_group() { - my $agent_name = @ARGV[2]; - - if (is_metaconsole($conf) == 1) { - - my $agents_groups = enterprise_hook('get_metaconsole_agent',[$dbh, $agent_name]); - - if (scalar(@{$agents_groups}) != 0) { - foreach my $agent (@{$agents_groups}) { - my @test = $agent; - print Dumper $test[0]; - my $group_name = get_group_name ($dbh, $agent->{'id_grupo'}); - print "Server: $agent->{'server_name'} Agent: $agent->{'nombre'} Name Group: $group_name \n\n"; - } - } - else { - my $servers = enterprise_hook('get_metaconsole_setup_servers',[$dbh]); - my @servers_id = split(',',$servers); - my @list_servers; - my $list_names_servers; - foreach my $server (@servers_id) { - my $dbh_metaconsole = enterprise_hook('get_node_dbh',[$conf, $server, $dbh]); - - my $id_agent = get_agent_id($dbh_metaconsole,$agent_name); - - if ($id_agent == -1) { - next; - } - else { - my $id_group = get_agent_group ($dbh_metaconsole, $id_agent); - my $group_name = get_group_name ($dbh_metaconsole, $id_group); - my $metaconsole_name = enterprise_hook('get_metaconsole_setup_server_name',[$dbh, $server]); - $agent_name = safe_output($agent_name); - print "[INFO] Server: $metaconsole_name Agent: $agent_name Name Group: $group_name\n\n"; - } - } - } - } - else { - my $id_agent = get_agent_id($dbh,$agent_name); - exist_check($id_agent,'agent',$agent_name); - - my $id_group = get_agent_group ($dbh, $id_agent); - - my $group_name = get_group_name ($dbh, $id_group); - print $group_name; - } -} - -############################################################################## -# Show the group id where is a given agent -# Related option: --get_agent_group_id -############################################################################## -sub cli_get_agent_group_id() { - my $agent_name = @ARGV[2]; - - if (is_metaconsole($conf) == 1) { - my $agents_groups = enterprise_hook('get_metaconsole_agent',[$dbh, $agent_name]); - - if (scalar(@{$agents_groups}) != 0) { - - foreach my $agent (@{$agents_groups}) { - print "Server: $agent->{'server_name'} Agent: $agent->{'nombre'} ID Group: $agent->{'id_grupo'}\n\n"; - } - } - else { - my $servers = enterprise_hook('get_metaconsole_setup_servers',[$dbh]); - my @servers_id = split(',',$servers); - my @list_servers; - my $list_names_servers; - foreach my $server (@servers_id) { - my $dbh_metaconsole = enterprise_hook('get_node_dbh',[$conf, $server, $dbh]); - - my $metaconsole_name = enterprise_hook('get_metaconsole_setup_server_name',[$dbh, $server]); - my $id_agent = get_agent_id($dbh_metaconsole,$agent_name); - - if ($id_agent == -1) { - next; - } - else { - my $id_group = get_agent_group ($dbh_metaconsole, $id_agent); - $agent_name = safe_output($agent_name); - print "Server: $metaconsole_name Agent: $agent_name ID Group: $id_group\n\n"; - } - } - } - } - else { - my $id_agent = get_agent_id($dbh,$agent_name); - exist_check($id_agent,'agent',$agent_name); - - my $id_group = get_agent_group ($dbh, $id_agent); - - print $id_group; - } -} - -############################################################################## -# Show the agent and current data of all the modules with the same name -# Related option: --get_agents_module_current_data -############################################################################## - -sub cli_get_agents_module_current_data() { - my $module_name = @ARGV[2]; - - my $agents = pandora_get_module_agents($dbh, $module_name); - exist_check(scalar(@{$agents})-1,'data of module',$module_name); - - print "id_agent,agent_name,module_data\n"; - foreach my $agent (@{$agents}) { - my $current_data = pandora_get_module_current_data($dbh, $agent->{'id_agente_modulo'}); - print $agent->{'id_agente'}.",".$agent->{'nombre'}.",$current_data\n"; - } -} - -############################################################################## -# Show all the modules of an agent -# Related option: --get_agent_modules -############################################################################## - -sub cli_get_agent_modules() { - my $agent_name = @ARGV[2]; - - my $id_agent = get_agent_id($dbh,$agent_name); - exist_check($id_agent,'agent',$agent_name); - - my $modules = pandora_get_agent_modules ($dbh, $id_agent); - - if(scalar(@{$modules}) == 0) { - print_log "[INFO] The agent '$agent_name' have not modules\n\n"; - } - - print "id_module, module_name\n"; - foreach my $module (@{$modules}) { - print $module->{'id_agente_modulo'}.",".safe_output($module->{'nombre'})."\n"; - } -} - -sub cli_create_synthetic() { - my $name_module = @ARGV[2]; - my $synthetic_type = @ARGV[3]; - - my $agent_name = @ARGV[4]; - my @module_data = @ARGV[5..$#ARGV]; - my $module; - my (@filterdata,@data_module); - - if ($synthetic_type ne 'arithmetic' && $synthetic_type ne 'average') { - print("[ERROR] Type of syntethic module doesn't exists \n\n"); - exit 1; - } - if (scalar(@{module_data}) == 0) { - print("[ERROR] No modules data \n\n"); - exit 1; - } - if ($name_module eq '') { - print("[ERROR] No module name \n\n"); - exit 1; - } - - $module->{'custom_integer_1'} = 0; - $module->{'custom_integer_2'} = 0; - $module->{'prediction_module'} = 3; # Synthetic code is 3 - $module->{'flag'} = 1; - - my $id_agent = int(get_agent_id($dbh,$agent_name)); - - if ($id_agent > 0) { - foreach my $i (0 .. $#module_data) { - my @split_data = split(',',$module_data[$i]); - if (@split_data[0] =~ m/(x|\/|\+|\*|\-)/ && length(@split_data[0]) == 1 ) { - if ( @split_data[0] =~ m/(\/|\+|\*|\-)/ && $synthetic_type eq 'average' ) { - print("[ERROR] With this type: $synthetic_type only be allow use this operator: 'x' \n\n"); - exit 1; - } - if (is_numeric(@split_data[1]) == 0) { - next; - } - @data_module = ("",@split_data[0],@split_data[1]); - my $text_data = join(',',@data_module); - push (@filterdata,$text_data); - } - else { - if (scalar(@split_data) == 2) { - @data_module = (safe_output(@split_data[0]),'',safe_output(@split_data[1])); - my $text_data = join(',',@data_module); - push (@filterdata,$text_data); - } - else { - if (length(@split_data[1]) > 1 ) { - print("[ERROR] You can only use +, -, *, / or x, and you use this: @split_data[1] \n\n"); - exit 1; - } - if ( @split_data[1] =~ m/(\/|\+|\*|\-)/ && $synthetic_type eq 'average' ) { - print("[ERROR] With this type: $synthetic_type only be allow use this operator: 'x' \n\n"); - exit 1; - } - if ( $synthetic_type eq 'arithmetic' && $i == 0) { - @data_module = (safe_output(@split_data[0]),'',safe_output(@split_data[2])); - } - else { - @data_module = (safe_output(@split_data[0]),@split_data[1],safe_output(@split_data[2])); - } - - my $text_data = join(',',@data_module); - push (@filterdata,$text_data); - } - } - } - - my $module_exists = get_agent_module_id($dbh, $name_module, $id_agent); - non_exist_check($module_exists, 'module name', $name_module); - - $module->{'id_agente'} = $id_agent; - $module->{'nombre'} = safe_input($name_module); - my $id_tipo_modulo = get_db_value ($dbh, "SELECT id_tipo FROM ttipo_modulo WHERE nombre = ?", "generic_data"); - $module->{'id_modulo'} = 5; - $module->{'id_tipo_modulo'} = $id_tipo_modulo; - - my $id_module = db_process_insert($dbh, 'id_agente_modulo', 'tagente_modulo', $module); - - if ($id_module) { - my $result = enterprise_hook('create_synthetic_operations', - [$dbh,int($id_module), @filterdata]); - if ($result) { - db_do ($dbh, 'INSERT INTO tagente_estado (id_agente_modulo, id_agente, estado, - known_status, last_status, last_known_status, last_try, datos) - VALUES (?, ?, ?, ?, ?, ?, \'1970-01-01 00:00:00\', \'\')', $id_module, $id_agent, 4, 4, 4, 4); - # Update the module status count. When the module is created disabled dont do it - pandora_mark_agent_for_module_update ($dbh, $id_agent); - print("[OK] The modules are creating ID: $id_module \n\n"); - } - else { - db_do ($dbh, 'DELETE FROM tagente_modulo WHERE id_agente_modulo = ?', $id_module); - print("[ERROR] Problems with creating data module. \n\n"); - } - } - else { - db_do ($dbh, 'DELETE FROM tagente_modulo WHERE nombre = ? AND id_agente = ?', $name_module, $id_agent); - print("[INFO] Problems with creating module \n\n"); - } - } - else { - print( "[INFO] The agent '$agent_name' doesn't exists\n\n"); - } -} - - -######################################################################## -# Show all the modules of a policy -# Related option: --get_policy_modules -######################################################################## - -sub cli_get_policy_modules() { - my $policy_name = @ARGV[2]; - - my $policy_id = enterprise_hook('get_policy_id', - [$dbh, safe_input($policy_name)]); - exist_check($policy_id, 'policy', $policy_name); - - my $policy_modules = enterprise_hook( - 'get_policy_modules', [$dbh, $policy_id]); - - if (defined($policy_modules)) { - exist_check(scalar(@{$policy_modules}) - 1, 'modules in policy', - $policy_name); - } - - print "id_policy_module, module_name\n"; - foreach my $module (@{$policy_modules}) { - print $module->{'id'} . "," . safe_output($module->{'name'}) . "\n"; - } -} - -######################################################################## -# Show all the policies (without parameters) or the policies of given -# agent. -# Related option: --get_policies -######################################################################## - -sub cli_get_policies() { - my $agent_name = @ARGV[2]; - my $policies; - - if (defined($agent_name)) { - my $id_agent = get_agent_id($dbh,$agent_name); - exist_check($id_agent,'agent',$agent_name); - - $policies = enterprise_hook('get_agent_policies', [$dbh,$id_agent]); - - if (scalar(@{$policies}) == 0) { - print_log "[INFO] No policies found on agent '$agent_name'\n\n"; - exit; - } - } - else { - $policies = enterprise_hook('get_policies', [$dbh]); - if (scalar(@{$policies}) == 0) { - print_log "[INFO] No policies found\n\n"; - exit; - } - } - - print "id_policy, policy_name\n"; - foreach my $module (@{$policies}) { - print $module->{'id'}.",".safe_output($module->{'name'})."\n"; - } -} - -############################################################################## -# Show all the agents (without parameters) or the agents with a filter parameters -# Related option: --get_agents -############################################################################## - -sub cli_get_agents() { - my ($group_name, $os_name, $status, $max_modules, $filter_substring, $policy_name) = @ARGV[2..7]; - - my $condition = ' disabled=0'; - - my $id_group; - my $id_os; - my $policy_id; - - if($group_name ne '') { - $id_group = get_group_id($dbh, $group_name); - exist_check($id_group,'group',$group_name); - - $condition .= " AND id_grupo = $id_group "; - } - - if($os_name ne '') { - $id_os = get_os_id($dbh, $os_name); - exist_check($id_os,'operative system',$os_name); - - $condition .= " AND id_os = $id_os "; - } - - if($policy_name ne '') { - $policy_id = enterprise_hook('get_policy_id',[$dbh, safe_input($policy_name)]); - exist_check($policy_id,'policy',$policy_name); - - $condition .= " AND id_agente IN (SELECT id_agent FROM tpolicy_agents - WHERE id_policy = $policy_id )"; - } - - if($max_modules ne '') { - $condition .= " AND id_agente NOT IN (SELECT id_agente FROM tagente_modulo t1 - WHERE (SELECT count(*) FROM tagente_modulo WHERE id_agente = t1.id_agente) > $max_modules)"; - } - - if($filter_substring ne '') { - $condition .= " AND nombre LIKE '%".safe_input($filter_substring)."%'"; - } - - my @agents = get_db_rows ($dbh, "SELECT * FROM tagente WHERE $condition"); - - if(scalar(@agents) == 0) { - print_log "[INFO] No agents found\n\n"; - exit; - } - - my $agent_status; - - my $head_print = 0; - foreach my $agent (@agents) { - if($status ne '') { - $agent_status = pandora_get_agent_status($dbh,$agent->{'id_agente'}); - if($status ne $agent_status || $agent_status eq '') { - next; - } - } - if($head_print == 0) { - $head_print = 1; - print "id_agent, agent_name\n"; - } - print $agent->{'id_agente'}.",".safe_output($agent->{'nombre'})."\n"; - } - - if($head_print == 0) { - print_log "[INFO] No agents found\n\n"; - } -} - -############################################################################## -# Delete agent conf. -# Related option: --delete_conf_file -############################################################################## - -sub cli_delete_conf_file() { - my $agent_name = @ARGV[2]; - - my $conf_deleted = 0; - my $md5_deleted = 0; - - if (-e $conf->{incomingdir}.'/conf/'.md5($agent_name).'.conf') { - unlink($conf->{incomingdir}.'/conf/'.md5($agent_name).'.conf'); - $conf_deleted = 1; - } - if (-e $conf->{incomingdir}.'/md5/'.md5($agent_name).'.md5') { - unlink($conf->{incomingdir}.'/md5/'.md5($agent_name).'.md5'); - $md5_deleted = 1; - } - - if($conf_deleted == 1 || $md5_deleted == 1) { - print_log "[INFO] Local conf files of the agent '$agent_name' has been deleted succesfully\n\n"; - } - else { - print_log "[ERROR] Local conf file of the agent '$agent_name' didn't found\n\n"; - exit; - } -} - -############################################################################## -# Delete modules from all conf files (without parameters) or of the conf file of the given agent. -# Related option: --clean_conf_file -############################################################################## - -sub cli_clean_conf_file() { - my $agent_name = @ARGV[2]; - my $result; - - if(defined($agent_name)) { - if (-e $conf->{incomingdir}.'/conf/'.md5($agent_name).'.conf') { - $result = enterprise_hook('pandora_clean_conf_file',[$conf, md5($agent_name)]); - if($result != -1) { - print_log "[INFO] Conf file '".$conf->{incomingdir}.'/conf/'.md5($agent_name).".conf has been cleaned'\n\n"; - } - } - } - else { - my $list_command = 'ls '.$conf->{incomingdir}.'/conf/'; - my $out = `$list_command`; - my @files = split('\n',$out); - # TODO: FINISH OPTION! NOW ONLY SHOW FILES - foreach my $file (@files) { - # Get the md5 hash - my @filesplit = split('.',$file); - $result = enterprise_hook('pandora_clean_conf_file',[$conf,$filesplit[0]]); - if($result != -1) { - print_log "[INFO] Conf file '".$conf->{incomingdir}.'/conf/'.$filesplit[0].".conf has been cleaned'\n\n"; - } - } - } -} - -############################################################################## -# Get the files bad configured (without essential tokens) -# Related option: --get_bad_conf_files -############################################################################## - -sub cli_get_bad_conf_files() { - my $list_command = 'ls '.$conf->{incomingdir}.'/conf/'; - my $out = `$list_command`; - my @files = split('\n',$out); - my $bad_files = 0; - - foreach my $file (@files) { - # Check important tokens - my $missings = 0; - my @tokens = ("server_ip","server_path","temporal","log_file"); - - if ($file !~ /.srv./) { - foreach my $token (@tokens) { - if(enterprise_hook('pandora_check_conf_token',[$conf->{incomingdir}.'/conf/'.$file, $token]) == 0) { - $missings++; - } - } - - # If any token of checked is missed we print the file path - if($missings > 0) { - print $conf->{incomingdir}.'/conf/'.$file."\n"; - $bad_files++; - } - } - } - - if($bad_files == 0) { - print_log "[INFO] No bad files found\n\n"; - } -} - -############################################################################## -# Disable policy alerts. -# Related option: --disable_policy_alerts -############################################################################## - -sub cli_disable_policy_alerts() { - my $policy_name = @ARGV[2]; - - my $policy_id = enterprise_hook('get_policy_id',[$dbh, safe_input($policy_name)]); - exist_check($policy_id,'policy',$policy_name); - - # Flag as disabled the policy alerts - my $array_pointer_ag = enterprise_hook('pandora_disable_policy_alerts',[$dbh, $policy_id]); -} - -############################################################################## -# Add an agent to a policy -# Related option: --add_agent_to_policy -############################################################################## - -sub cli_policy_add_agent() { - my ($agent_name, $policy_name) = @ARGV[2..3]; - - my $agent_id = get_agent_id($dbh,$agent_name); - exist_check($agent_id,'agent',$agent_name); - - my $policy_id = enterprise_hook('get_policy_id',[$dbh, safe_input($policy_name)]); - exist_check($policy_id,'policy',$policy_name); - - # Add the agent to policy - my $policy_agent_id = enterprise_hook('pandora_policy_add_agent',[$policy_id, $agent_id, $dbh]); - - if($policy_agent_id == -1) { - print_log "[ERROR] A problem has been ocurred adding agent '$agent_name' to policy '$policy_name'\n\n"; - } - else { - print_log "[INFO] Added agent '$agent_name' to policy '$policy_name'. Is necessary to apply the policy in order to changes take effect.\n\n"; - } -} - -sub cli_create_planned_downtime() { - my $name = @ARGV[2]; - my @todo = @ARGV[3..20]; - my $other = join('|', @todo); - - my $result = api_call(\%conf,'set', 'planned_downtimes_created', $name, undef, "$other"); - print "$result \n\n "; -} - -sub cli_add_item_planned_downtime() { - my $id = @ARGV[2]; - my $agent = @ARGV[3]; - my $moduls = @ARGV[4]; - my @agents = split /,/, $agent; - my @modules = split /,/, $moduls; - my $other_agents = join(';', @agents); - my $other_modules = join(';', @modules); - my $other = $other_agents . "|" . $other_modules; - - my $result = api_call(\%conf,'set', 'planned_downtimes_additem', $id, undef, "$other"); - print_log "$result \n\n"; -} - -sub cli_set_delete_planned_downtime() { - my $name_downtime = @ARGV[2]; - my $id_downtime = pandora_get_planned_downtime_id($dbh,$name_downtime); - - my $result = pandora_delete_planned_downtime ($dbh,$id_downtime); - - print_log "$result \n\n"; -} - -sub cli_get_all_planned_downtime() { - my $name_downtime = @ARGV[2]; - my ($id_group, $type_downtime, $type_execution, $type_periodicity) = @ARGV[3..6]; - - my @results = pandora_get_all_planned_downtime($dbh, $name_downtime, $id_group, $type_downtime, $type_execution, $type_periodicity); - - if (!defined($results[0])) { - print_log "[ERROR] No data found with this parameters. Please check and launch again\n\n"; - } - else { - foreach my $result (@results) { - print("\nID: " . $result->{'id'} . ", NAME: " . $result->{'name'} . ", DESC: " . safe_output($result->{'description'}) . ", DATE FROM: " . - localtime($result->{'date_from'}) . " DATE TO: " . localtime($result->{'date_to'}) . - " \nID GROUP: " . $result->{'id_group'} . ", MONDAY: " . $result->{'monday'} . ", TUESDAY: " . $result->{'tuesday'} . - ", WEDNESDAY: " . $result->{'wednesday'} . ", THURSDAY: " . $result->{'thursday'} . ", FRIDAY: " . $result->{'friday'} . - ", SATURDAY: " . $result->{'saturday'} .", SUNDAY: " . $result->{'sunday'} .", PEDIODICALLY TIME FROM: " . $result->{'periodically_time_from'} . - " \nPEDIODICALLY TIME TO: " . $result->{'periodically_time_to'} . ", PEDIODICALLY DAY FROM: " . $result->{'periodically_day_from'} . - "PEDIODICALLY DAY TO: " . $result->{'periodically_day_to'} . ", TYPE DOWNTIME: " . $result->{'type_downtime'} . - ", TYPE OF EXECUTION: " . $result->{'type_execution'} . "\nTYPE OF PERIODICITY: " . $result->{'type_periodicity'} . - ", USER: " . $result->{'id_user'} ."\n\n"); - } - } -} - -sub cli_get_planned_downtimes_items() { - my $name_downtime = @ARGV[2]; - my ($id_group, $type_downtime, $type_execution, $type_periodicity) = @ARGV[3..6]; - my $text; - my @results = pandora_get_all_planned_downtime($dbh, $name_downtime, $id_group, $type_downtime, $type_execution, $type_periodicity); - - if (!defined($results[0])) { - print_log "[ERROR] No data found with this parameters. Please check and launch again\n\n"; - } - else { - my @items; - foreach my $result (@results) { - print(" ITEMS OF $result->{'name'} \n "); - @items = pandora_get_planned_downtimes_items($dbh,$result); - foreach my $item (@items) { - if ( $item->{'modules'} != '' ){ - $text = " This Agent have this MODULES ID: " . $item->{"modules"}; - }else{ - $text = " All modules quiet of this agent"; - } - print("AGENT ID: " . $item->{"id_agent"} . $text ."\n "); - } - } - } -} - - -############################################################################## -# Create group -# Related option: --create_group -############################################################################## - -sub cli_create_group() { - my ($group_name,$parent_group_name,$icon,$description) = @ARGV[2..5]; - - my $group_id = get_group_id($dbh,$group_name); - non_exist_check($group_id, 'group name', $group_name); - - my $parent_group_id = 0; - - if(defined($parent_group_name) && $parent_group_name ne 'All') { - $parent_group_id = get_group_id($dbh,$parent_group_name); - exist_check($parent_group_id, 'group name', $parent_group_name); - } - - $icon = '' unless defined($icon); - $description = '' unless defined($description); - - $group_id = pandora_create_group ($group_name, $icon, $parent_group_id, 0, 0, '', 0, $description, $dbh); - - if($group_id == -1) { - print_log "[ERROR] A problem has been ocurred creating group '$group_name'\n\n"; - } - else { - if (is_metaconsole($conf) == 1) { - my $servers = enterprise_hook('get_metaconsole_setup_servers',[$dbh]); - my @servers_id = split(',',$servers); - my $count_error = 0; - my $count_success = 0; - foreach my $server (@servers_id) { - my $dbh_metaconsole = enterprise_hook('get_node_dbh',[$conf, $server, $dbh]); - my $group_id_nodo; - - my $group_id = get_group_id($dbh_metaconsole,$group_name); - - if ($group_id != -1) { - $count_error++; - next; - } - - eval { - $group_id_nodo = db_insert ($dbh_metaconsole, 'id_grupo', 'INSERT INTO tgrupo (id_grupo, nombre, icon, parent, propagate, disabled, - custom_id, id_skin, description) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)', $group_name, safe_input($group_name), $icon, - $parent_group_id, 0, 0, '', 0, $description); - }; - if ($@) { - print_log "[ERROR] Problems with IDS and doesnt created group\n\n"; - $count_error++; - next; - } - - if ($group_id_nodo == -1) { - $count_error++; - } - else { - $count_success++; - } - } - - print_log "[INFO] Created group success: $count_success error: $count_error\n\n"; - } - else { - print_log "[INFO] Created group '$group_name'\n\n"; - } - } -} - - -############################################################################## -# Delete group -# Related option: --delete_group -############################################################################## - -sub cli_delete_group() { - my ($group_name) = @ARGV[2]; - - my $group_id = get_group_id($dbh,$group_name); - exist_check($group_id, 'group name', $group_name); - - $group_id = db_do ($dbh, 'DELETE FROM tgrupo WHERE nombre=?', $group_name); - - if($group_id == -1) { - print_log "[ERROR] A problem has been ocurred deleting group '$group_name'\n\n"; - }else{ - print_log "[INFO] Deleted group '$group_name'\n\n"; - } - - -} - - -############################################################################## -# Update group -# Related option: --update_group -############################################################################## - -sub cli_update_group() { - my ($group_id,$group_name,$parent_group_name,$icon,$description) = @ARGV[2..6]; - my $result; - $result = db_do ($dbh, 'SELECT * FROM tgrupo WHERE id_grupo=?', $group_id); - - if($result == "0E0"){ - print_log "[ERROR] Group '$group_id' doesn`t exist \n\n"; - }else{ - if(defined($group_name)){ - if(defined($parent_group_name)){ - my $parent_group_id = get_group_id($dbh,$parent_group_name); - exist_check($parent_group_id, 'group name', $parent_group_name); - - if(defined($icon)){ - if(defined($description)){ - db_do ($dbh,'UPDATE tgrupo SET nombre=? , parent=? , icon=? , description=? WHERE id_grupo=?',$group_name,$parent_group_id,$icon,$description,$group_id); - }else{ - db_do ($dbh,'UPDATE tgrupo SET nombre=? , parent=? , icon=? WHERE id_grupo=?',$group_name,$parent_group_id,$icon,$group_id); - } - }else{ - db_do ($dbh,'UPDATE tgrupo SET nombre=? , parent=? WHERE id_grupo=?',$group_name,$parent_group_id,$group_id); - } - }else{ - db_do ($dbh,'UPDATE tgrupo SET nombre=? WHERE id_grupo=?',$group_name,$group_id); - } - print_log "[INFO] Updated group '$group_id'\n\n"; - } - } - - - - - -} - - -############################################################################### -# Returns the Nodes ID where the agent is defined (Metaconsole only) -# Related option: --locate_agent -############################################################################### -sub cli_locate_agent () { - my ($agent_name) = @ARGV[2]; - - if (is_metaconsole($conf) == 1) { - - my $agents_server = enterprise_hook('get_metaconsole_agent',[$dbh, $agent_name]); - - if (scalar(@{$agents_server}) != 0) { - foreach my $agent (@{$agents_server}) { - #my $server = enterprise_hook('get_metaconsole_setup_server_id',[$dbh, $agent->{'server_name'}]); - print $agent->{'id_tmetaconsole_setup'} . "\n"; - } - } - else { - my $servers = enterprise_hook('get_metaconsole_setup_servers',[$dbh]); - my @servers_id = split(',',$servers); - my @list_servers; - my $list_names_servers; - foreach my $server (@servers_id) { - my $dbh_metaconsole = enterprise_hook('get_node_dbh',[$conf, $server, $dbh]); - - my $agent_id = get_agent_id($dbh_metaconsole,$agent_name); - - if ($agent_id == -1) { - next; - } - else { - push @list_servers,$server; - } - } - - if (scalar(@list_servers) > 0) { - $list_names_servers = join(',',@list_servers); - print_log "[INFO] The agent: $agent_name find in server with IDS: $list_names_servers\n\n"; - } - else { - print_log "[ERROR] This agent: $agent_name not find in any node\n\n"; - } - } - } - else { - print_log "[ERROR] This functions only working in metaconsole system\n\n"; - } -} - -############################################################################### -# Disable alert system globally -# Related option: --disable_alerts -############################################################################### -sub cli_disable_alerts ($$) { - my ($conf, $dbh) = @_; - - print_log "[INFO] Disabling all alerts \n\n"; - - # This works by disabling alerts in each defined group - # If you have previously a group with alert disabled, and you disable - # alerts globally, when enabled it again, it will enabled also ! - - db_do ($dbh, "UPDATE tgrupo SET disabled = 1"); - - exit; -} - -############################################################################### -# Enable alert system globally -# Related option: --enable_alerts -############################################################################### -sub cli_enable_alerts ($$) { - my ($conf, $dbh) = @_; - - print_log "[INFO] Enabling all alerts \n\n"; - - db_do ($dbh, "UPDATE tgrupo SET disabled = 0"); - - exit; -} - -############################################################################### -# Disable enterprise ACL -# Related option: --disable_eacl -############################################################################### -sub cli_disable_eacl ($$) { - my ($conf, $dbh) = @_; - - print_log "[INFO] Disabling Enterprise ACL system (system wide)\n\n"; - - db_do ($dbh, "UPDATE tconfig SET `value` ='0' WHERE `token` = 'acl_enterprise'"); - - exit; -} - -############################################################################### -# Enable enterprise ACL -# Related option: --enable_eacl -############################################################################### -sub cli_enable_eacl ($$) { - my ($conf, $dbh) = @_; - - print_log "[INFO] Enabling Enterprise ACL system (system wide)\n\n"; - - db_do ($dbh, "UPDATE tconfig SET `value` ='1' WHERE `token` = 'acl_enterprise'"); - - exit; -} - -############################################################################### -# Disable double authentication -# Related option: --disable_double_auth -############################################################################### -sub cli_disable_double_auth () { - my $user_id = @ARGV[2]; - - print_log "[INFO] Disabling double authentication for the user '$user_id'\n\n"; - - $user_id = safe_input($user_id); - - # Delete the user secret - my $result = db_do ($dbh, 'DELETE FROM tuser_double_auth WHERE id_user = ?', $user_id); - - exit; -} - -############################################################################### -# Enable user -# Related option: --enable_user -############################################################################### -sub cli_user_enable () { - my $user_id = @ARGV[2]; - - my $user_disabled = get_user_disabled ($dbh, $user_id); - - exist_check($user_disabled,'user',$user_id); - - if($user_disabled == 0) { - print_log "[INFO] The user '$user_id' is already enabled. Nothing to do.\n\n"; - exit; - } - - print_log "[INFO] Enabling user '$user_id'\n\n"; - - $user_id = safe_input($user_id); - - db_do ($dbh, "UPDATE tusuario SET disabled = '0' WHERE id_user = '$user_id'"); - - exit; -} - -############################################################################### -# Disable user -# Related option: --disable_user -############################################################################### -sub cli_user_disable () { - my $user_id = @ARGV[2]; - - my $user_disabled = get_user_disabled ($dbh, $user_id); - - exist_check($user_disabled,'user',$user_id); - - if($user_disabled == 1) { - print_log "[INFO] The user '$user_id' is already disabled. Nothing to do.\n\n"; - exit; - } - - print_log "[INFO] Disabling user '$user_id'\n\n"; - - $user_id = safe_input($user_id); - - db_do ($dbh, "UPDATE tusuario SET disabled = '1' WHERE id_user = '$user_id'"); - - exit; -} - -############################################################################### -# Stop Planned downtime -# Related option: --stop_downtime -############################################################################### -sub cli_stop_downtime () { - my $downtime_name = @ARGV[2]; - - my $downtime_id = pandora_get_planned_downtime_id ($dbh, $downtime_name); - exist_check($downtime_id,'planned downtime',$downtime_id); - - my $current_time = time; - my $downtime_date_to = get_db_value ($dbh, 'SELECT date_to FROM tplanned_downtime WHERE id=?', $downtime_id); - - if($current_time >= $downtime_date_to) { - print_log "[INFO] Planned_downtime '$downtime_name' is already stopped\n\n"; - exit; - } - - print_log "[INFO] Stopping planned downtime '$downtime_name'\n\n"; - - my $parameters->{'date_to'} = time; - - db_process_update($dbh, 'tplanned_downtime', $parameters, {'id' => $downtime_id}); -} - -############################################################################### -# Get module data -# Related option: --get_module_data -############################################################################### -sub cli_module_get_data () { - my ($agent_name, $module_name, $interval, $csv_separator) = @ARGV[2..5]; - - $csv_separator = '|' unless defined($csv_separator); - - if ($interval <= 0) { - print_log "[ERROR] Interval must be a possitive value\n\n"; - exit; - } - - - - my $agent_id = get_agent_id($dbh,$agent_name); - exist_check($agent_id, 'agent name', $agent_name); - - my $module_id = get_agent_module_id($dbh, $module_name, $agent_id); - exist_check($module_id, 'module name', $module_name); - - my $id_agent_module = get_agent_module_id ($dbh, $module_name, $agent_id); - - my $module_type_id = get_db_value($dbh, - "SELECT id_tipo_modulo FROM tagente_modulo WHERE id_agente_modulo = ?", - $id_agent_module); - - my $module_type = get_db_value($dbh, - "SELECT nombre FROM ttipo_modulo WHERE id_tipo = ?", - $module_type_id); - - my @data = NULL; - if ($module_type eq "log4x") { - @data = get_db_rows ($dbh, "SELECT utimestamp, datos - FROM tagente_datos_log4x - WHERE id_agente_modulo = $id_agent_module - AND utimestamp > (UNIX_TIMESTAMP(NOW()) - $interval) - ORDER BY utimestamp DESC"); - } - elsif ($module_type =~ m/_string/) { - print("aaaa\n"); - @data = get_db_rows ($dbh, "SELECT utimestamp, datos - FROM tagente_datos_string - WHERE id_agente_modulo = $id_agent_module - AND utimestamp > (UNIX_TIMESTAMP(NOW()) - $interval) - ORDER BY utimestamp DESC"); - } - elsif ($module_type =~ m/_inc$/) { - @data = get_db_rows ($dbh, "SELECT utimestamp, datos - FROM tagente_datos_inc - WHERE id_agente_modulo = $id_agent_module - AND utimestamp > (UNIX_TIMESTAMP(NOW()) - $interval) - ORDER BY utimestamp DESC"); - } - else { - @data = get_db_rows ($dbh, "SELECT utimestamp, datos - FROM tagente_datos - WHERE id_agente_modulo = $id_agent_module - AND utimestamp > (UNIX_TIMESTAMP(NOW()) - $interval) - ORDER BY utimestamp DESC"); - } - - - - foreach my $data_timestamp (@data) { - print $data_timestamp->{'utimestamp'}; - print $csv_separator; - print $data_timestamp->{'datos'}; - print "\n"; - } - - exit; -} - -############################################################################## -# Enable or disable event flow protection -# Related option: --create_netflow_filter -############################################################################## -sub cli_set_event_storm_protection () { - my $value = @ARGV[2]; - - # Check for a valid value - if ($value != 0 && $value != 1) { - print_log "[ERROR] Invalid value: $value. Value must be either 0 or 1\n\n"; - return; - } - - # Set the value of event - db_do ($dbh, 'UPDATE tconfig SET value=? WHERE token=?', $value, 'event_storm_protection'); -} - -############################################################################## -# Return event name given a event id -############################################################################## - -sub pandora_get_event_name($$) { - my ($dbh,$id_event) = @_; - - my $event_name = get_db_value($dbh, 'SELECT evento FROM tevento WHERE id_evento = ?',$id_event); - - return defined ($event_name) ? $event_name : -1; -} - -########################################################################## -## Update event from hash -########################################################################## -sub pandora_update_event_from_hash ($$$$) { - my ($parameters, $where_column, $where_value, $dbh) = @_; - - my $event_id = db_process_update($dbh, 'tevento', $parameters, {$where_column => $where_value}); - return $event_id; -} - -############################################################################## -# Return event comment given a event id -############################################################################## - -sub pandora_get_event_comment($$) { - my ($dbh,$id_event) = @_; - - my $event_name = get_db_value($dbh, 'SELECT user_comment FROM tevento WHERE id_evento = ?',$id_event); - - return defined ($event_name) ? $event_name : -1; -} - -############################################################################## -# Return user id given a user name -############################################################################## - -sub pandora_get_user_id($$) { - my ($dbh,$user_name) = @_; - - my $user_id = get_db_value($dbh, 'SELECT id_user FROM tusuario WHERE id_user = ? or fullname = ?',$user_name, $user_name); - - return defined ($user_id) ? $user_id : -1; -} - -############################################################################## -# Return network component id given the name -############################################################################## - -sub pandora_get_network_component_id($$) { - my ($dbh,$name) = @_; - - my $nc_id = get_db_value($dbh, 'SELECT id_nc FROM tnetwork_component WHERE name = ?',safe_input($name)); - - return defined ($nc_id) ? $nc_id : -1; -} - -############################################################################## -# Create special day -# Related option: --create_special_day -############################################################################## - -sub cli_create_special_day() { - my ($special_day, $same_day, $description, $group_name) = @ARGV[2..5]; - my $special_day_exists = pandora_get_special_day_id ($dbh, $special_day); - non_exist_check($special_day_exists,'special day',$special_day); - - my $group_id = 0; - - # If group name is not defined, we assign group All (0) - if(defined($group_name)) { - $group_id = get_group_id($dbh, decode('UTF-8', $group_name)); - exist_check($group_id,'group',$group_name); - } - else { - $group_name = 'All'; - } - - if ($special_day !~ /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/) { - print_log "[ERROR] '$special_day' is invalid date format.\n\n"; - $param = '--create_special_day'; - help_screen (); - exit 1; - } - if ($same_day !~ /monday|tuesday|wednesday|thursday|friday|saturday|sunday/) { - print_log "[ERROR] '$same_day' is invalid day.\n\n"; - $param = '--create_special_day'; - help_screen (); - exit 1; - } - - my %parameters; - - $parameters{"${RDBMS_QUOTE}date${RDBMS_QUOTE}"} = $special_day; - $parameters{'same_day'} = $same_day; - $parameters{'description'} = decode('UTF-8', $description); - $parameters{'id_group'} = $group_id; - - pandora_create_special_day_from_hash ($conf, \%parameters, $dbh); -} - -############################################################################## -# Update a special day. -# Related option: --update_special_day -############################################################################## - -sub cli_update_special_day() { - my ($special_day,$field,$new_value) = @ARGV[2..4]; - - my $special_day_id = pandora_get_special_day_id ($dbh, $special_day); - exist_check($special_day_id,'special day',$special_day); - - if($field eq 'date') { - if ($new_value !~ /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/) { - print_log "[ERROR] '$new_value' is invalid date format.\n\n"; - $param = '--update_special_day'; - help_screen (); - exit 1; - } - } - elsif($field eq 'same_day') { - if ($new_value !~ /monday|tuesday|wednesday|thursday|friday|saturday|sunday/) { - print_log "[ERROR] '$new_value' is invalid day.\n\n"; - $param = '--update_special_day'; - help_screen (); - exit 1; - } - } - elsif($field eq 'description') { - $new_value = decode('UTF-8', $new_value); - } - elsif($field eq 'group') { - my $group_id = 0; - - $group_id = get_group_id($dbh, decode('UTF-8', $new_value)); - exist_check($group_id,'group',$new_value); - - $new_value = $group_id; - $field = 'id_group'; - } - else { - print_log "[ERROR] Field '$field' doesnt exist\n\n"; - exit; - } - - print_log "[INFO] Updating field '$field' in special day '$special_day'\n\n"; - - my $update; - - $update->{$field} = $new_value; - - pandora_update_special_day_from_hash ($update, 'id', $special_day_id, $dbh); -} - -############################################################################## -# Delete a special_day. -# Related option: --delete_special_day -############################################################################## - -sub cli_delete_special_day() { - my $special_day = @ARGV[2]; - - print_log "[INFO] Deleting special day '$special_day' \n\n"; - - my $result = pandora_delete_special_day($dbh,$special_day); - exist_check($result,'special day',$special_day); -} - - -############################################################################### -############################################################################### -# MAIN -############################################################################### -############################################################################### - -sub pandora_manage_main ($$$) { - my ($conf, $dbh, $history_dbh) = @_; - - my @args = @ARGV; - my $ltotal=$#args; - my $ax; - - # Has read setup file ok ? - if ( $ltotal == 0 ) { - print_log "[ERROR] No valid arguments\n\n"; - help_screen(); - exit; - } - else { - $param = $args[1]; - - # help! - if ($param =~ m/--*h\w*\z/i ) { - $param = ''; - help_screen () ; - exit; - } - elsif ($param eq '--disable_alerts') { - param_check($ltotal, 0); - cli_disable_alerts ($conf, $dbh); - } - elsif ($param eq '--enable_alerts') { - param_check($ltotal, 0); - cli_enable_alerts ($conf, $dbh); - } - elsif ($param eq '--disable_eacl') { - param_check($ltotal, 0); - cli_disable_eacl ($conf, $dbh); - } - elsif ($param eq '--enable_eacl') { - param_check($ltotal, 0); - cli_enable_eacl ($conf, $dbh); - } - elsif ($param eq '--disable_double_auth') { - param_check($ltotal, 1); - cli_disable_double_auth(); - } - elsif ($param eq '--disable_group') { - param_check($ltotal, 1); - cli_disable_group(); - } - elsif ($param eq '--enable_group') { - param_check($ltotal, 1); - cli_enable_group(); - } - elsif ($param eq '--create_agent') { - param_check($ltotal, 7, 3); - cli_create_agent(); - } - elsif ($param eq '--delete_agent') { - param_check($ltotal, 1); - cli_delete_agent(); - } - elsif ($param eq '--create_data_module') { - param_check($ltotal, 30, 24); - cli_create_data_module(0); - } - elsif ($param eq '--create_web_module') { - param_check($ltotal, 30, 24); - cli_create_web_module(0); - } - elsif ($param eq '--create_module_group') { - param_check($ltotal, 1, 1); - cli_create_module_group(); - } - elsif ($param eq '--create_network_module') { - param_check($ltotal, 32, 20); - cli_create_network_module(0); - } - elsif ($param eq '--create_snmp_module') { - param_check($ltotal, 40, 28); - cli_create_snmp_module(0); - } - elsif ($param eq '--create_plugin_module') { - param_check($ltotal, 34, 19); - cli_create_plugin_module(0); - } - elsif ($param eq '--delete_module') { - param_check($ltotal, 2); - cli_delete_module(); - } - elsif ($param eq '--delete_not_policy_modules') { - param_check($ltotal, 0); - cli_delete_not_policy_modules(); - } - elsif ($param eq '--create_template_module') { - param_check($ltotal, 3); - cli_create_template_module(); - } - elsif ($param eq '--delete_template_module') { - param_check($ltotal, 3); - cli_delete_template_module(); - } - elsif ($param eq '--create_template_action') { - param_check($ltotal, 6, 2); - cli_create_template_action(); - } - elsif ($param eq '--delete_template_action') { - param_check($ltotal, 4); - cli_delete_template_action(); - } - elsif ($param eq '--data_module') { - param_check($ltotal, 6, 1); - cli_data_module(); - } - elsif ($param eq '--create_user') { - param_check($ltotal, 4, 1); - cli_create_user(); - } - elsif ($param eq '--delete_user') { - param_check($ltotal, 1); - cli_delete_user(); - } - elsif ($param eq '--add_profile') { - param_check($ltotal, 3); - cli_add_profile(); - } - elsif ($param eq '--create_profile') { - param_check($ltotal, 24); - cli_create_profile(); - } - elsif ($param eq '--delete_profile') { - param_check($ltotal, 3); - cli_delete_profile(); - } - elsif ($param eq '--create_event') { - param_check($ltotal, 14, 11); - cli_create_event(); - } - elsif ($param eq '--validate_event') { - param_check($ltotal, 7, 6); - cli_validate_event(); - } - elsif ($param eq '--validate_event_id') { - param_check($ltotal, 1); - cli_validate_event_id(); - } - elsif ($param eq '--get_event_info') { - param_check($ltotal, 2,1); - cli_get_event_info(); - } - elsif ($param eq '--add_event_comment') { - param_check($ltotal, 3); - cli_add_event_comment(); - } - elsif ($param eq '--create_incident') { - param_check($ltotal, 7, 1); - cli_create_incident(); - } - elsif ($param eq '--delete_data') { - param_check($ltotal, 3, 1); - cli_delete_data($ltotal); - } - elsif ($param eq '--apply_policy') { - param_check($ltotal, 1); - cli_apply_policy(); - } - elsif ($param eq '--disable_policy_alerts') { - param_check($ltotal, 1); - cli_disable_policy_alerts(); - } - elsif ($param eq '--create_group') { - param_check($ltotal, 4, 3); - cli_create_group(); - } - elsif ($param eq '--delete_group') { - param_check($ltotal, 1); - cli_delete_group(); - } - elsif ($param eq '--update_group') { - param_check($ltotal, 5,4); - cli_update_group(); - } - elsif ($param eq '--add_agent_to_policy') { - param_check($ltotal, 2); - cli_policy_add_agent(); - } - elsif ($param eq '--enable_user') { - param_check($ltotal, 1); - cli_user_enable(); - } - elsif ($param eq '--disable_user') { - param_check($ltotal, 1); - cli_user_disable(); - } - elsif ($param eq '--update_user') { - param_check($ltotal, 3); - cli_user_update(); - } - elsif ($param eq '--add_profile_to_user') { - param_check($ltotal, 3, 1); - cli_user_add_profile(); - } - elsif ($param eq '--get_module_data') { - param_check($ltotal, 4, 1); - cli_module_get_data(); - } - elsif ($param eq '--add_collection_to_policy') { - param_check($ltotal, 2, 2); - cli_add_collection_to_policy(); - } - elsif ($param eq '--create_policy_data_module_from_local_component') { - param_check($ltotal, 2, 2); - cli_create_policy_data_module_from_local_component(); - } - elsif ($param eq '--create_policy_web_module_from_local_component') { - param_check($ltotal, 2, 2); - cli_create_policy_web_module_from_local_component(); - } - elsif ($param eq '--create_policy') { - param_check($ltotal, 3, 2); - cli_create_policy(); - } - elsif ($param eq '--create_policy_data_module') { - param_check($ltotal, 28, 20); - cli_create_data_module(1); - } - elsif ($param eq '--create_policy_web_module') { - param_check($ltotal, 28, 20); - cli_create_web_module(1); - } - elsif ($param eq '--create_policy_network_module') { - param_check($ltotal, 30, 20); - cli_create_network_module(1); - } - elsif ($param eq '--create_policy_snmp_module') { - param_check($ltotal, 39, 27); - cli_create_snmp_module(1); - } - elsif ($param eq '--create_policy_plugin_module') { - param_check($ltotal, 33, 19); - cli_create_plugin_module(1); - } - elsif ($param eq '--create_alert_template') { - param_check($ltotal, 19, 15); - cli_create_alert_template(); - } - elsif ($param eq '--delete_alert_template') { - param_check($ltotal, 1); - cli_delete_alert_template(); - } - elsif ($param eq '--update_alert_template') { - param_check($ltotal, 3); - cli_alert_template_update(); - } - elsif ($param eq '--update_module') { - param_check($ltotal, 4); - cli_module_update(); - } - elsif ($param eq '--exec_from_file') { - cli_exec_from_file(); - } - elsif ($param eq '--stop_downtime') { - cli_stop_downtime(); - } - elsif ($param eq '--apply_all_policies') { - param_check($ltotal, 0); - cli_apply_all_policies(); - } - elsif ($param eq '--validate_all_alerts') { - param_check($ltotal, 0); - cli_validate_all_alerts(); - } - elsif ($param eq '--validate_policy_alerts') { - param_check($ltotal, 1); - cli_validate_policy_alerts(); - } - elsif ($param eq '--get_module_id') { - param_check($ltotal, 2); - cli_get_module_id(); - } - elsif ($param eq '--get_agent_group') { - param_check($ltotal, 1); - cli_get_agent_group(); - } - elsif ($param eq '--get_agent_group_id') { - param_check($ltotal, 1); - cli_get_agent_group_id(); - } - elsif ($param eq '--get_agents_module_current_data') { - param_check($ltotal, 1); - cli_get_agents_module_current_data(); - } - elsif ($param eq '--get_agent_modules') { - param_check($ltotal, 1); - cli_get_agent_modules(); - } - elsif ($param eq '--get_policy_modules') { - param_check($ltotal, 1); - cli_get_policy_modules(); - } - elsif ($param eq '--get_policies') { - param_check($ltotal, 1, 1); - cli_get_policies(); - } - elsif ($param eq '--get_agents') { - param_check($ltotal, 6, 6); - cli_get_agents(); - } - elsif ($param eq '--delete_conf_file') { - param_check($ltotal, 1); - cli_delete_conf_file(); - } - elsif ($param eq '--clean_conf_file') { - param_check($ltotal, 1, 1); - cli_clean_conf_file(); - } - elsif ($param eq '--update_agent') { - param_check($ltotal, 3); - cli_agent_update(); - } - elsif ($param eq '--get_bad_conf_files') { - param_check($ltotal, 0); - cli_get_bad_conf_files(); - } - elsif ($param eq '--create_network_module_from_component') { - param_check($ltotal, 2); - cli_create_network_module_from_component(); - } - elsif ($param eq '--create_netflow_filter') { - param_check($ltotal, 5); - cli_create_netflow_filter(); - } - elsif ($param eq '--create_snmp_trap') { - param_check($ltotal, 4); - cli_create_snmp_trap ($conf, $dbh); - } - elsif ($param eq '--set_event_storm_protection') { - param_check($ltotal, 1); - cli_set_event_storm_protection(); - } - elsif ($param eq '--create_custom_graph') { - param_check($ltotal, 11); - cli_create_custom_graph(); - } - elsif ($param eq '--delete_custom_graph') { - param_check($ltotal, 1); - cli_delete_custom_graph(); - } - elsif ($param eq '--edit_custom_graph') { - param_check($ltotal, 10); - cli_edit_custom_graph(); - } - elsif ($param eq '--add_modules_to_graph') { - param_check($ltotal, 3); - cli_add_modules_to_graph(); - } - elsif ($param eq '--delete_modules_to_graph') { - param_check($ltotal, 3); - cli_delete_modules_to_graph(); - } - elsif ($param eq '--create_special_day') { - param_check($ltotal, 4); - cli_create_special_day(); - } - elsif ($param eq '--update_special_day') { - param_check($ltotal, 3); - cli_update_special_day(); - } - elsif ($param eq '--delete_special_day') { - param_check($ltotal, 1); - cli_delete_special_day(); - } - elsif ($param eq '--create_data_module_from_local_component') { - param_check($ltotal, 2); - cli_create_data_module_from_local_component(); - } - elsif ($param eq '--create_web_module_from_local_component') { - param_check($ltotal, 2); - cli_create_web_module_from_local_component(); - } - elsif ($param eq '--create_local_component') { - param_check($ltotal, 35, 33); - cli_create_local_component(); - } - elsif ($param eq '--recreate_collection') { - param_check($ltotal, 1); - cli_recreate_collection(); - } - elsif ($param eq '--create_tag') { - param_check($ltotal, 4, 2); - cli_create_tag(); - } - elsif ($param eq '--add_tag_to_user_profile') { - param_check($ltotal, 4); - cli_add_tag_to_user_profile(); - } - elsif ($param eq '--add_tag_to_module') { - param_check($ltotal, 3); - cli_add_tag_to_module(); - } - elsif ($param eq '--create_downtime') { - param_check($ltotal, 19); - cli_create_planned_downtime(); - } - elsif ($param eq '--add_item_downtime') { - param_check($ltotal, 3); - cli_add_item_planned_downtime(); - } - elsif ($param eq '--get_all_planned_downtimes') { - param_check($ltotal, 5, 4); - cli_get_all_planned_downtime(); - } - elsif ($param eq '--get_planned_downtimes_items') { - param_check($ltotal, 5, 4); - cli_get_planned_downtimes_items(); - } - elsif ($param eq '--create_synthetic') { - #aram_check($ltotal, 1); - cli_create_synthetic(); - } - elsif ($param eq '--set_planned_downtimes_deleted') { - param_check($ltotal, 1); - cli_set_delete_planned_downtime(); - } - elsif ($param eq '--locate_agent') { - param_check($ltotal, 1); - cli_locate_agent(); - } - else { - print_log "[ERROR] Invalid option '$param'.\n\n"; - $param = ''; - help_screen (); - exit; - } - } - - exit; -} - -############################################################################## -# Create a custom graph. -# Related option: --create_custom_graph -############################################################################## - -sub cli_create_custom_graph() { - - my ($name,$description,$user,$idGroup,$width,$height,$events,$stacked,$period,$modules,$separator) = @ARGV[2..12]; - - $separator = ($separator ne '') ? $separator : ';'; - - my @module_array = split($separator, $modules); - - $description = ($description ne '') ? safe_input($description) : ''; - $width = ($width ne '') ? $width : 550; - $height = ($height ne '') ? $height : 210; - $period = ($period ne '') ? $period : 86400; - $events = ($events ne '') ? $events : 0; - $stacked = ($stacked ne '') ? $stacked : 0; - $idGroup = ($idGroup ne '') ? $idGroup : 0; - - my $id_graph = pandora_create_custom_graph($name,$description,$user,$idGroup,$width,$height,$events,$stacked,$period,$dbh); - - if ($id_graph != 0) { #~ insert source - if ($modules ne '') { - foreach my $module (@module_array) { - pandora_insert_graph_source($id_graph,$module,1,$dbh); - } - } - } -} - -############################################################################## -# Delete a custom graph. -# Related option: --delete_custom_graph -############################################################################## -sub cli_delete_custom_graph () { - - my ($id_graph) = @ARGV[2]; - - my $result = pandora_delete_graph_source($id_graph, $dbh); - - pandora_delete_custom_graph($id_graph, $dbh); -} - -############################################################################## -# Edit a custom graph. -# Related option: --edit_custom_graph -############################################################################## -sub cli_edit_custom_graph() { - - my ($id_graph,$name,$description,$user,$idGroup,$width,$height,$events,$stacked,$period) = @ARGV[2..12]; - - pandora_edit_custom_graph($id_graph,$name,$description,$user,$idGroup,$width,$height,$events,$stacked,$period,$dbh); - -} - -sub cli_add_modules_to_graph () { - - my ($id_graph,$modules,$separator) = @ARGV[2..4]; - - $separator = ($separator ne '') ? $separator : ';'; - - my @module_array = split($separator, $modules); - - foreach my $module (@module_array) { - pandora_insert_graph_source($id_graph,$module,1,$dbh); - } -} - -sub cli_delete_modules_to_graph () { - - my ($id_graph,$modules,$separator) = @ARGV[2..4]; - - $separator = ($separator ne '') ? $separator : ';'; - - my @module_array = split($separator, $modules); - - foreach my $module (@module_array) { - pandora_delete_graph_source($id_graph, $dbh, $module); - } -} - -############################################################################## -# Return local component id given the name -############################################################################## - -sub pandora_get_local_component_id($$) { - my ($dbh,$name) = @_; - - my $lc_id = get_db_value($dbh, 'SELECT id FROM tlocal_component WHERE name = ?',safe_input($name)); - - return defined ($lc_id) ? $lc_id : -1; -} - -############################################################################## -# Create policy -# Related option: --create_policy -############################################################################## -sub cli_create_policy () { - my ($policy_name, $group_name, $description) = @ARGV[2..4]; - - my $policy_id = enterprise_hook('get_policy_id',[$dbh, safe_input($policy_name)]); - - non_exist_check($policy_id,'policy',$policy_name); - - my $id_group = get_group_id($dbh,$group_name); - exist_check($id_group,'group',$group_name); - - my $id = enterprise_hook('create_policy',[$dbh, $policy_name, $description, $id_group]); - - return $id; -} - -############################################################################## -# Add collection to a policy -# Related option: --add_collection_to_policy -############################################################################## -sub cli_add_collection_to_policy () { - my ($policy_name, $collection_name) = @ARGV[2..3]; - - my $policy_id = enterprise_hook('get_policy_id',[$dbh, safe_input($policy_name)]); - exist_check($policy_id,'policy',$policy_name); - - my $collection_id = enterprise_hook('get_collection_id',[$dbh, safe_input($collection_name)]); - exist_check($collection_id,'group',$collection_name); - - my $id = enterprise_hook('add_collection_to_policy_db',[$dbh, $policy_id, $collection_id]); - - return $id; -} - -############################################################################## -# Create data module from local component. -# Related option: --create_data_module_from_local_component -############################################################################## - -sub cli_create_data_module_from_local_component() { - my ($agent_name, $component_name) = @ARGV[2..3]; - - my $agent_id = get_agent_id($dbh,$agent_name); - exist_check($agent_id,'agent',$agent_name); - - my $lc_id = pandora_get_local_component_id($dbh, $component_name); - exist_check($lc_id,'local component',$component_name); - - my $module_exists = get_agent_module_id($dbh, $component_name, $agent_id); - non_exist_check($module_exists, 'module name', $component_name); - - # Get local component data - my $component = get_db_single_row ($dbh, 'SELECT * FROM tlocal_component WHERE id = ?', $lc_id); - - #~ pandora_create_module_from_local_component ($conf, $component, $agent_id, $dbh); - enterprise_hook('pandora_create_module_from_local_component',[$conf, $component, $agent_id, $dbh]); -} -############################################################################## -# Create web module from local component. -# Related option: --create_web_module_from_local_component -############################################################################## - -sub cli_create_web_module_from_local_component() { - my ($agent_name, $component_name) = @ARGV[2..3]; - - my $agent_id = get_agent_id($dbh,$agent_name); - exist_check($agent_id,'agent',$agent_name); - - my $lc_id = pandora_get_local_component_id($dbh, $component_name); - exist_check($lc_id,'local component',$component_name); - - my $module_exists = get_agent_module_id($dbh, $component_name, $agent_id); - non_exist_check($module_exists, 'module name', $component_name); - - # Get local component data - my $component = get_db_single_row ($dbh, 'SELECT * FROM tlocal_component WHERE id = ?', $lc_id); - - #~ pandora_create_module_from_local_component ($conf, $component, $agent_id, $dbh); - enterprise_hook('pandora_create_module_from_local_component',[$conf, $component, $agent_id, $dbh]); -} - -############################################################################## -# Create policy data module from local component. -# Related option: --create_policy_data_module_from_local_component -############################################################################## -sub cli_create_policy_data_module_from_local_component() { - my ($policy_name, $component_name) = @ARGV[2..3]; - - my $policy_id = enterprise_hook('get_policy_id',[$dbh, safe_input($policy_name)]); - exist_check($policy_id,'policy',$policy_name); - - my $lc_id = pandora_get_local_component_id($dbh, $component_name); - exist_check($lc_id,'local component',$component_name); - - # Get local component data - my $component = get_db_single_row ($dbh, 'SELECT * FROM tlocal_component WHERE id = ?', $lc_id); - - enterprise_hook('pandora_create_policy_data_module_from_local_component',[$conf, $component, $policy_id, $dbh]); -} - -############################################################################## -# Create policy web module from local component. -# Related option: --create_policy_web_module_from_local_component -############################################################################## -sub cli_create_policy_web_module_from_local_component() { - my ($policy_name, $component_name) = @ARGV[2..3]; - - my $policy_id = enterprise_hook('get_policy_id',[$dbh, safe_input($policy_name)]); - exist_check($policy_id,'policy',$policy_name); - - my $lc_id = pandora_get_local_component_id($dbh, $component_name); - exist_check($lc_id,'local component',$component_name); - - # Get local component web - my $component = get_db_single_row ($dbh, 'SELECT * FROM tlocal_component WHERE id = ?', $lc_id); - - enterprise_hook('pandora_create_policy_web_module_from_local_component',[$conf, $component, $policy_id, $dbh]); -} - -############################################################################## -# Create local component. -# Related option: --create_local_component -############################################################################## - -sub cli_create_local_component() { - - my ($component_name, $data, $description, $id_os, $os_version, $id_network_component_group, $type, - $min,$max,$module_interval, $id_module_group, $history_data, $min_warning, $max_warning, $str_warning, - $min_critical, $max_critical, $str_critical, $min_ff_event, $post_process, $unit, $wizard_level, - $critical_instructions, $warning_instructions, $unknown_instructions, $critical_inverse, $warning_inverse, - $id_category, $tags, $disabled_types_event, $min_ff_event_normal, $min_ff_event_warning, $min_ff_event_critical, - $each_ff, $ff_timeout) = @ARGV[2..37]; - - my %parameters; - - $parameters{'name'} = safe_input($component_name); - my $data_aux = safe_input($data); - $data_aux =~ s/\n/ /g; - $parameters{'data'} = $data_aux; - $parameters{'description'} = safe_input($description) unless !defined ($description); - $parameters{'id_os'} = $id_os unless !defined ($id_os); - $parameters{'type'} = $type unless !defined ($type); - if (defined $id_network_component_group) { - $parameters{'id_network_component_group'} = $id_network_component_group; - } else { - $parameters{'id_network_component_group'} = 1; - } - $parameters{'max'} = $max unless !defined ($max); - $parameters{'min'} = $min unless !defined ($min); - $parameters{'module_interval'} = $module_interval unless !defined ($module_interval); - $parameters{'id_module_group'} = $id_module_group unless !defined ($id_module_group); - $parameters{'history_data'} = safe_input($history_data) unless !defined ($history_data); - $parameters{'min_warning'} = $min_warning unless !defined ($min_warning); - $parameters{'max_warning'} = $max_warning unless !defined ($max_warning); - $parameters{'str_warning'} = $str_warning unless !defined ($str_warning); - $parameters{'min_critical'} = $min_critical unless !defined ($min_critical); - $parameters{'max_critical'} = $max_critical unless !defined ($max_critical); - $parameters{'str_critical'} = $str_critical unless !defined ($str_critical); - $parameters{'min_ff_event'} = $min_ff_event unless !defined ($min_ff_event); - $parameters{'post_process'} = $post_process unless !defined ($post_process); - $parameters{'unit'} = $unit unless !defined ($unit); - $parameters{'wizard_level'} = $wizard_level unless !defined ($wizard_level); - $parameters{'critical_instructions'} = safe_input($critical_instructions) unless !defined ($critical_instructions); - $parameters{'warning_instructions'} = safe_input($warning_instructions) unless !defined ($warning_instructions); - $parameters{'unknown_instructions'} = safe_input($unknown_instructions) unless !defined ($unknown_instructions); - $parameters{'critical_inverse'} = $critical_inverse unless !defined ($critical_inverse); - $parameters{'warning_inverse'} = $warning_inverse unless !defined ($warning_inverse); - $parameters{'id_category'} = $id_category unless !defined ($id_category); - $parameters{'tags'} = safe_input($tags) unless !defined ($tags); - - my $disabled_types_event_hash = {}; - if ($disabled_types_event) { - $disabled_types_event_hash->{'going_unknown'} = 0; - } - else { - $disabled_types_event_hash->{'going_unknown'} = 1; - } - my $disabled_types_event_json = encode_json($disabled_types_event_hash); - $parameters{'disabled_types_event'} = $disabled_types_event_json unless !defined ($disabled_types_event); - - $parameters{'min_ff_event_normal'} = $min_ff_event_normal unless !defined ($min_ff_event_normal); - $parameters{'min_ff_event_warning'} = $min_ff_event_warning unless !defined ($min_ff_event_warning); - $parameters{'min_ff_event_critical'} = $min_ff_event_critical unless !defined ($min_ff_event_critical); - $parameters{'each_ff'} = $each_ff unless !defined ($each_ff); - $parameters{'ff_timeout'} = $ff_timeout unless !defined ($ff_timeout); - - my $component_id = enterprise_hook('pandora_create_local_component_from_hash',[$conf, \%parameters, $dbh]); -} - -############################################################################## -# Create a new tag. -############################################################################## - -sub cli_create_tag() { - my ($tag_name, $tag_description, $tag_url, $tag_email) = @ARGV[2..5]; - - # Call the API. - my $result = api_call(\%conf, 'set', 'create_tag', undef, undef, "$tag_name|$tag_description|$tag_url|$tag_email"); - print "\n$result\n"; -} - -############################################################################## -# Add a tag to the specified profile and group. -############################################################################## - -sub cli_add_tag_to_user_profile() { - my ($user_id, $tag_name, $group_name, $profile_name) = @ARGV[2..5]; - - # Check the user. - my $user_exists = get_user_exists($dbh, $user_id); - exist_check($user_exists, 'user', $user_id); - - # Check the group. - my $group_id; - if ($group_name eq 'All') { - $group_id = 0; - } else { - $group_id = get_group_id($dbh, $group_name); - exist_check($group_id, 'group', $group_name); - } - - # Check the profile. - my $profile_id = get_profile_id($dbh, $profile_name); - exist_check($profile_id, 'profile', $profile_name); - - # Make sure the tag exists. - my $tag_id = get_tag_id($dbh, $tag_name); - exist_check($tag_id, 'tag', $tag_name); - - # Make sure the profile is associated to the user. - my $user_profile_id = get_user_profile_id($dbh, $user_id, $profile_id, $group_id); - exist_check($user_profile_id, 'given profile and group combination for user', $user_id); - - # Call the API. - my $result = api_call(\%conf, 'set', 'tag_user_profile', $user_id, $tag_id, "$group_id|$profile_id"); - print "\n$result\n"; -} - -############################################################################## -# Add a tag to the specified profile and group. -############################################################################## - -sub cli_add_tag_to_module() { - my ($agent_name, $module_name, $tag_name) = @ARGV[2..4]; - - # Check the tag. - my $tag_id = get_tag_id($dbh, $tag_name); - exist_check($tag_id, 'tag', $tag_name); - - # Check the agent. - my $agent_id = get_agent_id($dbh, $agent_name); - exist_check($agent_id, 'agent', $agent_name); - - # Check the module. - my $module_id = get_agent_module_id($dbh, $module_name, $agent_id); - exist_check($module_id, 'module name', $module_name); - - # Call the API. - my $result = api_call(\%conf, 'set', 'add_tag_module', $module_id, $tag_id); - print "\n$result\n"; -}