2007-06-25 Sancho Lerena <slerena@artica.es>
This should be definitive commit for Beta1 * General cleanup of unused or old stuff. * bin/PandoraFMS/Config.pm: Now uses errorlog for each perl error. Now render database bad connect string in connection phase (useful to debug startup errors by blank spaces). git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@540 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
9c41ba4e52
commit
eb013fbb88
|
@ -1,3 +1,17 @@
|
||||||
|
2007-06-25 Sancho Lerena <slerena@artica.es>
|
||||||
|
|
||||||
|
This should be definitive commit for Beta1
|
||||||
|
|
||||||
|
* General cleanup of unused or old stuff.
|
||||||
|
|
||||||
|
* bin/PandoraFMS/Config.pm: Now uses errorlog for each perl
|
||||||
|
error. Now render database bad connect string in connection phase
|
||||||
|
(useful to debug startup errors by blank spaces).
|
||||||
|
|
||||||
|
* util/pandora_checkdep.pl: Small perl script to check all
|
||||||
|
dependencies.
|
||||||
|
|
||||||
|
|
||||||
2007-06-25 Manuel Arostegui <marostegui@artica.es>
|
2007-06-25 Manuel Arostegui <marostegui@artica.es>
|
||||||
|
|
||||||
* specs/fedoracore5/pandora_server.spec: Moving PandoraFMS
|
* specs/fedoracore5/pandora_server.spec: Moving PandoraFMS
|
||||||
|
@ -13,8 +27,9 @@
|
||||||
|
|
||||||
* bin/PandoraFMS/DB.pm: Added support to timeframe alerts.
|
* bin/PandoraFMS/DB.pm: Added support to timeframe alerts.
|
||||||
|
|
||||||
* bin/pandora_recon.pl: Threads is not a good idea, we need to use fork()
|
* bin/pandora_recon.pl: Threads is not a good idea, we need to use
|
||||||
in the future. At this moment, multithread disabled for recon.
|
fork() in the future. At this moment, multithread disabled for
|
||||||
|
recon.
|
||||||
|
|
||||||
2007-06-18 Manuel Arostegui <marostegui@artica.es>
|
2007-06-18 Manuel Arostegui <marostegui@artica.es>
|
||||||
|
|
||||||
|
|
|
@ -1,231 +0,0 @@
|
||||||
Pandora Server install
|
|
||||||
======================
|
|
||||||
|
|
||||||
This small document try to guide you to a quick-and-irresponsable install. You must read the full install guide before try to install Pandora server and run it, but if you only want a quick step guide, this document is for you.
|
|
||||||
|
|
||||||
Requisites
|
|
||||||
==========
|
|
||||||
|
|
||||||
Database
|
|
||||||
~~~~~~~~
|
|
||||||
MySQL v4.x (or higher) database is used by Pandora Server as data storage. Only MySQL is supported by Pandora. InnoDB support is required, so you have to install MySQL4 or higher. If you want a MySQL cluster, use MySQL5. There are info about how to setup Pandora in a cluster enviroments.
|
|
||||||
|
|
||||||
Pandora Data Server
|
|
||||||
~~~~~~~~~~~~~~~~~~~
|
|
||||||
Requires SSH Servr and Perl v5.8 or higher and the next Perl Modules:
|
|
||||||
|
|
||||||
XML::Simple, useful XML functions
|
|
||||||
Digest::MD5, MD5 generation
|
|
||||||
Time::Local, Date and Time basic manipulation
|
|
||||||
DBI, DB interface with MySQL
|
|
||||||
Date::Manip, needed to manipulate Date and Time formats of input, output and compare
|
|
||||||
|
|
||||||
You can find them at http://www.cpan.org or install using your default package instalation system. These packages are in the default distribution of Suse 9.1 and Debian 3.0 GNU/Linux. Also available for Solaris in CPAN repository. If you use Windows go to http://ppm.activestate.com. Or you can use the ppm tool to download the modules:
|
|
||||||
ppm install DBI
|
|
||||||
ppm install DBD-mysql
|
|
||||||
ppm install Datemanip
|
|
||||||
|
|
||||||
Next, you need to set the TZ (Time Zone) environment variable. In Windows: set TZ=WET (for example).
|
|
||||||
|
|
||||||
Pandora Network Server
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
Requires SSH Server and Perl v5.8 or higher and the next Perl Modules:
|
|
||||||
|
|
||||||
IO::Socket, manage and manipulation of TCP/UDP sockets
|
|
||||||
Time::HiRes, needed for ICMP times
|
|
||||||
Time::Local, Date and Time basic manipulation
|
|
||||||
Net::Ping, to calculate latency times (it's required that the server runs as root user).
|
|
||||||
Net::Ping::External, needed to "ping" to remote systems
|
|
||||||
SNMP, for SNMP management
|
|
||||||
Date::Manip, needed to manipulate Date and Time formats of input, output and compare
|
|
||||||
|
|
||||||
To use SNMP fuctions it's needed also to have installed the net-snmp package. It's worth to say that to run modules of GENERIC_ICMP_DATA type (calculate ICMP latency time) Pandora Network Server must run with root privileges.
|
|
||||||
|
|
||||||
Pandora SNMP Console
|
|
||||||
~~~~~~~~~~~~~~~~~~~~
|
|
||||||
It's needed to install the NET-SNMP package which is included in all GNU/Linux distributions. You have to use the snmptrapd binary and copy or link it to $HOME_PANDORA/util, where $HOME_PANDORA is the instalation directory of Pandroa Server. This usually is /usr/share/pandora_server.
|
|
||||||
|
|
||||||
This binary gets the SNMP traps, generating a log that is parsed by the Pandora Server.
|
|
||||||
|
|
||||||
Pandora Web Console
|
|
||||||
~~~~~~~~~~~~~~~~~~~
|
|
||||||
Requires a Web Server (Apache recommended) with PHP 4.3.x (PHP 5 works ok too), PHP4-MySQL and PHP4-session modules, PHP-GD v1.3 library and JpGraph (http://www.aditus.nu/jpgraph/) for graphic generation.
|
|
||||||
|
|
||||||
It's required to initialize session on request startup to include on /etc/php.ini (or similar, depends on OS) the lines:
|
|
||||||
session.bug_compat_42 = 1
|
|
||||||
|
|
||||||
For security, the transfer of data between Pandora Agents and Server it's recommended to use SSHv2 using SCP, so you need to install it on your systems. You can also use SSHv1, FTP, TFTP or TCP/Raw transfers, but this last procedure isn't included in the Pandora documentation.
|
|
||||||
|
|
||||||
Pandora Agents
|
|
||||||
~~~~~~~~~~~~~~
|
|
||||||
These are installed on every machine to be monitored. They depend on the Operating System. Clients for several OS are provided, but can be easily developed new ones.
|
|
||||||
|
|
||||||
Pandora Agents for Solaris and AIX
|
|
||||||
|
|
||||||
You need MD5 package to run Pandora Agent for Solaris and AIX, but it's possible to deactivate the check into the servers and agents, setting the checksum to 0 inside the agent's configuration file (pandora_agent.conf).
|
|
||||||
Installation
|
|
||||||
|
|
||||||
INSTALLATION
|
|
||||||
============
|
|
||||||
|
|
||||||
Download the packages Pandora Server for Pandora Data Server, Pandora Network Server and Pandora SNMP Console, Pandora Agents and Pandora Web Console for DataBase and Web Management System (Web Console).
|
|
||||||
|
|
||||||
Database
|
|
||||||
~~~~~~~~
|
|
||||||
You need a database with name "pandora". To create the structure of Pandora database in MySQL Server you have the SQL script pandoradb.sql inside Pandora WebConsole distribution. It creates tables and indexes needed to insert information into Pandora database.
|
|
||||||
|
|
||||||
You MUST populate database with pandoradb_data.sql, an SQL script included in the same distribution directory, that inserts data needed to run Web Console and default user (login: admin, password: pandora) to access Pandora Web Console.
|
|
||||||
|
|
||||||
To install the files, first create a database called "pandora", and set an user to be able to access this database:
|
|
||||||
mysql> create database pandora;
|
|
||||||
|
|
||||||
Later, execute the next commands using a user with enough privileges to create tables and indexes into Pandora Database into your MySQL Server:
|
|
||||||
cat pandoradb.sql | mysql -D pandora -u root -p
|
|
||||||
cat pandoradb_data.sql | mysql -D pandora -u root -p
|
|
||||||
|
|
||||||
Note: if your system is Windows, use the command type instead of cat.
|
|
||||||
|
|
||||||
You can also use the source command, if you are connected to MySQL, from the MySQL prompt:
|
|
||||||
mysql> use pandora;
|
|
||||||
mysql> source <path_to_pandoradb.sql>
|
|
||||||
mysql> source <path_to_pandoradb_data.sql>
|
|
||||||
|
|
||||||
This example is valid using root user in MySQL. Remember if you're in windows and you use MySQL v4.1, use the dobule slash ("//") with the path to the files, not the backslash ("\").
|
|
||||||
|
|
||||||
If you have any problem with this commands, from the OS command line you can run this commands:
|
|
||||||
cat pandoradb.sql | mysql -D pandora -u root -p
|
|
||||||
cat pandoradb_data.sql | mysql -D pandora -u root -p
|
|
||||||
|
|
||||||
Note: if you're using Windows, you must use type command instead of the cat one.
|
|
||||||
|
|
||||||
Now we will create an user "pandora" and will be given to it privileges from the localhost. Please look at MySQL install & management guide (http://dev.mysql.com/doc) to obtain information about how to create a MySQL user and give him/her privileges to read/write in Pandora database. The sentence will be something like:
|
|
||||||
mysql> grant all on pandora.* to 'pandora'@'localhost' identified by 'pandora';
|
|
||||||
|
|
||||||
Keep in mind that users need access from Pandora WEB Console and from Pandora Server, if your deployment has many subcomponents in different physical machines, you need to setup a MySQL user with privileges to access from different locations.
|
|
||||||
|
|
||||||
If you get the error "Warning: mysql_connect() [function.mysql-connect]: client does not support authentication protocol requested by server; consider upgrading" when authenticating Web Console, you have to change the way the password is stored into the database (see FAQ):
|
|
||||||
mysql> set password for 'pandora'@'localhost' = old_password('pandora');
|
|
||||||
|
|
||||||
Please note this user will be used by several Pandora subcomponents(Pandora Server, Pandora Web Console) to access database.
|
|
||||||
|
|
||||||
Dont forget to flush privileges before exiting mysql console:
|
|
||||||
|
|
||||||
flush privileges;
|
|
||||||
|
|
||||||
Pandora Server
|
|
||||||
~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
Create the /usr/share/pandora_server directory and "gunzip" and "untar" here the pandora_server_1.2beta1.tar.gz file.
|
|
||||||
|
|
||||||
Create an user pandora in OS. Usually you do that (in GNU/Linux) with commands:
|
|
||||||
useraddd pandora -d /home/pandora
|
|
||||||
mkdir /home/pandora
|
|
||||||
chown pandora /home/pandora
|
|
||||||
|
|
||||||
This user will be used by the SSH transfers to the server, so this user will need a strong password.
|
|
||||||
|
|
||||||
In the file /home/pandora/.ssh/authorized_keys we will add the public key of each agent which send data to Pandora Server. These keys must be SSH v2, OpenSSH DiffieHellman (DF) or RSA. To convert between keys you can use the ssh-keygen tool.
|
|
||||||
|
|
||||||
Pandora Server will check and parse XML files sent by Pandora Agents and will insert the data into the Database.
|
|
||||||
|
|
||||||
Check launch scripts (pandora_network, pandora_server, pandora_snmp) and check for pathnames in the first two variables in script.
|
|
||||||
|
|
||||||
Edit configuration file of Pandora Server, usually /usr/share/pandora_server/conf/pandora_server.conf and take a look at the lines:
|
|
||||||
dbuser pandora
|
|
||||||
dbpass pandora
|
|
||||||
dbhost localhost
|
|
||||||
|
|
||||||
Please change them to your own data. For security reasons isn't recommended use the default values.
|
|
||||||
|
|
||||||
If you run Pandora Server in Windows, you need to use the backslash twice in $dirname, that is: "\\", for example: my $dirname="C:\\pandora\\pandora_server\\data_in";, not needed in $log_file.
|
|
||||||
|
|
||||||
These are default values, and all must be existing directory and filename and valid username, password and hostname.
|
|
||||||
|
|
||||||
Remember: you need to create the directory /var/spool/pandora/data_in where Pandora Server will read and write data, sent by remote agents using ssh/scp. This directory must be owned or with permissions to write for user "pandora". If you dont have a "pandora" user yet, create it.
|
|
||||||
|
|
||||||
You can run Pandora Server with an user without privilegues, you can use the user "pandora", it only needs to run /usr/bin/perl and access to /usr/share/pandora_server and /var/spool/pandora_server/data_in directories.
|
|
||||||
|
|
||||||
This is true with all the components but with Pandora SNMP Console needs root user to open UDP port 161 (this can be solved setting SUID0 to the snmptrapd binary) and running the rest of the Server using an user without privileges.
|
|
||||||
|
|
||||||
Also Pandora Network Server can be run using an user without privileges, but the GENERIC_ICMP_DATA type won't work, as root privileges are required to get ICMP latency times.
|
|
||||||
|
|
||||||
Check the MySQL connection with the user and password before running the server
|
|
||||||
|
|
||||||
Pandora Server distribution tarball includes a Posix/System V start/stop script for "daemonize" Pandora Server. It is possible that you need to customize, but its runs smoothly on GNU/Linux (debian, Suse) and Solaris 8 systems. It has start|stop|restart parameters to include it in your default init level directory and it creates a logfile defined in $log_file variable (by default is /usr/share/pandora_server/pandora.log):
|
|
||||||
/etc/init.d/pandora_server start
|
|
||||||
|
|
||||||
Pandora Web Console
|
|
||||||
~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
The only file you need to modify is include/config.php, where the following variables are included in .php code:
|
|
||||||
$dbname="pandora"; // name of database for pandora (default: pandora)
|
|
||||||
$dbuser="pandora"; // mysql user to access pandora database
|
|
||||||
$dbpassword="pandora"; // Password for mysql user to access pandora database
|
|
||||||
$dbhost="pandora"; // Hostname or IP where mySQL server runs
|
|
||||||
|
|
||||||
If database is defined and was correctly installed, you can now access:
|
|
||||||
http://<hostname_pandora_webconsole>:<port>/<installation_directory>/index.php
|
|
||||||
|
|
||||||
The first time you log there is a default admin user "admin" and password "pandora". It's worth to say that you MUST CHANGE CREDENTIALS BEFORE LOGIN FIRST TIME, change it or create another account, disabling this one.
|
|
||||||
|
|
||||||
Pandora Agents for Unix
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
There are two configuration files:
|
|
||||||
pandora_agent.conf
|
|
||||||
pandora_user.conf (only in Unix)
|
|
||||||
|
|
||||||
Pandora Agents use pandora_agent.conf to load initial data and load module data. Modules are atomic source of information. Please refer to Pandora Agents Configuration v1.1 file or Agents configuration - Quick Guide for more information.
|
|
||||||
|
|
||||||
pandora_user.conf is low level configuration. It will be executed in each iteration of pandora_agent.sh script. Please read it and see how it works.
|
|
||||||
|
|
||||||
There are one or more daemon scripts to load pandora_agent.sh at boot time. It depends on what type of Unix are you running. One of them is pandora_agent_daemon_generic which is a "supposed" multiplattform sh script to start/stop pandora_agent script. Rename it by /etc/init.d/pandora_agent and test it before including it your init level script directory.
|
|
||||||
|
|
||||||
SNMP Troubleshooting
|
|
||||||
====================
|
|
||||||
|
|
||||||
You need to install libsnmp-perl package (debian name) to use SNMP Network Agents.
|
|
||||||
|
|
||||||
On PERL code for Pandora Server:
|
|
||||||
|
|
||||||
If problems occur there are number areas to look at to narrow down the possibilities.
|
|
||||||
The first step should be to test the UCD SNMP installation independently from the Perl5 SNMP interface.
|
|
||||||
Try running the apps from the UCD SNMP distribution, this means: try to exec manually snmpget in the Pandora Network Server. Try for example:
|
|
||||||
|
|
||||||
snmpget -v 1 -c public 192.168.5.1 SNMPv2-MIB::sysName.0
|
|
||||||
bash: snmpget: command not found
|
|
||||||
|
|
||||||
Houston, you've a problem with snmpget :-). Fix it before launch pandora network server.
|
|
||||||
|
|
||||||
Make sure your agent (snmpd) is running and properly configured with read-write access for the community you are using.
|
|
||||||
Ensure that your MIBs are installed and enviroment variables are set appropriately (see man mib_api)
|
|
||||||
Be sure to remove old ucd-snmp installations and ensure headers and libraries from old CMU installations are not being used by mistake.
|
|
||||||
|
|
||||||
If the problem occurs during compilation/linking check that the snmp library being linked is actually the UCD SNMP library (there have been name conflicts with existing snmp libs).
|
|
||||||
Also check that the header files are correct and up to date.
|
|
||||||
Sometimes compiling the UCD SNMP library with 'position-independent-code' enabled is required (HPUX specifically).
|
|
||||||
|
|
||||||
Network Agent: ICMP Latency
|
|
||||||
===========================
|
|
||||||
|
|
||||||
This module only works if Network Server component its executed under root privileges due limitations of Net::Ping perl library. You can run Network Server using an user without admin privileges but you cannot use ICMP Data / Latency module, but ICMP Proc it's usable using any user because other perl library it's used in this case.
|
|
||||||
|
|
||||||
Network Agent: UDP
|
|
||||||
==================
|
|
||||||
|
|
||||||
This module only works if Network Server component its executed under root privileges due limitations of Net::Ping perl library.
|
|
||||||
|
|
||||||
Network Agent chat
|
|
||||||
==================
|
|
||||||
|
|
||||||
Its possible to send data to remote TCP ports in Network Agents, you can use "^M" macro to replace \r\n (Return Carriage and Line Feed), for example, to use a simple http request: "GET / HTTP/1.0^M^M".
|
|
||||||
|
|
||||||
remote_tcp_proc moduletype allows you to "expect" a string (rcv data). If this string is matched in any place of the answer, value will be 1 (OK), if not, 0 (BAD).
|
|
||||||
|
|
||||||
Network SNMP Agent
|
|
||||||
==================
|
|
||||||
|
|
||||||
SNMP OID MUST be provided in dotted format, p.e:
|
|
||||||
|
|
||||||
IF-MIB::ifInOctets.6 -> .1.3.6.1.2.1.2.2.1.16.6
|
|
||||||
|
|
||||||
SNMPv2-MIB::sysUpTime -> .1.3.6.1.2.1.1.3
|
|
|
@ -1,41 +0,0 @@
|
||||||
Pandora: The Free Distributed Monitoring System
|
|
||||||
===============================================
|
|
||||||
|
|
||||||
Version 1.2
|
|
||||||
|
|
||||||
What is Pandora DMS
|
|
||||||
-------------------
|
|
||||||
|
|
||||||
Pandora are a Free Software set of programs that allows to analyze in a visual way status and performance of several parameters from different Operating Systems, servers, applications and hardware systems as Firewalls, Proxies, Data Bases, Web Servers or Routers. All integrated into an open and distributed architecture.
|
|
||||||
|
|
||||||
Pandora can be deployed in every Operating System. You have an agent for every platform. Pandora can monitor hardware systems with TCP/IP Stack, as load balancers, routers, switches, printers and so on.
|
|
||||||
|
|
||||||
Pandora has six components: Pandora Data Server, Pandora Network Server, Pandora SNMP Console, Pandora Agents, Pandora Database and Pandora Web Management System (Web Console).
|
|
||||||
|
|
||||||
Pandora Servers and SNMP Console
|
|
||||||
|
|
||||||
They are the recipient of bundles of information and the generators of alerts; they are the brain of the system. We can have several servers for very big systems or a single server. They are developed in Perl and works under any platform, with the required modules. Nevertheless its "official" platform is GNU/Linux. They also insert the gathered data into the Database. You can have several Pandora Servers connected with the same Database.
|
|
||||||
|
|
||||||
Pandora Web Console
|
|
||||||
|
|
||||||
It allows to manage the system and to operate with it; it's the user interface of Pandora. We can have several Web Consoles in the same implantation. It is developed in PHP and leans on a Data Base and a Web Server, being able to work in any platform: GNU/Linux, Solaris, Win2000, AIX and others.
|
|
||||||
|
|
||||||
Pandora Database
|
|
||||||
|
|
||||||
Core module of Pandora (as you can see in the architecture overview). In this database resides all the information of the enterprise, for example, all data gathered by agents, all configuration defined by administrator, all events, incidents, audit info... At this moment, only MySQL DataBase is supported. More Databases in the future.
|
|
||||||
|
|
||||||
Pandora Agents
|
|
||||||
|
|
||||||
They can monitor any numeric parameter, boolean states, strings or numerical incremental data and/or condition. They have a centralized architecture based on lightweight design for agents (shellscript, wsh, perl) and light agents to collect data. They support all type of platforms (Microsoft, AIX, Solaris, GNU/Linux, IPSO, FreeBSD, etc) because the agents are completely free software, and they communicate using SSH, FTP, NFS or other good way, using an XML container to transport data.
|
|
||||||
|
|
||||||
What do I need?
|
|
||||||
---------------
|
|
||||||
Perl, Perl Modules, MySQL, PHP, PHP Modules. See the Installation Documentation or go to http://pandora.sourceforge.net
|
|
||||||
|
|
||||||
License
|
|
||||||
-------
|
|
||||||
|
|
||||||
The project is distributed under the GPL License v2 or later.
|
|
||||||
|
|
||||||
Copyright (C) 2004-2006 Sancho Lerena.
|
|
||||||
|
|
|
@ -298,6 +298,7 @@ sub pandora_loadconfig {
|
||||||
|
|
||||||
logger ($pa_config, "Error connecting database in init Phase. Aborting startup.",0);
|
logger ($pa_config, "Error connecting database in init Phase. Aborting startup.",0);
|
||||||
print (" [E] Error connecting database in init Phase. Aborting startup. \n\n");
|
print (" [E] Error connecting database in init Phase. Aborting startup. \n\n");
|
||||||
|
print $@;
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
print " [*] Pandora FMS Server [".$pa_config->{'servername'}.$pa_config->{"servermode"}."] is running and operative \n";
|
print " [*] Pandora FMS Server [".$pa_config->{'servername'}.$pa_config->{"servermode"}."] is running and operative \n";
|
||||||
|
@ -307,7 +308,7 @@ sub pandora_loadconfig {
|
||||||
# Dump all errors to errorlog
|
# Dump all errors to errorlog
|
||||||
# DISABLED in DEBUGMODE
|
# DISABLED in DEBUGMODE
|
||||||
# ENABLE FOR PRODUCTION
|
# ENABLE FOR PRODUCTION
|
||||||
#open STDERR, ">>$pa_config->{'errorlogfile'}" or die "Can't write to Errorlog : $!";
|
open STDERR, ">>$pa_config->{'errorlogfile'}" or die "Can't write to Errorlog : $!";
|
||||||
}
|
}
|
||||||
|
|
||||||
# End of function declaration
|
# End of function declaration
|
||||||
|
|
|
@ -1,416 +0,0 @@
|
||||||
package PandoraFMS::PingExternal;
|
|
||||||
|
|
||||||
# Repackaged to "PandoraFMS::PingExternal" due to problems find RPM packages for Net::Ping::External
|
|
||||||
|
|
||||||
# Author: Colin McMillen (colinm@cpan.org)
|
|
||||||
# See also the CREDITS section in the POD below.
|
|
||||||
#
|
|
||||||
# Copyright (c) 2003 Colin McMillen. All rights reserved. This
|
|
||||||
# program is free software; you may redistribute it and/or modify it
|
|
||||||
# under the same terms as Perl itself.
|
|
||||||
|
|
||||||
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
|
|
||||||
use Carp;
|
|
||||||
use Socket qw(inet_ntoa);
|
|
||||||
require Exporter;
|
|
||||||
|
|
||||||
$VERSION = "0.11";
|
|
||||||
|
|
||||||
our @ISA = ("Exporter");
|
|
||||||
our %EXPORT_TAGS = ( 'all' => [ qw( ) ] );
|
|
||||||
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
|
|
||||||
our @EXPORT = qw(ping);
|
|
||||||
|
|
||||||
sub ping {
|
|
||||||
# Set up defaults & override defaults with parameters sent.
|
|
||||||
my %args = (count => 1, size => 56, @_);
|
|
||||||
|
|
||||||
# "host" and "hostname" are synonyms.
|
|
||||||
$args{host} = $args{hostname} if defined $args{hostname};
|
|
||||||
|
|
||||||
# If we have an "ip" argument, convert it to a hostname and use that.
|
|
||||||
$args{host} = inet_ntoa($args{ip}) if defined $args{ip};
|
|
||||||
|
|
||||||
# croak() if no hostname was provided.
|
|
||||||
croak("You must provide a hostname") unless defined $args{host};
|
|
||||||
$args{timeout} = 5 unless defined $args{timeout} && $args{timeout} > 0;
|
|
||||||
|
|
||||||
my %dispatch =
|
|
||||||
(linux => \&_ping_linux,
|
|
||||||
mswin32 => \&_ping_win32,
|
|
||||||
cygwin => \&_ping_win32,
|
|
||||||
solaris => \&_ping_solaris,
|
|
||||||
bsdos => \&_ping_bsdos,
|
|
||||||
beos => \&_ping_beos,
|
|
||||||
hpux => \&_ping_hpux,
|
|
||||||
dec_osf => \&_ping_dec_osf,
|
|
||||||
bsd => \&_ping_bsd,
|
|
||||||
darwin => \&_ping_darwin,
|
|
||||||
openbsd => \&_ping_unix,
|
|
||||||
freebsd => \&_ping_freebsd,
|
|
||||||
next => \&_ping_next,
|
|
||||||
unicosmk => \&_ping_unicosmk,
|
|
||||||
netbsd => \&_ping_unix,
|
|
||||||
irix => \&_ping_unix,
|
|
||||||
aix => \&_ping_aix,
|
|
||||||
);
|
|
||||||
|
|
||||||
my $subref = $dispatch{lc $^O};
|
|
||||||
|
|
||||||
croak("External ping not supported on your system") unless $subref;
|
|
||||||
|
|
||||||
return $subref->(%args);
|
|
||||||
}
|
|
||||||
|
|
||||||
# Win32 is the only system so far for which we actually need to parse the
|
|
||||||
# results of the system ping command.
|
|
||||||
sub _ping_win32 {
|
|
||||||
my %args = @_;
|
|
||||||
$args{timeout} *= 1000; # Win32 ping timeout is specified in milliseconds
|
|
||||||
my $command = "ping -l $args{size} -n $args{count} -w $args{timeout} $args{host}";
|
|
||||||
print "$command\n" if $DEBUG;
|
|
||||||
my $result = `$command`;
|
|
||||||
return 1 if $result =~ /time.*ms/;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Generic subroutine to handle pinging using the system() function. Generally,
|
|
||||||
# UNIX-like systems return 0 on a successful ping and something else on
|
|
||||||
# failure. If the return value of running $command is equal to the value
|
|
||||||
# specified as $success, the ping succeeds. Otherwise, it fails.
|
|
||||||
sub _ping_system {
|
|
||||||
my ($command, # The ping command to run
|
|
||||||
$success, # What value the system ping command returns on success
|
|
||||||
) = @_;
|
|
||||||
my $devnull = "/dev/null";
|
|
||||||
$command .= " 1>$devnull 2>$devnull";
|
|
||||||
my $exit_status = system($command) >> 8;
|
|
||||||
return 1 if $exit_status == $success;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Below are all the systems on which _ping_system() has been tested
|
|
||||||
# and found OK.
|
|
||||||
|
|
||||||
# Mac OS X 10.2 ping does not handle -w timeout now does it return a
|
|
||||||
# status code if it fails to ping (unless it cannot resolve the domain
|
|
||||||
# name)
|
|
||||||
# Thanks to Peter N. Lewis for this one.
|
|
||||||
sub _ping_darwin {
|
|
||||||
my %args = @_;
|
|
||||||
my $command = "ping -s $args{size} -c $args{count} $args{host}";
|
|
||||||
my $devnull = "/dev/null";
|
|
||||||
$command .= " 2>$devnull";
|
|
||||||
print "$command\n" if $DEBUG;
|
|
||||||
my $result = `$command`;
|
|
||||||
return 1 if $result =~ /(\d+) packets received/ && $1 > 0;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Assumed OK for DEC OSF
|
|
||||||
sub _ping_dec_osf {
|
|
||||||
my %args = @_;
|
|
||||||
my $command = "ping -c $args{count} -s $args{size} -q -u $args{host}";
|
|
||||||
return _ping_system($command, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
# Assumed OK for unicosmk
|
|
||||||
sub _ping_unicosmk {
|
|
||||||
my %args = @_;
|
|
||||||
my $command = "ping -s $args{size} -c $args{count} $args{host}";
|
|
||||||
return _ping_system($command, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
# NeXTStep 3.3/sparc
|
|
||||||
sub _ping_next {
|
|
||||||
my %args = @_;
|
|
||||||
my $command = "ping $args{host} $args{size} $args{count}";
|
|
||||||
return _ping_system($command, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
# Assumed OK for HP-UX.
|
|
||||||
sub _ping_hpux {
|
|
||||||
my %args = @_;
|
|
||||||
my $command = "ping $args{host} $args{size} $args{count}";
|
|
||||||
return _ping_system($command, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
# Assumed OK for BSD/OS 4.
|
|
||||||
sub _ping_bsdos {
|
|
||||||
my %args = @_;
|
|
||||||
my $command = "ping -c $args{count} -s $args{size} $args{host}";
|
|
||||||
return _ping_system($command, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
# Assumed OK for BeOS.
|
|
||||||
sub _ping_beos {
|
|
||||||
my %args = @_;
|
|
||||||
my $command = "ping -c $args{count} -s $args{size} $args{host}";
|
|
||||||
return _ping_system($command, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
# Assumed OK for AIX
|
|
||||||
sub _ping_aix {
|
|
||||||
my %args = @_;
|
|
||||||
my $command = "ping -c $args{count} -s $args{size} -q $args{host}";
|
|
||||||
return _ping_system($command, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
# OpenBSD 2.7 OK, IRIX 6.5 OK
|
|
||||||
# Assumed OK for NetBSD & FreeBSD, but needs testing
|
|
||||||
sub _ping_unix {
|
|
||||||
my %args = @_;
|
|
||||||
my $command = "ping -s $args{size} -c $args{count} -w $args{timeout} $args{host}";
|
|
||||||
return _ping_system($command, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
# Assumed OK for FreeBSD 3.4
|
|
||||||
# -s size option supported -- superuser only... fixme
|
|
||||||
sub _ping_bsd {
|
|
||||||
my %args = @_;
|
|
||||||
my $command = "ping -c $args{count} -q $args{hostname}";
|
|
||||||
return _ping_system($command, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
# Debian 2.2 OK, RedHat 6.2 OK
|
|
||||||
# -s size option available to superuser... FIXME?
|
|
||||||
sub _ping_linux {
|
|
||||||
my %args = @_;
|
|
||||||
my $command = "ping -c $args{count} $args{host}";
|
|
||||||
return _ping_system($command, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
# Solaris 2.6, 2.7 OK
|
|
||||||
sub _ping_solaris {
|
|
||||||
my %args = @_;
|
|
||||||
my $command = "ping -s $args{host} $args{size} $args{timeout}";
|
|
||||||
return _ping_system($command, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
# FreeBSD. Tested OK for Freebsd 4.3
|
|
||||||
# -s size option supported -- superuser only... FIXME?
|
|
||||||
# -w timeout option for BSD replaced by -t
|
|
||||||
sub _ping_freebsd {
|
|
||||||
my %args = @_;
|
|
||||||
my $command = "ping -c $args{count} -t $args{timeout} $args{host}";
|
|
||||||
return _ping_system($command, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
1;
|
|
||||||
|
|
||||||
__END__
|
|
||||||
|
|
||||||
=head1 NAME
|
|
||||||
|
|
||||||
Net::Ping::External - Cross-platform interface to ICMP "ping" utilities
|
|
||||||
|
|
||||||
=head1 SYNOPSIS
|
|
||||||
|
|
||||||
In general:
|
|
||||||
|
|
||||||
use Net::Ping::External qw(ping);
|
|
||||||
ping(%options);
|
|
||||||
|
|
||||||
Some examples:
|
|
||||||
|
|
||||||
use Net::Ping::External qw(ping);
|
|
||||||
|
|
||||||
# Ping a single host
|
|
||||||
my $alive = ping(host => "127.0.0.1");
|
|
||||||
print "127.0.0.1 is online" if $alive;
|
|
||||||
|
|
||||||
# Or a list of hosts
|
|
||||||
my @hosts = qw(127.0.0.1 127.0.0.2 127.0.0.3 127.0.0.4);
|
|
||||||
my $num_alive = 0;
|
|
||||||
foreach (@hosts) {
|
|
||||||
$alive = ping(hostname => $_, timeout => 5);
|
|
||||||
print "$_ is alive!\n" if $alive;
|
|
||||||
$num_alive++;
|
|
||||||
}
|
|
||||||
print "$num_alive hosts are alive.\n";
|
|
||||||
|
|
||||||
# Using all the fancy options:
|
|
||||||
ping(hostname => "127.0.0.1", count => 5, size => 1024, timeout => 3);
|
|
||||||
|
|
||||||
=head1 DESCRIPTION
|
|
||||||
|
|
||||||
Net::Ping::External is a module which interfaces with the "ping" command
|
|
||||||
on many systems. It presently provides a single function, C<ping()>, that
|
|
||||||
takes in a hostname and (optionally) a timeout and returns true if the
|
|
||||||
host is alive, and false otherwise. Unless you have the ability (and
|
|
||||||
willingness) to run your scripts as the superuser on your system, this
|
|
||||||
module will probably provide more accurate results than Net::Ping will.
|
|
||||||
|
|
||||||
Why?
|
|
||||||
|
|
||||||
=over 4
|
|
||||||
|
|
||||||
=item *
|
|
||||||
|
|
||||||
ICMP ping is the most reliable way to tell whether a remote host is alive.
|
|
||||||
|
|
||||||
=item *
|
|
||||||
|
|
||||||
However, Net::Ping cannot use an ICMP ping unless you are running your
|
|
||||||
script with privileged (AKA "root") access.
|
|
||||||
|
|
||||||
=item *
|
|
||||||
|
|
||||||
The system's "ping" command uses ICMP and does not usually require
|
|
||||||
privileged access.
|
|
||||||
|
|
||||||
=item *
|
|
||||||
|
|
||||||
While it is relatively trivial to write a Perl script that parses the
|
|
||||||
output of the "ping" command on a given system, the aim of this module
|
|
||||||
is to encapsulate this functionality and provide a single interface for
|
|
||||||
it that works on many systems.
|
|
||||||
|
|
||||||
=back
|
|
||||||
|
|
||||||
=head2 ping() OPTIONS
|
|
||||||
|
|
||||||
This module is still "alpha"; it is expected that more options to the C<ping()>
|
|
||||||
function will be added soon.
|
|
||||||
|
|
||||||
=over 4
|
|
||||||
|
|
||||||
=item * C<host, hostname>
|
|
||||||
|
|
||||||
The hostname (or dotted-quad IP address) of the remote host you are trying
|
|
||||||
to ping. You must specify either the "hostname" option or the "ip" option.
|
|
||||||
|
|
||||||
"host" and "hostname" are synonymous.
|
|
||||||
|
|
||||||
=item * C<ip>
|
|
||||||
|
|
||||||
A packed bit-string representing the 4-byte packed IP address (as
|
|
||||||
returned by C<Socket.pm>'s C<inet_aton()> function) of the host that you
|
|
||||||
would like to ping.
|
|
||||||
|
|
||||||
=item * C<timeout>
|
|
||||||
|
|
||||||
The maximum amount of time, in seconds, that C<ping()> will wait for a response.
|
|
||||||
If the remote system does not respond before the timeout has elapsed, C<ping()>
|
|
||||||
will return false.
|
|
||||||
|
|
||||||
Default value: 5.
|
|
||||||
|
|
||||||
=item * C<count>
|
|
||||||
|
|
||||||
The number of ICMP ping packets to send to the remote host. Eventually,
|
|
||||||
Net::Ping::External will return the number of packets that were acknowledged
|
|
||||||
by the remote host; for now, however, C<ping()> still returns just true or false.
|
|
||||||
|
|
||||||
Default value: 1.
|
|
||||||
|
|
||||||
=item * C<size>
|
|
||||||
|
|
||||||
Specifies the number of data bytes to be sent. The default is
|
|
||||||
56, which translates into 64 ICMP data bytes when combined with
|
|
||||||
the 8 bytes of ICMP header data.
|
|
||||||
|
|
||||||
Default value: 56.
|
|
||||||
|
|
||||||
=back
|
|
||||||
|
|
||||||
=head2 SUPPORTED PLATFORMS
|
|
||||||
|
|
||||||
Support currently exists for interfacing with the standard ping
|
|
||||||
utilities on the following systems. Please note that the path to the `ping'
|
|
||||||
should be somewhere in your PATH environment variable (or your system's
|
|
||||||
closest equivalent thereof.) Otherwise, Net::Ping::External will be unable
|
|
||||||
to locate your system's `ping' command.
|
|
||||||
|
|
||||||
=over 4
|
|
||||||
|
|
||||||
=item * Win32
|
|
||||||
|
|
||||||
Tested OK on Win98. It should work on other Windows systems as well.
|
|
||||||
|
|
||||||
=item * Linux
|
|
||||||
|
|
||||||
Tested OK on Debian 2.2 and Redhat 6.2. It appears that different versions
|
|
||||||
of Linux use different versions of ping, which support different options.
|
|
||||||
Not sure how I'm going to resolve this yet; for now, all the options but
|
|
||||||
C<count> are disabled.
|
|
||||||
|
|
||||||
=item * BSD
|
|
||||||
|
|
||||||
Tested OK on OpenBSD 2.7. Needs testing for FreeBSD, NetBSD, and BSDi.
|
|
||||||
|
|
||||||
=item * Solaris
|
|
||||||
|
|
||||||
Tested OK on Solaris 2.6 and 2.7.
|
|
||||||
|
|
||||||
=item * IRIX
|
|
||||||
|
|
||||||
Tested OK on IRIX 6.5.
|
|
||||||
|
|
||||||
=item * AIX, DEC OSF, UNICOSMK, NeXTStep, HP-UX, BSD/OS (BSDi), BeOS
|
|
||||||
|
|
||||||
Support for these systems is integrated into this module but none have been
|
|
||||||
tested yet. If you have successful or unsuccessful test results for any of
|
|
||||||
these systems, please send them to me. On some of these systems, some of the
|
|
||||||
arguments may not be supported. If you'd like to see better support on your
|
|
||||||
system, please e-mail me.
|
|
||||||
|
|
||||||
=back
|
|
||||||
|
|
||||||
More systems will be added as soon as any users request them. If your
|
|
||||||
system is not currently supported, e-mail me; adding support to your
|
|
||||||
system is probably trivial.
|
|
||||||
|
|
||||||
|
|
||||||
=head1 BUGS
|
|
||||||
|
|
||||||
This module should be considered alpha. Bugs may exist. Although no
|
|
||||||
specific bugs are known at this time, the module could use testing
|
|
||||||
on a greater variety of systems.
|
|
||||||
|
|
||||||
See the warning below.
|
|
||||||
|
|
||||||
=head1 WARNING
|
|
||||||
|
|
||||||
This module calls whatever "ping" program it first finds in your PATH
|
|
||||||
environment variable. If your PATH contains a trojan "ping" program,
|
|
||||||
this module will call that program. This involves a small amount of
|
|
||||||
risk, but no more than simply typing "ping" at a system prompt.
|
|
||||||
|
|
||||||
Beware Greeks bearing gifts.
|
|
||||||
|
|
||||||
=head1 AUTHOR
|
|
||||||
|
|
||||||
Colin McMillen (colinm@cpan.org)
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the same terms as Perl itself.
|
|
||||||
|
|
||||||
=head1 CREDITS
|
|
||||||
|
|
||||||
Dan Moore contributed command-line options and code for NeXT, BeOS,
|
|
||||||
HP-UX, and BSD/OS.
|
|
||||||
|
|
||||||
Jarkko Hietaniemi contributed a huge list of command-line options and results
|
|
||||||
for the `ping' command on 9 different systems.
|
|
||||||
|
|
||||||
Randy Moore contributed several patches for Win32 support.
|
|
||||||
|
|
||||||
Marc-Andre Dumas contributed a patch for FreeBSD support.
|
|
||||||
|
|
||||||
Jonathan Stowe fixed a bug in 0.09 that prevented the module from
|
|
||||||
running on some systems.
|
|
||||||
|
|
||||||
Numerous people sent in a patch to fix a bug in 0.10 that broke ping on Windown systems.
|
|
||||||
|
|
||||||
Peter N. Lewis contributed a patch that works correctly on Mac OS X
|
|
||||||
10.2 (and hopefully other versions as well).
|
|
||||||
|
|
||||||
=head1 SEE ALSO
|
|
||||||
|
|
||||||
Net::Ping
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
while [ 1 ]
|
|
||||||
do
|
|
||||||
UNO=`ps aux | grep pandora_net | grep -v grep | awk '{ print $6 }'`
|
|
||||||
DOS=`ps aux | grep pandora_snmp | grep -v grep | awk '{ print $6 }'`
|
|
||||||
TRES=`ps aux | grep pandora_server.pl | grep -v grep | awk '{ print $6 }'`
|
|
||||||
|
|
||||||
TIMESTAMP=`date +"%Y/%m/%d %H:%M:%S"`
|
|
||||||
echo "Network: $UNO SNMP: $DOS Server $TRES"
|
|
||||||
echo "$TIMESTAMP Network: $UNO SNMP: $DOS Server $TRES" >> pandoramemtest.log
|
|
||||||
sleep 5
|
|
||||||
done
|
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
This small utility is make to test your database speed in Pandora Scheme.
|
|
||||||
|
|
||||||
You need to create an agent and assing modules for automated data injection with this tool. Name this modules acording this:
|
|
||||||
|
|
||||||
random - To generate "random" data.
|
|
||||||
curve - To generate a math curve using trigonometrical functions, useful to see interpolation working with different intervals, etc
|
|
||||||
boolean - Generate "random" boolean data.
|
|
||||||
|
|
|
@ -22,7 +22,8 @@ use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
|
||||||
use Date::Manip; # Needed to manipulate DateTime formats
|
use Date::Manip; # Needed to manipulate DateTime formats
|
||||||
# of input, output and compare
|
# of input, output and compare
|
||||||
|
use Net::Ping;
|
||||||
use Time::Local; # DateTime basic manipulation
|
use Time::Local; # DateTime basic manipulation
|
||||||
use NetAddr::IP; # To manage IP Addresses
|
use NetAddr::IP; # To manage IP Addresses
|
||||||
use POSIX; # to use ceil() function
|
use POSIX; # to use ceil() function
|
||||||
|
@ -33,12 +34,11 @@ use threads;
|
||||||
use PandoraFMS::Config;
|
use PandoraFMS::Config;
|
||||||
use PandoraFMS::Tools;
|
use PandoraFMS::Tools;
|
||||||
use PandoraFMS::DB;
|
use PandoraFMS::DB;
|
||||||
use PandoraFMS::PingExternal;
|
|
||||||
|
|
||||||
# FLUSH in each IO (only for debug, very slooow)
|
# FLUSH in each IO (only for debug, very slooow)
|
||||||
# ENABLED in DEBUGMODE
|
# ENABLED in DEBUGMODE
|
||||||
# DISABLE FOR PRODUCTION
|
# DISABLE FOR PRODUCTION
|
||||||
$| = 1;
|
$| = 0;
|
||||||
|
|
||||||
my %pa_config;
|
my %pa_config;
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ sub pandora_recon_subsystem {
|
||||||
logger ($pa_config, "Loop in Recon Module Subsystem", 10);
|
logger ($pa_config, "Loop in Recon Module Subsystem", 10);
|
||||||
$query_sql = "SELECT * FROM trecon_task WHERE id_network_server = $server_id AND status = -1";
|
$query_sql = "SELECT * FROM trecon_task WHERE id_network_server = $server_id AND status = -1";
|
||||||
$exec_sql = $dbh->prepare($query_sql);
|
$exec_sql = $dbh->prepare($query_sql);
|
||||||
$exec_sql ->execute;
|
$exec_sql->execute;
|
||||||
while (@sql_data = $exec_sql->fetchrow_array()) {
|
while (@sql_data = $exec_sql->fetchrow_array()) {
|
||||||
my $interval = $sql_data[11];
|
my $interval = $sql_data[11];
|
||||||
my $my_timestamp = &UnixDate("today","%Y-%m-%d %H:%M:%S");
|
my $my_timestamp = &UnixDate("today","%Y-%m-%d %H:%M:%S");
|
||||||
|
@ -117,8 +117,8 @@ sub pandora_recon_subsystem {
|
||||||
pandora_update_reconstatus ($pa_config, $dbh, $id_task, 0);
|
pandora_update_reconstatus ($pa_config, $dbh, $id_task, 0);
|
||||||
pandora_exec_task ($pa_config, $id_task);
|
pandora_exec_task ($pa_config, $id_task);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$exec_sql->finish();
|
$exec_sql->finish();
|
||||||
sleep($pa_config->{"server_threshold"});
|
sleep($pa_config->{"server_threshold"});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -216,22 +216,43 @@ sub pandora_exec_task {
|
||||||
pandora_task_set_utimestamp ($pa_config, $dbh, $id_task);
|
pandora_task_set_utimestamp ($pa_config, $dbh, $id_task);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# escaneo_icmp (destination, timeout) - Do a ICMP scan
|
# pandora_ping_icmp (destination, timeout) - Do a ICMP scan, 1 if alive, 0 if not
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
sub scan_icmp {
|
sub scan_icmp {
|
||||||
my $dest = $_[0];
|
my $dest = $_[0];
|
||||||
my $l_timeout = $_[1];
|
my $l_timeout = $_[1];
|
||||||
my $result = ping(hostname => $dest, timeout => $l_timeout, size => 32, count => 1);
|
# temporal vars.
|
||||||
if (!defined($result)){
|
my $result = 0;
|
||||||
return 0;
|
my $result2 = 0;
|
||||||
}
|
my $p;
|
||||||
if ($result) {
|
|
||||||
return 1;
|
# Check for valid destination
|
||||||
} else {
|
if (!defined($dest)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
# Some hosts don't accept ICMP with too small payload. Use 16 Bytes
|
||||||
|
$p = Net::Ping->new("icmp",$l_timeout,16);
|
||||||
|
$p->source_verify(1);
|
||||||
|
|
||||||
|
$result = $p->ping($dest);
|
||||||
|
$result2 = $p->ping($dest);
|
||||||
|
|
||||||
|
# Check for valid result
|
||||||
|
if ((!defined($result)) || (!defined($result2))) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Lets see the result
|
||||||
|
if (($result == 1) && ($result2 == 1)) {
|
||||||
|
$p->close();
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
$p->close();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
Traps de ejemplo
|
|
||||||
================
|
|
||||||
|
|
||||||
http://www.hn.edu.cn/book/NetWork/NetworkingBookshelf_2ndEd/snmp/
|
|
||||||
UCD-SNMP = NetSNMP, pruebas con las 5.1.2
|
|
||||||
|
|
||||||
GenericTrap 0 - Coldstart, 1 - Warmup, 2 - Linkdown, 3 - Linkup .... 6 - User defined
|
|
||||||
SpecificTrap 0 - Numerito ¿?
|
|
||||||
OID Identificador en la MIB
|
|
||||||
|
|
||||||
snmptrap -v 1 -c public 192.168.5.2 1.3.6.1.2.1.2.2.1.1 192.168.5.2 6 666 1233433
|
|
||||||
snmptrap -v 1 -c public 192.168.5.2 1.3.6.1.2.1.2.2.1.1 192.168.5.2 6 666 1233433 .1.3.6.1.2.1.2.2.1.1.6 i 234234234
|
|
||||||
snmptrap -v 1 -c public 192.168.5.2 .1.3.6.1.4.1.2789.2005 192.168.5.2 6 666 1233433 .1.3.6.1.4.1.2789.2005.1 s "Alcachofa"
|
|
||||||
|
|
||||||
snmptrapd -f -t -On -n -a -Lf logfile.txt -p pidfile -F "%02.2m/%02.2l/%y %02.2h:%02.2j:%02.2k %B %N %w %W %q %v \n"
|
|
||||||
|
|
||||||
(-f para no hacer fork del proceso)
|
|
||||||
(-t para no reflejar en syslog los traps)
|
|
||||||
(-n formato IP en hostnames)
|
|
||||||
(-a añadir al log, no sobreescribir)
|
|
||||||
|
|
||||||
Formato del log (salidas de ejemplo)
|
|
||||||
|
|
||||||
08/18/2005 03:01:14 192.168.5.2 .1.3.6.1.2.1.2.2.1.1 6 Enterprise Specific .666 .1.3.6.1.2.1.2.2.1.1.6 = INTEGER: 234234234
|
|
||||||
08/18/2005 03:02:37 192.168.5.2 .1.3.6.1.4.1.2789.2005 6 Enterprise Specific .666 .1.3.6.1.4.1.2789.2005.1 = STRING: "Alcachofa"
|
|
|
@ -1,340 +0,0 @@
|
||||||
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.
|
|
||||||
|
|
||||||
GNU GENERAL PUBLIC LICENSE
|
|
||||||
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
|
|
||||||
|
|
||||||
How to Apply These Terms to Your New Programs
|
|
||||||
|
|
||||||
If you develop a new program, and you want it to be of the greatest
|
|
||||||
possible use to the public, the best way to achieve this is to make it
|
|
||||||
free software which everyone can redistribute and change under these terms.
|
|
||||||
|
|
||||||
To do so, attach the following notices to the program. It is safest
|
|
||||||
to attach them to the start of each source file to most effectively
|
|
||||||
convey the exclusion of warranty; and each file should have at least
|
|
||||||
the "copyright" line and a pointer to where the full notice is found.
|
|
||||||
|
|
||||||
<one line to give the program's name and a brief idea of what it does.>
|
|
||||||
Copyright (C) <year> <name of author>
|
|
||||||
|
|
||||||
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 of the License, 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
|
|
||||||
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
|
||||||
|
|
||||||
If the program is interactive, make it output a short notice like this
|
|
||||||
when it starts in an interactive mode:
|
|
||||||
|
|
||||||
Gnomovision version 69, Copyright (C) year name of author
|
|
||||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
|
||||||
This is free software, and you are welcome to redistribute it
|
|
||||||
under certain conditions; type `show c' for details.
|
|
||||||
|
|
||||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
|
||||||
parts of the General Public License. Of course, the commands you use may
|
|
||||||
be called something other than `show w' and `show c'; they could even be
|
|
||||||
mouse-clicks or menu items--whatever suits your program.
|
|
||||||
|
|
||||||
You should also get your employer (if you work as a programmer) or your
|
|
||||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
|
||||||
necessary. Here is a sample; alter the names:
|
|
||||||
|
|
||||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
|
||||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
|
||||||
|
|
||||||
<signature of Ty Coon>, 1 April 1989
|
|
||||||
Ty Coon, President of Vice
|
|
||||||
|
|
||||||
This General Public License does not permit incorporating your program into
|
|
||||||
proprietary programs. If your program is a subroutine library, you may
|
|
||||||
consider it more useful to permit linking proprietary applications with the
|
|
||||||
library. If this is what you want to do, use the GNU Library General
|
|
||||||
Public License instead of this License.
|
|
|
@ -1,25 +0,0 @@
|
||||||
Pandora Agent Licence.
|
|
||||||
----------------------
|
|
||||||
|
|
||||||
Pandora is under protection of GPL Licence, you can read in gpl.LICENCE file in this package.
|
|
||||||
|
|
||||||
Terms of Use
|
|
||||||
------------
|
|
||||||
|
|
||||||
This software is provided "as is", without any guarantee made
|
|
||||||
as to its suitability or fitness for any particular use. It may
|
|
||||||
contain bugs, so use of this tool is at your own risk. We take
|
|
||||||
no responsilbity for any damage that may unintentionally be caused
|
|
||||||
through its use.
|
|
||||||
|
|
||||||
You may not distribute any of the Pandora Agent components without the express written permission of Sancho Lerena. If you are interested in licensing this tool for redistribution, or for licensing the source code
|
|
||||||
for inclusion in a commercial product, send contact slerena@sourceforge.net
|
|
||||||
|
|
||||||
Reporting Problems
|
|
||||||
------------------
|
|
||||||
|
|
||||||
If you encounter problems, please visit pandoramon.sourceforge.net
|
|
||||||
and download the latest version to see if the issue has been resolved.
|
|
||||||
If not, please send a bug report to:
|
|
||||||
|
|
||||||
http://sourceforge.net/tracker/?group_id=155200&atid=794852
|
|
|
@ -1,43 +0,0 @@
|
||||||
<?PHP
|
|
||||||
|
|
||||||
// Babel - The Free Distributed Auditing System
|
|
||||||
// (c) Artica Soluciones Tecnologicas S.L, 2005-2006
|
|
||||||
// (c) Sancho Lerena 2006
|
|
||||||
//
|
|
||||||
// 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
|
|
||||||
// of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
// NOT FUNCTIONAL YET
|
|
||||||
|
|
||||||
$target_agents = 500;
|
|
||||||
$target_modules = 20;
|
|
||||||
|
|
||||||
|
|
||||||
$dbname="pandora"; // MySQL DataBase
|
|
||||||
$dbuser="pandora"; // DB User
|
|
||||||
$dbpassword="pandora"; // Password
|
|
||||||
$dbhost="localhost"; // MySQL Host
|
|
||||||
if (! mysql_connect($dbhost,$dbuser,$dbpassword)){
|
|
||||||
exit ('ERROR');
|
|
||||||
}
|
|
||||||
|
|
||||||
mysql_select_db("pandora");
|
|
||||||
for ($a=0; $a < $target_agents; $a++){
|
|
||||||
$id = $a+100;
|
|
||||||
$sql1="INSERT INTO tagente (id_agente, nombre) values ( $id, '$a' )";
|
|
||||||
echo $sql1;
|
|
||||||
mysql_query($sql1);
|
|
||||||
for ($b=0; $b < $target_modules; $b++){
|
|
||||||
if ($b > 5)
|
|
||||||
$sql2="INSERT INTO tagente_modulo (id_agente, nombre, descripcion, id_tipo_modulo) values ( $id, 'random_$b','random_$bdesc', 1 )";
|
|
||||||
else
|
|
||||||
$sql2="INSERT INTO tagente_modulo (id_agente, nombre, descripcion, id_tipo_modulo) values ( $id, 'curve_$b','curve_$bdesc', 1 )";
|
|
||||||
echo $sql2;
|
|
||||||
mysql_query($sql2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
|
|
@ -1,42 +0,0 @@
|
||||||
<?PHP
|
|
||||||
|
|
||||||
// (c) 2007, Sancho Lerena <slerena@openideas.info>
|
|
||||||
//
|
|
||||||
// Generador de modulos de tipo ICMP: Proc y Data para Pandora FMS 1.3
|
|
||||||
// Toma como parametros (definidos en el codigo), el id_agente y el fichero de
|
|
||||||
// entrada con una IP por linea
|
|
||||||
|
|
||||||
$id_agente = 1; // id del agente sobre los que colgar los modulos de PING
|
|
||||||
$id_tipo_proc = 6; // Icmp proc
|
|
||||||
$id_tipo_data = 7; // Icmp latency
|
|
||||||
$filename = "lista_ip.txt";
|
|
||||||
|
|
||||||
$dbname="pandora"; // MySQL DataBase
|
|
||||||
$dbuser="pandora"; // DB User
|
|
||||||
$dbpassword="pandora"; // Password
|
|
||||||
$dbhost="localhost"; // MySQL Host
|
|
||||||
if (! mysql_connect($dbhost,$dbuser,$dbpassword)){
|
|
||||||
exit ('No conecto al MySQL');
|
|
||||||
}
|
|
||||||
mysql_select_db("pandora");
|
|
||||||
|
|
||||||
if (! file_exists($filename))
|
|
||||||
exit ( "No encuentro $filename");
|
|
||||||
|
|
||||||
$fichero = fopen($filename,"r");
|
|
||||||
|
|
||||||
$ip = "";
|
|
||||||
echo "Let's go: ";
|
|
||||||
|
|
||||||
while (!feof($fichero)){
|
|
||||||
$ip = fgets($fichero); // Strip \n
|
|
||||||
$ip = substr($ip,0,strlen($ip)-1);
|
|
||||||
$sql2="INSERT INTO tagente_modulo (id_agente, nombre, descripcion, id_tipo_modulo, ip_target) values ( $id_agente, '$ip (D)','ICMP Alive', $id_tipo_proc , '$ip')";
|
|
||||||
mysql_query($sql2);
|
|
||||||
|
|
||||||
$sql2="INSERT INTO tagente_modulo (id_agente, nombre, descripcion, id_tipo_modulo. ip_target) values ( $id_agente, '$ip (P)','ICMP Latency', $id_tipo_data , '$ip')";
|
|
||||||
mysql_query($sql2);
|
|
||||||
echo ".";
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue