[Nagiosplug-checkins] CVS: nagiosplug/contrib check_sap.sh,1.1.1.1,1.2

Stanley Hopcroft stanleyhopcroft at users.sourceforge.net
Tue May 27 06:11:07 CEST 2003


Update of /cvsroot/nagiosplug/nagiosplug/contrib
In directory sc8-pr-cvs1:/tmp/cvs-serv14605/contrib

Modified Files:
	check_sap.sh 
Log Message:
check_sap.sh plugin to check SAP /R3 servers from Karel Salavec and Tom De Blende.

Index: check_sap.sh
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/contrib/check_sap.sh,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** check_sap.sh	28 Feb 2002 06:42:54 -0000	1.1.1.1
--- check_sap.sh	27 May 2003 13:10:01 -0000	1.2
***************
*** 4,11 ****
  # CHECK_SAP plugin for Nagios 
  # 
! # Written by Karel Salavec (karel.salavec at ct.cz) 
! # Last Modified: 20Apr2000 
  # 
! # Command line: CHECK_SAP <typ_of_check> <param1> <param2> [<param3>] 
  # 
  # Description: 
--- 4,18 ----
  # CHECK_SAP plugin for Nagios 
  # 
! # Originally Written by Karel Salavec (karel.salavec at ct.cz) 
! #
! # Last Modified: 26 May 2003 by Tom De Blende (tom.deblende at village.uunet.be)
! #
! # Version 1.1 (Tom De Blende)
! # - Added output to feed to Nagios instead of just an exit code.
! # - Changed info on where to get the SAP client tools for Linux.
  # 
! # Version 1.0 (Karel Salavec)
! #
! # Command line: check_sap.sh <typ_of_check> <param1> <param2> [<param3>] 
  # 
  # Description: 
***************
*** 15,23 ****
  # 
  #  Notes: 
! #   - This plugin requires that the saprfc-devel-45A-1.i386.rpm (or higher) 
! #     package be installed on your machine. Sapinfo program 
! #     is a part of this package. 
! #   - You can find this package at SAP ftp server in 
! #    /general/misc/unsupported/linux 
  # 
  # 
--- 22,28 ----
  # 
  #  Notes: 
! #   - This plugin requires that the sapinfo program is installed. 
! #   - Sapinfo is part of a client package that can be found 
! #     at ftp://ftp.sap.com/pub/linuxlab/contrib/. 
  # 
  # 
***************
*** 40,45 ****
  ##############################################################################
  
  if [ $# -lt 3 ]; then
! echo "Need min. 3 parameters"
  exit 2
  fi
--- 45,58 ----
  ##############################################################################
  
+ sapinfocmd='/usr/sap/rfcsdk/bin/sapinfo'
+ grepcmd=`which grep`
+ wccmd=`which wc`
+ cutcmd=`which cut`
+ awkcmd=`which awk`
+ 
+ ##############################################################################
+ 
  if [ $# -lt 3 ]; then
! echo "Usage: $0 <typ_of_check> <param1> <param2> [<param3>]"
  exit 2
  fi
***************
*** 59,70 ****
          ;;
      *)
!         echo "The first parametr must be ms (message server) or as (application server)!"
          exit 2
          ;;
  esac
  
! if /usr/sap/rfcsdk/bin/sapinfo $params | grep -i ERROR ; then
! exit 2
  else
! exit 0
  fi
--- 72,89 ----
          ;;
      *)
!         echo "The first parameter must be ms (message server) or as (application server)!"
          exit 2
          ;;
  esac
  
! output="$($sapinfocmd $params)"
! error="$(echo "$output" | $grepcmd ERROR | $wccmd -l)"
! if [ "$error" -gt "0" ]; then
!         output="$(echo "$output" | $grepcmd Key | $cutcmd -dy -f2)"
!         echo "CRITICAL - SAP server not ready: " $output.
!         exit 2
  else
! 	output="$(echo "$output" | $grepcmd Destination | $awkcmd '{ print $2 }')"
!         echo "OK - SAP server $output available."
!         exit 0	
  fi





More information about the Commits mailing list