Merge remote-tracking branch 'github/develop' into develop
This commit is contained in:
commit
2a423186ac
28
README.md
28
README.md
|
@ -6,37 +6,43 @@ With more than 50,000 customer installations across the five continents, Pandora
|
|||
|
||||
Pandora FMS gives you the agility to find and solve problems quickly, scaling them so they can be derived from any source, on-premise, multi cloud or both of them mixed. Now you have that capability across your entire IT stack and analytics to find any problem, even the ones that are hard to find.
|
||||
|
||||
Thanks to more than 500 plugins available, you can control and manage any application and technology, from SAP, Oracle, Lotus, Citrix or Jboss to VMware, AWS, SQL Server, Redhat, Websphere, etc.
|
||||
|
||||
### Support
|
||||
|
||||
For community support you can visit our forums at https://pandorafms.com/community/ and if you need commercial information or/and professional support visit https://pandorafms.com
|
||||
For community support you can visit our forums at https://pandorafms.com/community/
|
||||
|
||||
Pandora FMS has a "commercial" solution, with different features, oriented to companies that do not want to spend time using open source solutions, but closed packaged products, with periodic updates and professional support. Its name is Pandora FMS Enterprise, and you can find more information about it at https://pandorafms.com.
|
||||
|
||||
### How to install Pandora FMS
|
||||
|
||||
Installing Pandora FMS is a very easy task. Please visit our wiki and follow all the steps described for a quick and proper installation. https://pandorafms.com/manual/en/documentation/02_installation/01_installing
|
||||
Installing Pandora FMS from sources is a complex task. Please visit our wiki and follow all the steps described for a proper installation. https://pandorafms.com/manual/
|
||||
|
||||
### What is Pandora FMS?
|
||||
|
||||
Pandora FMS is a monitoring application to watch systems and applications that allows to know the status of any element of the business systems. Pandora FMS watches your hardware, software, your multilayer system and, of course, your OS. Pandora FMS can detect if a network interface is down or the movement of any NASDAQ new technology market value. If you wish, Pandora FMS can send a SMS message when your system or your application fails or when Google stock value drops below 330 US\$. Pandora FMS will fit your systems and requirements, because it has been designed to be open, modular, multiplattform and easy to customize.
|
||||
Pandora FMS is an open source monitoring application whose origin dates back to 2004. It integrates in the same application the monitoring of different infrastructure elements: networks, applications, servers, web, and other specific data sources such as logs, WMI, Netflow or SNMP traps.
|
||||
|
||||
### Other things Pandora FMS can do
|
||||
It allows you to supervise systems and applications of all types, through remote monitoring or with software agents installed on the equipment to be monitored.
|
||||
|
||||
Pandora FMS is a monitoring tool that not only measures if a parameter is right or wrong. Pandora FMS can quantify the state (right or wrong), or store a value (numeric or alphanumeric) for months if necessary. Pandora FMS can measure performances, compare values among different systems and set alarms over thresholds. Pandora FMS works against a Database so it can generate reports, statistics, SLA and meausre anything: OS, applications and hardware systems, such as firewalls, proxies, Databases, web servers, VPN, routers, switches, processes, services, [remote accesses to servers](https://pandorafms.com/server-monitoring/), etc. Everything integrated in an open and distributed architecture. Pandora FMS can be deployed over any OS, with specific agents for each platform. There are agents for Windows (2000, XP, 2003), GNU/Linux, Solaris, HP-UX, BSD, AIX, IPSO and OpenWRT. Pandora FMS not only gathers information through its agents, but it can also monitor any hardware system with TCP/IP connectivity, such as load balancing systems, routers, switches or printers, through SNMP and TCP/ICMP checks.
|
||||
Pandora FMS monitors your hardware, software, your multilayer system and, of course, your operating system. Pandora FMS can detect if a network interface is down or the movement of the market value of any new NASDAQ technology. If desired, Pandora FMS can send an SMS message when your system or application fails or when the value of Tesla's stock drops below $180. Pandora FMS will adapt to your systems and requirements, because it has been designed to be open, modular, multiplatform and easy to customize.
|
||||
|
||||
Pandora FMS can be deployed over any OS, with specific agents for each platform. There are agents for Windows (2000, XP, 2003), GNU/Linux, Solaris, HP-UX, BSD, AIX, IPSO and OpenWRT. Pandora FMS not only gathers information through its agents, but it can also monitor any hardware system with TCP/IP connectivity, such as load balancing systems, routers, switches or printers, through SNMP and TCP/ICMP checks.
|
||||
|
||||
Pandora FMS is a monitoring tool that not only measures if a parameter is right or wrong. Pandora FMS can quantify the state (right or wrong), or store a value (numeric or alphanumeric) for months if necessary. Pandora FMS can measure performances, compare values among different systems and set alarms over thresholds. Pandora FMS works against a MySQL Database so it can generate reports, statistics, SLA and measure anything.
|
||||
|
||||
### Main features
|
||||
|
||||
- Network monitoring
|
||||
- WMI monitoring
|
||||
- Agent monitoring (for all OS)
|
||||
- Graphical reporting, based on it's own SQL backend
|
||||
- Server monitoring (using agents for Windows, Linux, Mac, BSD and legacy Unix)
|
||||
- SSH/WMI remote monitorin.
|
||||
- Graphical reporting, based on SQL backend
|
||||
- SLA, and ITIL KPI metrics on reporting
|
||||
- Status & Performance monitoring
|
||||
- GIS tracking and viewing
|
||||
- Inventory management (Local and remote)
|
||||
- Netflow support
|
||||
- Centralized log collection.
|
||||
- User defined visual console screens and Dashboards WYSIWYG
|
||||
- Very high capacity (Thousands of devices)
|
||||
- Multiuser, several levels of ACL management.
|
||||
- Multitenant, several levels of ACL management.
|
||||
|
||||
### Screenshots
|
||||
|
||||
|
|
BIN
extras/bin/gotty
BIN
extras/bin/gotty
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,33 +0,0 @@
|
|||
###########################################
|
||||
### SMTP DATA
|
||||
###########################################
|
||||
|
||||
smtp_user devtest@artica.es
|
||||
smtp_pass pass1212
|
||||
smtp_hostname mail.artica.es
|
||||
|
||||
###########################################
|
||||
### POP3 DATA
|
||||
###########################################
|
||||
|
||||
pop3_user devtest@artica.es
|
||||
pop3_pass pass1212
|
||||
pop3_hostname mail.artica.es
|
||||
|
||||
# Enable or disable SSL. 1 means Enabled, 0 Disabled
|
||||
pop3_ssl 0
|
||||
|
||||
# SSL port
|
||||
pop3_ssl_port 995
|
||||
|
||||
###########################################
|
||||
### TO SEND INFO
|
||||
###########################################
|
||||
# Email receiver where to send the email
|
||||
receiver_email devtest@artica.es
|
||||
|
||||
###########################################
|
||||
### PATH TO SAVE THE ATTACHED FILE
|
||||
###########################################
|
||||
# Desired path where the attached file will be stored
|
||||
pathtosave /tmp/
|
|
@ -1,318 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
##########################################################################
|
||||
# Pandora FMS Mail Transfer
|
||||
# This is a tool for transfering Pandora FMS data files by mail (SMTP/POP)
|
||||
##########################################################################
|
||||
# Copyright (c) 2011-2023 Pandora FMS
|
||||
#
|
||||
# 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.
|
||||
##########################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Net::SMTP;
|
||||
use Mail::POP3Client;
|
||||
use MIME::Parser;
|
||||
$| = 1;
|
||||
|
||||
# GLOBAL VARIABLES
|
||||
|
||||
my $boundary='frontier';
|
||||
|
||||
####### FUNCTIONS #######
|
||||
|
||||
########################################################################
|
||||
## SUB check_args
|
||||
## Checks the command line arguments given at the function call.
|
||||
########################################################################
|
||||
sub check_args(){
|
||||
my $num_args = $#ARGV + 1;
|
||||
my $action = $ARGV[0];
|
||||
my $conf_file = $ARGV[1];
|
||||
my $filename = $ARGV[2];
|
||||
my $error = "Usage: mail_transfer.pl {send|receive conf_file [FILE]}\n";
|
||||
my $error_conf_file = "conf_file does not exist or is not readable\n";
|
||||
my $error_filename = "File to send does not exist or is not readable\n";
|
||||
|
||||
if (($num_args < 2) || (($action ne "send") && ($action ne "receive"))) {
|
||||
die $error;
|
||||
} elsif ((!(-e $conf_file)) || (!(-r $conf_file))) {
|
||||
die $error_conf_file;
|
||||
} elsif (($action eq "send") && ((!(-e $filename)) || (!(-r $filename)))) {
|
||||
die $error_filename;
|
||||
}
|
||||
}
|
||||
|
||||
########################################################################
|
||||
## SUB parse_conf
|
||||
## Reads the entire conf file and stores all the information given
|
||||
########################################################################
|
||||
sub parse_conf ($$) {
|
||||
|
||||
my $conf_file = $_[0];
|
||||
my $conf_hash = $_[1];
|
||||
|
||||
open (CONF, $conf_file);
|
||||
my $line;
|
||||
|
||||
while (<CONF>)
|
||||
{
|
||||
$line = $_;
|
||||
# Get the smtp user
|
||||
if ($line =~ /^smtp_user\s([a-zA-Z0-9\.\_\-\@]+)/) {
|
||||
$conf_hash -> {smtp_user} = $1;
|
||||
}
|
||||
# Get the smtp pass
|
||||
elsif ($line =~ /^smtp_pass\s(.+)/) {
|
||||
$conf_hash -> {smtp_pass} = $1;
|
||||
}
|
||||
# Get the smtp hostname
|
||||
elsif ($line =~ /^smtp_hostname\s([a-zA-Z0-9\.\_\-\@]+)/) {
|
||||
$conf_hash -> {smtp_hostname} = $1;
|
||||
}
|
||||
# Get the pop3 user
|
||||
elsif ($line =~ /^pop3_user\s([a-zA-Z0-9\.\_\-\@]+)/) {
|
||||
$conf_hash -> {pop3_user} = $1;
|
||||
}
|
||||
# Get the pop3 pass
|
||||
elsif ($line =~ /^pop3_pass\s(.+)/) {
|
||||
$conf_hash -> {pop3_pass} = $1;
|
||||
}
|
||||
# Get the pop3 hostname
|
||||
elsif ($line =~ /^pop3_hostname\s([a-zA-Z0-9\.\_\-\@]+)/) {
|
||||
$conf_hash -> {pop3_hostname} = $1;
|
||||
}
|
||||
# Get the pop3 ssl flag to know if it's enabled or not
|
||||
elsif ($line =~ /^pop3_ssl\s(0|1)/) {
|
||||
$conf_hash -> {pop3_ssl} = $1;
|
||||
}
|
||||
# Get the pop3 ssl port
|
||||
elsif ($line =~ /^pop3_ssl_port\s([0-9]{1,5})/) {
|
||||
$conf_hash -> {pop3_ssl_port} = $1;
|
||||
}
|
||||
# Get the path where to save the attached file
|
||||
elsif ($line =~ /^pathtosave\s(.+)/) {
|
||||
$conf_hash -> {pathtosave} = $1;
|
||||
}
|
||||
# Get the receiver's email where to send the attached file
|
||||
elsif ($line =~ /^receiver_email\s([a-zA-Z0-9\.\_\-\@]+)/) {
|
||||
$conf_hash -> {receiver_email} = $1;
|
||||
}
|
||||
}
|
||||
close CONF;
|
||||
}
|
||||
|
||||
########################################################################
|
||||
## SUB send_mail
|
||||
## Sends an attachement file via email using smtp
|
||||
########################################################################
|
||||
sub send_mail($) {
|
||||
|
||||
my $conf_hash = $_[0];
|
||||
my $smtp;
|
||||
my $attachment = $conf_hash -> {filename};
|
||||
|
||||
# Get the filename in case the full path was given
|
||||
# Split the full path with '/', the last item will be the filename
|
||||
my @file_path = split ('/', $attachment);
|
||||
|
||||
# Get the array's last position with '-1' index
|
||||
my $attach_file = $file_path[-1];
|
||||
|
||||
my $host = $conf_hash -> {smtp_hostname};
|
||||
my $from = $conf_hash -> {smtp_user};
|
||||
my $password = $conf_hash -> {smtp_pass};
|
||||
my $to = $conf_hash -> {receiver_email};
|
||||
|
||||
open(DATA, $attachment) || die("mail_transfer.pl: ERROR: Could not open the file $attach_file");
|
||||
my @xml = <DATA>;
|
||||
close(DATA);
|
||||
|
||||
$smtp = Net::SMTP->new($host,
|
||||
Hello => $host,
|
||||
Timeout => 30,
|
||||
Debug => 0,
|
||||
) || die("mail_trasfer.pl: ERROR: Could not connect to $host");
|
||||
|
||||
$smtp->auth($from, $password);
|
||||
$smtp->mail($from);
|
||||
$smtp->to($to);
|
||||
$smtp->data();
|
||||
$smtp->datasend("To: $to\n");
|
||||
$smtp->datasend("From: $from\n");
|
||||
$smtp->datasend("Subject: Pandora mail transfer\n");
|
||||
$smtp->datasend("MIME-Version: 1.0\n");
|
||||
$smtp->datasend("Content-Type: application/text; name=" . $attach_file . "\n");
|
||||
$smtp->datasend("Content-Disposition: attachment; filename=" . $attach_file . "\n");
|
||||
$smtp->datasend("Content-type: multipart/mixed boundary=" . $boundary . "\n");
|
||||
$smtp->datasend("\n");
|
||||
$smtp->datasend("@xml\n");
|
||||
$smtp->dataend() || print "mail_transfer.pl: ERROR: Data end failed: $!";
|
||||
$smtp->quit;
|
||||
}
|
||||
|
||||
########################################################################
|
||||
## SUB receive_mail
|
||||
## Fetch the last email with 'Pandora mail transfer' as subject and
|
||||
## download the attached file into the specified folder
|
||||
########################################################################
|
||||
sub receive_mail ($) {
|
||||
|
||||
my $conf_hash = $_[0];
|
||||
my $user = $conf_hash -> {pop3_user};
|
||||
my $password = $conf_hash -> {pop3_pass};
|
||||
my $host = $conf_hash -> {pop3_hostname};
|
||||
my $ssl = $conf_hash -> {pop3_ssl};
|
||||
my $ssl_port = $conf_hash -> {pop3_ssl_port};
|
||||
my $pathtosave = $conf_hash -> {pathtosave};
|
||||
my $pop3;
|
||||
|
||||
if ($ssl == 1){
|
||||
$pop3 = new Mail::POP3Client(
|
||||
USER => $user,
|
||||
PASSWORD => $password,
|
||||
HOST => $host,
|
||||
USESSL => 1,
|
||||
PORT => $ssl_port,
|
||||
DEBUG => 0
|
||||
) or die "mail_transfer.pl: Connection failed\n";
|
||||
} else {
|
||||
$pop3 = new Mail::POP3Client(
|
||||
USER => $user,
|
||||
PASSWORD => $password,
|
||||
HOST => $host,
|
||||
USESSL => 0,
|
||||
PORT => 110,
|
||||
DEBUG => 0
|
||||
) or die "mail_transfer.pl: Connection failed\n";
|
||||
}
|
||||
|
||||
my $tot_msg = $pop3->Count();
|
||||
|
||||
if ($tot_msg == 0){
|
||||
print "No more emails avalaible\n";
|
||||
return (0); # End program
|
||||
}
|
||||
elsif ($tot_msg eq '0E0'){
|
||||
print "No new emails available\n";
|
||||
return (0);
|
||||
}
|
||||
else{
|
||||
printf "There are $tot_msg messages \n\n";
|
||||
}
|
||||
|
||||
# the list of valid file extensions. we do extensions, not
|
||||
# mime-types, because they're easier to understand from
|
||||
# an end-user perspective (no research is required).
|
||||
|
||||
my $valid_exts = "txt xml data";
|
||||
my %msg_ids; # used to keep track of seen emails.
|
||||
|
||||
# create a subdirectory if does not exist
|
||||
#print "Using directory '$pathtosave' for newly downloaded files.\n";
|
||||
if (!(-d $pathtosave)) {
|
||||
mkdir($pathtosave, 0777) or die "mail_transfer.pl: Error creating output directory\n";
|
||||
}
|
||||
|
||||
# get the message to feed to MIME::Parser.
|
||||
my $msg = $pop3->HeadAndBody($tot_msg);
|
||||
my $header = $pop3->Head($tot_msg);
|
||||
|
||||
if (($header !~ /Subject:\sPandora\smail\stransfer/) || ($header !~ /boundary=$boundary/)) {
|
||||
print "Deleting message not valid\n";
|
||||
|
||||
# delete current email
|
||||
$pop3->Delete($tot_msg);
|
||||
|
||||
# clean up and close the connection.
|
||||
$pop3->Close;
|
||||
|
||||
return -1;
|
||||
|
||||
}
|
||||
|
||||
# create a MIME::Parser object to
|
||||
# extract any attachments found within.
|
||||
my $parser = new MIME::Parser;
|
||||
|
||||
$parser->output_dir($pathtosave);
|
||||
my $entity = $parser->parse_data($msg);
|
||||
|
||||
# extract our mime parts and go through each one.
|
||||
my @parts = $entity->parts;
|
||||
|
||||
foreach my $part (@parts) {
|
||||
|
||||
# determine the path to the file in question.
|
||||
my $path = ($part->bodyhandle) ? $part->bodyhandle->path : undef;
|
||||
|
||||
# move on if it's not defined,
|
||||
# else figure out the extension.
|
||||
next unless $path;
|
||||
$path =~ /\w+\.([^.]+)$/;
|
||||
my $ext = $1;
|
||||
next unless $ext;
|
||||
|
||||
# we continue only if our extension is correct.
|
||||
my $continue; $continue++ if $valid_exts =~ /$ext/i;
|
||||
|
||||
# delete the blasted thing.
|
||||
unless ($valid_exts =~ /$ext/) {
|
||||
print " Removing unwanted filetype ($ext): $path\n";
|
||||
unlink $path or print " > Error removing file at $path: $!.";
|
||||
next; # move on to the next attachment or message.
|
||||
}
|
||||
|
||||
# a valid file type. yummy!
|
||||
print " Keeping valid file: $path.\n";
|
||||
}
|
||||
|
||||
# delete current email
|
||||
$pop3->Delete($tot_msg);
|
||||
|
||||
# clean up and close the connection.
|
||||
$pop3->Close;
|
||||
}
|
||||
|
||||
|
||||
####### MAIN #######
|
||||
|
||||
# Check the given command line arguments
|
||||
check_args();
|
||||
|
||||
# Once checked store them
|
||||
my $action = $ARGV[0];
|
||||
my $conf_file = $ARGV[1];
|
||||
my $filename = $ARGV[2];
|
||||
|
||||
# If the action is 'send', store the 'file_to_send'
|
||||
my %conf_hash;
|
||||
if ($action eq "send") {
|
||||
$conf_hash {filename} = $filename;
|
||||
}
|
||||
|
||||
# Parse the config file
|
||||
parse_conf($conf_file, \%conf_hash);
|
||||
|
||||
# Call 'send_mail' function in its case
|
||||
if ($action eq "send") {
|
||||
send_mail(\%conf_hash);
|
||||
}
|
||||
|
||||
# Or call the 'receive_mail' function.
|
||||
my $returncode = 1;
|
||||
|
||||
if ($action eq "receive") {
|
||||
while ($returncode != 0) {
|
||||
$returncode = receive_mail(\%conf_hash);
|
||||
}
|
||||
}
|
|
@ -1,106 +0,0 @@
|
|||
Pandora Mail Transfer
|
||||
======================
|
||||
|
||||
1st Edition , 3 May 2011
|
||||
|
||||
(c) Pandora FMS 2005-2023
|
||||
(c) Juan Manuel Ramon <juanma@artica.es>
|
||||
(c) Javier Lanz <javier.lanz@artica.es>
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
||||
Pandora Mail Transfer is a tool for sending and receiving xml files via email.
|
||||
This script sends through a SMTP server, to the desired address, an email with an attached file.
|
||||
Is able as well to fetch via POP3 that mail and its attached file.
|
||||
It's designed to be used with an specific email account, so every time the script is called in “receive” mode, all emails on that account will be deleted. Do not use this script in a personal account because all your emails will be deleted.
|
||||
|
||||
This script is designed to send only text files, no binary files.
|
||||
|
||||
It's only possible to send .data, .txt, or .xml files.
|
||||
|
||||
Requisites
|
||||
----------
|
||||
|
||||
In order to be able to use this application, it's a must having the following Perl's CPAN packages installed in your system:
|
||||
|
||||
Mail::POP3Client
|
||||
MIME::Parser
|
||||
Authen::SASL
|
||||
Net::SMTP;
|
||||
|
||||
To install these libraries with CPAN, for example Mail::POP3Client:
|
||||
|
||||
cpan install Mail::POP3Client
|
||||
|
||||
To use the program under Windows, you will need to compile with a compiler like ActiveState PERL. The ActiveState environment allows as well to install CPAN modules easily.
|
||||
|
||||
Previous the script execution, it's a must having a configuration file, in which the mail server connection parameters will be defined.
|
||||
|
||||
Below it's shown a configuration file example, in which the necessary fields for the proper use of the mail transfer script are detailed.
|
||||
|
||||
Sample configuration file
|
||||
-------------------------
|
||||
|
||||
###########################################
|
||||
### SMTP DATA
|
||||
###########################################
|
||||
|
||||
smtp_user username@domain.com
|
||||
smtp_pass pass
|
||||
smtp_hostname mailserver.domain.com
|
||||
###########################################
|
||||
### POP3 DATA
|
||||
###########################################
|
||||
pop3_user username@domain.com
|
||||
pop3_pass pass
|
||||
pop3_hostname mailserver.domain.com
|
||||
# Enable or disable SSL. 1 means Enabled , 0 Disabled
|
||||
pop3_ssl 0
|
||||
# SSL port
|
||||
pop3_ssl_port 995
|
||||
###########################################
|
||||
### TO SEND INFO
|
||||
###########################################
|
||||
# Email receiver where to send the email
|
||||
receiver_email desired.mail@domain.com
|
||||
###########################################
|
||||
### PATH TO SAVE THE ATTACHED FILE
|
||||
###########################################
|
||||
# Desired path where the attached file will be stored
|
||||
pathtosave /path/to/save/attached
|
||||
|
||||
|
||||
Pandora mail transfer execution
|
||||
-------------------------------
|
||||
|
||||
The proper way of executing the script should be according to...
|
||||
|
||||
./mail_transfer <action> <conf_file> [file_to_send]
|
||||
|
||||
Where the meaning of the fields are:
|
||||
|
||||
<action> could be 'send' or 'receive'
|
||||
|
||||
<conf_file> configuration file, explained above, contains every necessary data for sending and receiving emails.
|
||||
|
||||
[file_to_send] desired xml file to send (Only necessary in case of action = 'send')
|
||||
|
||||
Execution examples:
|
||||
|
||||
./mail_transfer send config_file.conf textfile.txt
|
||||
|
||||
./mail_transfer receive config_file.conf
|
||||
|
||||
Restrictions
|
||||
------------
|
||||
|
||||
SSL Protocol
|
||||
|
||||
In this first version, SSL protocol is only implemented for the mail reception, not for sending.
|
||||
Another related SSL Protocol restriction is the email erasing once read and downloaded to disk. In case of using SSL, deleting is not possible, on the other hand, if it's not used, the read mail will be properly deleted from the server once download to disk.
|
||||
|
||||
Attached file
|
||||
|
||||
There is a wee bug not fixed yet about the attached file name. If this one contains special characters such as '(' ')' '\' and more, while downloading from the server, it will be saved to disk with a different file name, probably wrong, although its content will be the right one. Thus, it's recommended not to use special characters in the file name.
|
||||
|
Binary file not shown.
|
@ -1,664 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
# Pandora FMS Agent Plugin for SunONE
|
||||
# (c) Pandora FMS <info@pandorafms.com> 2011
|
||||
# v2, 1 Sep 2011
|
||||
# ------------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use IO::Socket::INET;
|
||||
|
||||
# OS and OS version
|
||||
my $OS = $^O;
|
||||
|
||||
|
||||
# Load on Win32 only
|
||||
if ($OS eq "MSWin32"){
|
||||
|
||||
# Check dependencies
|
||||
eval 'local $SIG{__DIE__}; use Win32::OLE("in");';
|
||||
if ($@) {
|
||||
print "Error loading Win32::Ole library. Cannot continue\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
use constant wbemFlagReturnImmediately => 0x10;
|
||||
use constant wbemFlagForwardOnly => 0x20;
|
||||
}
|
||||
|
||||
my %plugin_setup; # This stores plugin parameters
|
||||
my $archivo_cfg = $ARGV[0];
|
||||
|
||||
my $volume_items = 0;
|
||||
my $log_items = 0;
|
||||
my $webcheck_items = 0;
|
||||
my $process_items = 0;
|
||||
|
||||
|
||||
# FLUSH in each IO
|
||||
$| = 1;
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# This cleans DOS-like line and cleans ^M character. VERY Important when you process .conf edited from DOS
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
sub parse_dosline ($){
|
||||
my $str = $_[0];
|
||||
|
||||
$str =~ s/\r//g;
|
||||
return $str;
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Strips blank likes
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
sub trim ($){
|
||||
my $string = shift;
|
||||
$string =~ s/^\s+//;
|
||||
$string =~ s/\s+$//;
|
||||
return $string;
|
||||
}
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# clean_blank
|
||||
#
|
||||
# This function return a string without blankspaces, given a simple text string
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
sub clean_blank($){
|
||||
my $input = $_[0];
|
||||
$input =~ s/[\s\r\n]*//g;
|
||||
return $input;
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# print_module
|
||||
#
|
||||
# This function return a pandora FMS valid module fiven name, type, value, description
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
sub print_module ($$$$){
|
||||
my $MODULE_NAME = $_[0];
|
||||
my $MODULE_TYPE = $_[1];
|
||||
my $MODULE_VALUE = $_[2];
|
||||
my $MODULE_DESC = $_[3];
|
||||
|
||||
# If not a string type, remove all blank spaces!
|
||||
if ($MODULE_TYPE !~ m/string/){
|
||||
$MODULE_VALUE = clean_blank($MODULE_VALUE);
|
||||
}
|
||||
|
||||
print "<module>\n";
|
||||
print "<name>$MODULE_NAME</name>\n";
|
||||
print "<type>$MODULE_TYPE</type>\n";
|
||||
print "<data><![CDATA[$MODULE_VALUE]]></data>\n";
|
||||
print "<description><![CDATA[$MODULE_DESC]]></description>\n";
|
||||
print "</module>\n";
|
||||
|
||||
}
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# load_external_setup
|
||||
#
|
||||
# Load external file containing configuration
|
||||
# ----------------------------------------------------------------------------
|
||||
sub load_external_setup ($); # Declaration due a recursive call to itself on includes
|
||||
sub load_external_setup ($){
|
||||
|
||||
my $archivo_cfg = $_[0];
|
||||
my $buffer_line;
|
||||
my @config_file;
|
||||
my $parametro = "";
|
||||
|
||||
# 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 (<CFG>){
|
||||
$buffer_line = parse_dosline ($_);
|
||||
# Parse configuration file, this is specially difficult because can contain SQL code, with many things
|
||||
if ($buffer_line !~ /^\#/){ # begins with anything except # (for commenting)
|
||||
if ($buffer_line =~ m/(.+)\s(.*)/){
|
||||
push @config_file, $buffer_line;
|
||||
}
|
||||
}
|
||||
}
|
||||
close (CFG);
|
||||
|
||||
# Some plugin setup default options
|
||||
|
||||
$plugin_setup{"logparser"}="/etc/pandora/plugins/grep_log";
|
||||
$plugin_setup{"timeout"} = 5;
|
||||
$plugin_setup{"apache_stats"} = "";
|
||||
|
||||
foreach (@config_file){
|
||||
$parametro = $_;
|
||||
|
||||
if ($parametro =~ m/^include\s(.*)/i) {
|
||||
load_external_setup ($1);
|
||||
}
|
||||
|
||||
if ($parametro =~ m/^logparser\s(.*)/i) {
|
||||
$plugin_setup{"logparser"}=$1;
|
||||
|
||||
}
|
||||
|
||||
if ($parametro =~ m/^timeout\s(.*)/i) {
|
||||
$plugin_setup{"timeout"}=clean_blank($1);
|
||||
|
||||
}
|
||||
|
||||
# Log check
|
||||
if ($parametro =~ m/^log\s(.*)/i) {
|
||||
$plugin_setup{"log"}->[$log_items]=$1;
|
||||
$log_items++;
|
||||
}
|
||||
|
||||
# Volume check
|
||||
if ($parametro =~ m/^volume\s(.*)/i) {
|
||||
$plugin_setup{"volume"}->[$volume_items]=$1;
|
||||
$volume_items++;
|
||||
}
|
||||
|
||||
# Webcheck
|
||||
if ($parametro =~ m/^webcheck\s(.*)/i) {
|
||||
$plugin_setup{"webcheck"}->[$webcheck_items]=$1;
|
||||
$webcheck_items++;
|
||||
}
|
||||
|
||||
# Processcheck
|
||||
if ($parametro =~ m/^process\s(.*)/i) {
|
||||
$plugin_setup{"process"}->[$process_items]=$1;
|
||||
$process_items++;
|
||||
}
|
||||
|
||||
# Apachestats
|
||||
if ($parametro =~ m/^apache_stats\s(.*)/i) {
|
||||
$plugin_setup{"apache_stats"}=$1;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# http_check
|
||||
#
|
||||
# This function recives something like 0.0.0.0:80 / 200 OK
|
||||
# to check a HTTP response, given Host:PORT, URL and Search string
|
||||
# Return 0 if not, and 1 if found
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
sub http_check ($$$$$){
|
||||
my $name = $_[0];
|
||||
my $host = $_[1];
|
||||
my $port = $_[2];
|
||||
my $query_string = $_[3];
|
||||
my $search_string = $_[4];
|
||||
|
||||
|
||||
my $tcp_send = "GET $query_string HTTP/1.0\n\n";
|
||||
my $temp; my $match = 0;
|
||||
|
||||
my $sock = new IO::Socket::INET (
|
||||
PeerAddr => $host,
|
||||
PeerPort => $port,
|
||||
Proto => 'tcp',
|
||||
Timeout=> $plugin_setup{"timeout"},
|
||||
Blocking=>1 ); # Non block gives non-accurate results. We need to be SURE about this results :(
|
||||
|
||||
if (!$sock){
|
||||
print_module("web_$name", "generic_proc", 0, "HTTP Check on $host for $query_string");
|
||||
return;
|
||||
}
|
||||
|
||||
# Send data
|
||||
$sock->autoflush(1);
|
||||
|
||||
$tcp_send =~ s/\^M/\r\n/g;
|
||||
# Replace Carriage return and line feed
|
||||
|
||||
print $sock $tcp_send;
|
||||
my @buffer = <$sock>;
|
||||
|
||||
# Search on buffer
|
||||
foreach (@buffer) {
|
||||
if ($_ =~ /$search_string/){
|
||||
$match = 1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
$sock->close;
|
||||
|
||||
print_module ("web_$name", "generic_proc", $match, "HTTP Check on $host for $query_string");
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# apache_stats
|
||||
#
|
||||
# This function uses mod_status from apache to get information
|
||||
# Given Instance, Host:PORT, URL (usually should be /server-status)
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
sub apache_stats ($$$$){
|
||||
my $name = $_[0];
|
||||
my $host = $_[1];
|
||||
my $port = $_[2];
|
||||
my $query_string = $_[3];
|
||||
|
||||
if ($query_string eq ""){
|
||||
$query_string = "/";
|
||||
}
|
||||
|
||||
my $tcp_send = "GET $query_string HTTP/1.0\n\n";
|
||||
my $temp; my $match = 0;
|
||||
|
||||
# First at all, check response on apache (200 OK)
|
||||
|
||||
http_check ("Apache_Status_$name", $host, $port, $query_string, "200 OK");
|
||||
|
||||
my $sock = new IO::Socket::INET (
|
||||
PeerAddr => $host,
|
||||
PeerPort => $port,
|
||||
Proto => 'tcp',
|
||||
Timeout=> $plugin_setup{"timeout"},
|
||||
Blocking=>1 ); # Non block gives non-accurate results. We need to be SURE about this results :(
|
||||
|
||||
if (!$sock){
|
||||
return;
|
||||
}
|
||||
|
||||
# Send data
|
||||
$sock->autoflush(1);
|
||||
|
||||
$tcp_send =~ s/\^M/\r\n/g;
|
||||
# Replace Carriage return and line feed
|
||||
|
||||
print $sock $tcp_send;
|
||||
my @buffer = <$sock>;
|
||||
|
||||
# Search on buffer
|
||||
foreach (@buffer) {
|
||||
|
||||
if ($_ =~ /Restart Time: ([aA-zZ]+\,\s[0-9]{2}\-[aA-zZ]{3}\-[0-9]{4}\s[0-9]{2}\:[0-9]{2}\:[0-9]{2}\s[aA-zZ]+)/ ) {
|
||||
print_module ("apache_restart_time_$name", "generic_data_string", $1, "" );
|
||||
}
|
||||
|
||||
if ($_ =~ /Server uptime: ([aA-zZ 0-9]+)/) {
|
||||
print_module ("apache_server_uptime_$name", "generic_data_string", $1, "" );
|
||||
}
|
||||
|
||||
if ($_ =~ /Total accesses: ([0-9]+)/ ) {
|
||||
print_module ("apache_accesses_$name", "generic_data_inc", $1, "" );
|
||||
}
|
||||
|
||||
if ($_ =~ /Total Traffic: ([0-9]+)/ ) {
|
||||
print_module ("apache_total_traffic_$name", "generic_data_inc", $1, "" );
|
||||
}
|
||||
|
||||
if ($_ =~ /([0-9]+\.[0-9]+)\%\sCPU\sload/ ){
|
||||
print_module ("apache_CPU_Load_$name", "generic_data", $1, "" );
|
||||
}
|
||||
|
||||
if ($_ =~ /CPU Usage\: u([\.0-9]*)/ ){
|
||||
print_module ("apache_CPU_User_Load_$name", "generic_data", $1, "" );
|
||||
}
|
||||
|
||||
if ($_ =~ /CPU Usage\: u[\.0-9]* s([\.0-9]*)/ ){
|
||||
print_module ("apache_CPU_System_Load_$name", "generic_data", $1, "" );
|
||||
}
|
||||
|
||||
if ($_ =~ /([\.0-9]+)\srequests\/sec/){
|
||||
print_module ("apache_Req/Sec_$name", "generic_data", $1, "" );
|
||||
}
|
||||
|
||||
if ($_ =~ /([0-9]+)\sB\/second/) {
|
||||
print_module ("apache_B/Sec_$name", "generic_data_inc", $1, "" );
|
||||
}
|
||||
|
||||
if ($_ =~ /([0-9]+)\skB\/request/) {
|
||||
print_module ("apache_KB/Request_$name", "generic_data_inc", $1, "" );
|
||||
}
|
||||
|
||||
if ($_ =~ /([0-9]+)\srequests\scurrently/) {
|
||||
print_module ("apache_request_currently_$name", "generic_data", $1, "" );
|
||||
}
|
||||
|
||||
if ($_ =~ /([0-9]+)\sidle\sworkers/) {
|
||||
print_module ("apache_idle_workers_$name", "generic_data", $1, "" );
|
||||
}
|
||||
|
||||
}
|
||||
$sock->close;
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# alert_log
|
||||
#
|
||||
# Do a call to alertlog plugin and output the result
|
||||
# Receives logfile, and module name
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
sub alert_log($$$){
|
||||
my $alertlog = $_[0];
|
||||
my $module_name = $_[1];
|
||||
my $log_expression = $_[2];
|
||||
|
||||
my $plugin_call = "";
|
||||
# Call to logparser
|
||||
|
||||
if ($OS eq "MSWin32") {
|
||||
$plugin_call = $plugin_setup{"logparser"}. " $alertlog $module_name $log_expression";
|
||||
} else {
|
||||
$plugin_call = $plugin_setup{"logparser"}. " $alertlog $module_name $log_expression 2> /dev/null";
|
||||
}
|
||||
|
||||
my $output = `$plugin_call`;
|
||||
|
||||
if ($output ne ""){
|
||||
print $output;
|
||||
} else {
|
||||
print_module($module_name, "async_string", "", "Alertlog for $alertlog ($log_expression)");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# spare_system_disk_win
|
||||
#
|
||||
# This function return % free disk on Windows, using WMI call
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
sub spare_system_disk_win ($$){
|
||||
|
||||
my $name = $_[0];
|
||||
my $volume = $_[1];
|
||||
|
||||
|
||||
my $computer = "localhost";
|
||||
my $objWMIService = Win32::OLE->GetObject("winmgmts:\\\\$computer\\root\\CIMV2") or return;
|
||||
my $colItems = $objWMIService->ExecQuery("SELECT * from CIM_LogicalDisk WHERE Name = '$volume'", "WQL", wbemFlagReturnImmediately | wbemFlagForwardOnly);
|
||||
|
||||
foreach my $objItem (in $colItems) {
|
||||
my $data = ($objItem->{"FreeSpace"} / $objItem->{"Size"}) * 100;
|
||||
print_module("Volume_$volume" . "_" . "$name", "generic_data", "$data", "Free disk on $volume");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# spare_system_disk
|
||||
#
|
||||
# Check free space on volume
|
||||
# Receives volume name and instance
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
sub spare_system_disk ($$) {
|
||||
my $name = $_[0];
|
||||
my $vol = $_[1];
|
||||
|
||||
|
||||
if ($vol eq ""){
|
||||
return;
|
||||
}
|
||||
|
||||
# This is a posix call, should be the same on all systems !
|
||||
my $output = `df -kP | grep "$vol\$" | awk '{ print \$5 }' | tr -d "%"`;
|
||||
my $disk_space = 100 - $output;
|
||||
print_module("Volume_$vol" . "_" . "$name", "generic_data", $disk_space, "% of volume free");
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# process_status_unix
|
||||
#
|
||||
# Generates a pandora module about the running status of a given process
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
sub process_status_unix ($$){
|
||||
my $proc = $_[0];
|
||||
my $proc_name = $_[1];
|
||||
|
||||
if ($proc eq ""){
|
||||
return;
|
||||
}
|
||||
|
||||
my $data = trim (`ps aux | grep "$proc" | grep -v grep | wc -l`);
|
||||
print_module("Process_$proc_name", "generic_proc", $data, "Status of process $proc");
|
||||
}
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# process_status_win
|
||||
#
|
||||
# Generates a pandora module about the running status of a given process
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
sub process_status_win ($$){
|
||||
my $proc = $_[0];
|
||||
my $proc_name = $_[1];
|
||||
|
||||
if ($proc eq ""){
|
||||
return;
|
||||
}
|
||||
|
||||
my $computer = "localhost";
|
||||
my $objWMIService = Win32::OLE->GetObject("winmgmts:\\\\$computer\\root\\CIMV2") or return;
|
||||
my $colItems = $objWMIService->ExecQuery("SELECT * FROM Win32_Process WHERE Caption = '$proc'", "WQL", wbemFlagReturnImmediately | wbemFlagForwardOnly);
|
||||
|
||||
foreach my $objItem (in $colItems) {
|
||||
|
||||
if ($objItem->{"Caption"} eq $proc){
|
||||
print_module("Process_$proc_name", "generic_proc", 1, "Status of process $proc");
|
||||
return;
|
||||
} else {
|
||||
print_module("Process_$proc_name", "generic_proc", 0, "Status of process $proc");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
# no matches, process is not running
|
||||
print_module("Process_$proc_name", "generic_proc", 0, "Status of process $proc");
|
||||
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# process_mem_win
|
||||
#
|
||||
# Generates a Pandora FMS about memory usage of a given process "pepito.exe"
|
||||
# only works with EXACT names.
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
sub process_mem_win ($$){
|
||||
my $proc = $_[0];
|
||||
my $proc_name = $_[1];
|
||||
|
||||
if ($proc eq ""){
|
||||
return;
|
||||
}
|
||||
|
||||
my $computer = "localhost";
|
||||
my $objWMIService = Win32::OLE->GetObject("winmgmts:\\\\$computer\\root\\CIMV2") or return;
|
||||
my $colItems = $objWMIService->ExecQuery("SELECT * FROM Win32_Process WHERE Caption = '$proc'", "WQL", wbemFlagReturnImmediately | wbemFlagForwardOnly);
|
||||
|
||||
foreach my $objItem (in $colItems) {
|
||||
|
||||
if ($objItem->{"Caption"} eq $proc){
|
||||
print_module("Process_MEM_$proc_name", "generic_data", $objItem->{"WorkingSetSize"}, "Memory in bytes of process $proc");
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# process_mem_unix
|
||||
#
|
||||
# Generates a Pandora FMS about memory usage of a given process
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
sub process_mem_unix ($$){
|
||||
my $vol = $_[0];
|
||||
my $proc_name = $_[1];
|
||||
|
||||
if ($vol eq ""){
|
||||
return;
|
||||
}
|
||||
|
||||
my $data = `ps aux | grep "$vol" | grep -v grep | awk '{ print \$6 }'`;
|
||||
my @data2 = split ("\n", $data),
|
||||
my $tot = 0;
|
||||
|
||||
foreach (@data2){
|
||||
$tot = $tot + $_;
|
||||
}
|
||||
print_module("Proc_MEM_$proc_name", "generic_data", $tot, "Memory used (in bytes) for process $vol");
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# process_cpu_unix
|
||||
#
|
||||
# Generates a Pandora FMS about memory usage of a given process
|
||||
# ----------------------------------------------------------------------------
|
||||
sub process_cpu_unix ($$) {
|
||||
my $vol = $_[0];
|
||||
my $proc_name = $_[1];
|
||||
|
||||
if ($vol eq ""){
|
||||
return;
|
||||
}
|
||||
|
||||
my $data = `ps aux | grep "$vol" | grep -v grep | awk '{ print \$3 }'`;
|
||||
my @data2 = split ("\n", $data),
|
||||
my $tot = 0;
|
||||
|
||||
foreach (@data2){
|
||||
$tot = $tot + $_;
|
||||
}
|
||||
print_module("Proc_CPU_$proc_name", "generic_data", $tot, "CPU (%) used for process $vol");
|
||||
}
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
#--------------------------------------------------------------------------------
|
||||
# MAIN PROGRAM
|
||||
# -------------------------------------------------------------------------------
|
||||
#--------------------------------------------------------------------------------
|
||||
|
||||
# Parse external configuration file
|
||||
|
||||
# Load config file from command line
|
||||
if ($#ARGV == -1 ){
|
||||
print "I need at least one parameter: Complete path to external configuration file \n";
|
||||
exit;
|
||||
}
|
||||
|
||||
# Check for file
|
||||
if ( ! -f $archivo_cfg ) {
|
||||
printf "\n [ERROR] Cannot open configuration file at $archivo_cfg. \n\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
load_external_setup ($archivo_cfg);
|
||||
|
||||
# Check for logparser, if not ready, skip all log check
|
||||
if ( ! -f $plugin_setup{"logparser"} ) {
|
||||
# Create a dummy check module with and advise warning
|
||||
if ($log_items > 0) {
|
||||
print_module("Error: Log parser not found", "async_string", 0, "Log parser not found, please check your configuration file and set it");
|
||||
}
|
||||
$log_items =0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
# Webchecks
|
||||
if ($webcheck_items > 0){
|
||||
my $ax;
|
||||
|
||||
for ($ax=0; $ax < $webcheck_items; $ax++){
|
||||
|
||||
my ($name, $host, $port, $url, $string) = split (";",$plugin_setup{"webcheck"}[$ax]);
|
||||
http_check ($name, $host, $port, $url, $string);
|
||||
}
|
||||
}
|
||||
|
||||
# Check individual defined volumes
|
||||
if ($volume_items > 0){
|
||||
my $ax;
|
||||
|
||||
for ($ax=0; $ax < $volume_items; $ax++){
|
||||
my ($name, $volume) = split (";",$plugin_setup{"volume"}[$ax]);
|
||||
if ($OS eq "MSWin32"){
|
||||
spare_system_disk_win ($name, $volume);
|
||||
} else {
|
||||
spare_system_disk ($name, $volume);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Check individual defined logs
|
||||
if ($log_items > 0){
|
||||
my $ax;
|
||||
|
||||
for ($ax=0; $ax < $log_items; $ax++){
|
||||
my ($logfile, $name, $expression) = split (";",$plugin_setup{"log"}[$ax]);
|
||||
|
||||
# Verify proper valid values here or skip
|
||||
if (!defined($logfile)){
|
||||
next;
|
||||
}
|
||||
|
||||
if (!defined($name)){
|
||||
next;
|
||||
}
|
||||
|
||||
if (!defined($expression)){
|
||||
next;
|
||||
}
|
||||
|
||||
alert_log ($logfile, $name, $expression);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Check individual defined process
|
||||
if ($process_items > 0){
|
||||
my $ax;
|
||||
|
||||
for ($ax=0; $ax < $process_items; $ax++){
|
||||
|
||||
my ($name, $process) = split (";",$plugin_setup{"process"}[$ax]);
|
||||
|
||||
if ($OS eq "MSWin32") {
|
||||
process_status_win ($process, $name);
|
||||
process_mem_win ($process, $name);
|
||||
} else {
|
||||
process_status_unix ($process, $name);
|
||||
process_mem_unix ($process, $name);
|
||||
process_cpu_unix ($process, $name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Apache stats
|
||||
|
||||
if ($plugin_setup{"apache_stats"} ne "") {
|
||||
my ($name, $host, $port, $url) = split (";",$plugin_setup{"apache_stats"});
|
||||
apache_stats ($name, $host, $port, $url);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue