PROXY  WHOIS  RQUOTE  TEXTS  SOFT  FOREX  BBOARD
 Music  Philosophy  Code  Literature  Russian

= ROOT|Technical|Code_Examples|C|nagios-plugins-1.4.10|plugins-scripts|check_rpc.pl =

page 1 of 4



#!/usr/local/bin/perl -w
#
# check_rpc plugin for nagios
#
# usage:
#    check_rpc host service
#
# Check if an rpc serice is registered and running
# using rpcinfo - $proto $host $prognum 2>&1 |";
#
# Use these hosts.cfg entries as examples
#
# command[check_nfs]=/some/path/libexec/check_rpc $HOSTADDRESS$ nfs
# service[check_nfs]=NFS;24x7;3;5;5;unix-admin;60;24x7;1;1;1;;check_rpc
#
# initial version: 3 May 2000 by Truongchinh Nguyen and Karl DeBisschop
# Modified May 2002 Subhendu Ghosh - support for ePN and patches
# current status: $Revision: 677 $
#
# Copyright Notice: GPL
# $Id: check_rpc.pl 677 2003-08-10 12:11:49Z kdebisschop $
#

use strict;
use lib utils.pm;
use utils qw($TIMEOUT %ERRORS &print_revision &support);
use vars qw($PROGNAME);
my ($verbose,@proto,%prognum,$host,$response,$prognum,$port,$cmd,$progver,$state);
my ($array_ref,$test,$element,@progkeys,$proto,$a,$b);
my ($opt_V,$opt_h,$opt_C,$opt_p,$opt_H,$opt_c,$opt_u,$opt_t);
my ($line, @progvers, $response2,$response3);
$opt_V = $opt_h = $opt_C = $opt_p = $opt_H =  $opt_u = $opt_t ='';
$state = 'UNKNOWN';
$progver = $response=$response2= $response3 ='';

$PROGNAME = "check_rpc";
sub print_help ();
sub print_usage ();
sub in ($$);

$ENV{'BASH_ENV'}=''; 
$ENV{'ENV'}='';
$ENV{'PATH'}='';
$ENV{'LC_ALL'}='C';

#Initialise protocol for each progname number
# 'u' for UDP, 't' for TCP 
$proto[10003]='u';
$proto[10004]='u';
$proto[10007]='u';

use Getopt::Long;
Getopt::Long::Configure('bundling');
GetOptions(
	"V"   => \$opt_V,   "version"    => \$opt_V,
	"h"   => \$opt_h,   "help"       => \$opt_h,
	"C=s" => \$opt_C,   "command=s"  => \$opt_C,
	"p=i" => \$opt_p,   "port=i"     => \$opt_p,
 	"H=s" => \$opt_H,   "hostname=s" => \$opt_H,
 	"c=s" => \$opt_c,   "progver=s"  => \$opt_c,
 	"v+"  => \$verbose, "verbose+"   => \$verbose,
 	"u"   => \$opt_u,   "udp"        => \$opt_u,
 	"t"   => \$opt_t,   "tcp"        => \$opt_t
);

# -h means display verbose help screen
if ($opt_h) { print_help(); exit $ERRORS{'OK'}; }

# -V means display version number
if ($opt_V) { 
	print_revision($PROGNAME,'$Revision: 677 $ '); 
	exit $ERRORS{'OK'}; 
}

# Hash containing all RPC program names and numbers
# Add to the hash if support for new RPC program is required

%prognum  = (
	"portmapper"  => 100000 ,
	"portmap"  => 100000 ,
	"sunrpc"  => 100000 ,
	"rpcbind"  => 100000 ,
	"rstatd"  => 100001 ,
	"rstat"  => 100001 ,
	"rup"  => 100001 ,
	"perfmeter"  => 100001 ,
	"rstat_svc"  => 100001 ,
	"rusersd"  => 100002 ,
	"rusers"  => 100002 ,
	"nfs"  => 100003 ,
	"nfsprog"  => 100003 ,
	"ypserv"  => 100004 ,
	"ypprog"  => 100004 ,
	"mountd"  => 100005 ,
	"mount"  => 100005 ,
	"showmount"  => 100005 ,
	"ypbind"  => 100007 ,
	"walld"  => 100008 ,
	"rwall"  => 100008 ,
	"shutdown"  => 100008 ,
=1=

= PAGE 1 = NEXT > |2|3|4

UP TO ROOT | UP TO DIR

Google
 


E-mail Facebook Google Digg del.icio.us BlinkList Fark Furl Ma.gnolia Netscape NewsVine Reddit Slashdot Spurl StumbleUpon Technorati YahooMyWeb LiveJournal Blogmarks TwitThis Live News2.ru BobrDobr.ru Memori.ru MoeMesto.ru

0.025172 wallclock secs ( 0.00 usr + 0.00 sys = 0.00 CPU)