Re: [Nagios-devel] Web NRPE

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

Re: [Nagios-devel] Web NRPE

Post by Guest »

This is a multi-part message in MIME format.
--------------040703070104030101060309
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable
X-MIME-Autoconverted: from 8bit to quoted-printable by volkswagen.financial.com id h3GBbl820665

Ok,

but some comments. The out and err content is not properly quoted yet.=20
if the called plugin returns something containing to select the short=20
name given in webexec1.conf. -a '' to give arguments wich ar=20
passed as is to the plugin. also the xml-parsing is by now done with a=20
very simple-regex. i'm not shure if its really worth to install=20
xml-tools for such a simple response.

though it works ok for me i'm not very satisfied with this solution. a=20
much nicer way would be to have a http-transport for the original nrpe=20
(maybe transport-plugins for nrpe). then it would be easy to use=20
mod_proxy to talk to nrpe through apache.


please feel free to improve it :)

Chris


Hagen Deike wrote:
> Me too...
>=20
> Please post it here or send a link to download. Thanks a lot.
>=20
> =20
>=20
> Regards,
>=20
> Hagen Deike
>=20
> =20
>=20
> -----Urspr=FCngliche Nachricht-----
> *Von:* dan@julieanddan.com [mailto:dan@julieanddan.com]
> *Gesendet:* Dienstag, 15. April 2003 16:21
> *An:* nagios-devel@lists.sourceforge.net
> *Betreff:* [Nagios-devel] Web NRPE
>=20
> =20
>=20
>=20
> Chris,
>=20
> I would love to see that tool.
>=20
> Daniel Koffler
> dan@julieanddan.com
> Tel: 514.497.1411
> Fax: 206.600.4642
> GPG Key ID: 0xA2C6DC83 Fingerprint: 1FD7 3FDF 8A0D 961F 26A2 3EDA AE8F=20
> A874 A2C6 DC83
>=20


--=20
financial.com AG
Maria-Probst-Stra=DFe 19 Tel.: ++49(0)89/318528-44
D- 80939 M=FCnchen Fax.: ++49(0)89/318528-28

--------------040703070104030101060309
Content-Type: text/plain;
name="check_remote.pl"
Content-Disposition: inline;
filename="check_remote.pl"
Content-Transfer-Encoding: 7bit

#!/usr/bin/perl
#

define();
getcmd();

my $result=abfrage_ausfuehren();
if ($result =~ /.*(.*).*(.*).*(.*)/ms) {
print STDOUT $2;
print STDERR $3;
exit $1;
} else {
print "$result\n";
exit $2;
}


###########################################################################

# mein RequestAgent
sub define {
# ein paar http-objekte
use HTTP::Request;
use HTTP::Headers;
# include package for cmd-line-arguments
use Getopt::Std;

use LWP;
package RequestAgent;
@ISA =qw(LWP::UserAgent);

sub get_basic_credentials {
my($self, $realm, $uri) = @_;
return ($main::opts{'u'},$main::opts{'p'});
}
}



sub getcmd {
# hash mit optionen
%opts =(
u => 'username',
p => 'password',
l => 'http://www.myserver.com/tomcat/webexec1.jsp',
a => 'args',
c => 'command',
h => '0',
);
# welche optionen gibt es ?
getopts('u:p:l:a:c:h',\%opts);

# hilfe ausgeben
if ( $opts{'h'} ) {
print "Usage: $0 [ -u ] [ -p password ] [-a args ] [ -c command ] -l URL\n";
exit 1;
}
} # sub getcmd

sub abfrage_ausfuehren {

my $post_string="type=plain&args=".$opts{'a'}."&cmd=".$opts{'c'}."&mode=xml";
my $ua = RequestAgent->new();
my $header = HTTP::Headers->new();
$header->header('Content-Type' => 'application/x-www-form-urlencoded');
my $request = HTTP::Request->new('POST', $opts{'l'}, $header, $post_string);
my $response = $ua->request($request,\&callback);

if ($response->is_success) {
return $theline
} else {
return $response->status_line() ;
}
}


#
sub callback {
my($data, $response, $protocol) = @_;
$main::theline=$data;
}

--------------040703070104030101060309
Content-Type: text/plain;
name="webexec1.jsp"
Content-Disposition: inline;
filename="webexec1.jsp"
Content-Transfer-Encoding: 7bit

<%@ page import="java.io.*, java.net.*, java.util.*" session=

...[email truncated]...


This post was automatically imported from historical nagios-devel mailing list archives
Original poster: maser@financial.com
Locked