summaryrefslogtreecommitdiffstats
path: root/contrib/check_sap.sh
diff options
context:
space:
mode:
authorHolger Weiss <holger@zedat.fu-berlin.de>2013-09-02 13:16:24 +0200
committerHolger Weiss <holger@zedat.fu-berlin.de>2013-09-02 13:16:24 +0200
commitb15adb7762b6caaecaa83637abfcf5fdb4802092 (patch)
tree64eddbe2aa1a7f98a140be0f7973f05d7a781ae0 /contrib/check_sap.sh
parentc4d5882b9e1d07c7b61091062b7d085fa5f00284 (diff)
downloadmonitoring-plugins-b15adb7762b6caaecaa83637abfcf5fdb4802092.tar.gz
Remove "contrib" plugins
These days, sites such as "Nagios Exchange" are a much better place for publishing plugins not maintained by the Plugins Development Team.
Diffstat (limited to 'contrib/check_sap.sh')
-rwxr-xr-xcontrib/check_sap.sh89
1 files changed, 0 insertions, 89 deletions
diff --git a/contrib/check_sap.sh b/contrib/check_sap.sh
deleted file mode 100755
index 726d7502..00000000
--- a/contrib/check_sap.sh
+++ /dev/null
@@ -1,89 +0,0 @@
1#!/bin/sh
2################################################################################
3#
4# CHECK_SAP plugin for Nagios
5#
6# Originally Written by Karel Salavec (karel.salavec@ct.cz)
7#
8# Last Modified: 26 May 2003 by Tom De Blende (tom.deblende@village.uunet.be)
9#
10# Version 1.1 (Tom De Blende)
11# - Added output to feed to Nagios instead of just an exit code.
12# - Changed info on where to get the SAP client tools for Linux.
13#
14# Version 1.0 (Karel Salavec)
15#
16# Command line: check_sap.sh <typ_of_check> <param1> <param2> [<param3>]
17#
18# Description:
19# This plugin will attempt to open an SAP connection with the message
20# server or application server.
21# It need the sapinfo program installed on your server (see Notes).
22#
23# Notes:
24# - This plugin requires that the sapinfo program is installed.
25# - Sapinfo is part of a client package that can be found
26# at ftp://ftp.sap.com/pub/linuxlab/contrib/.
27#
28#
29# Parameters:
30# $1 - type of checking - valid values: "ms" = message server
31# "as" = application server
32# $2 - SAP server identification - can be IP address, DNS name or SAP
33# connect string (for example: /H/saprouter/S/sapdp01/H/sapserv3)
34# $3 - for $1="ms" - SAP system name (for example: DEV, TST, ... )
35# for $1="as" - SAP system number - note: central instance have sysnr=00
36# $4 - valid only for $1="ms" - logon group name - default: PUBLIC
37#
38# Example of command definitions for nagios:
39#
40# command[check_sap_ms]=/usr/local/nagios/libexec/check_sap ms $HOSTADDRESS$ $ARG1$ $ARG2$
41# command[check_sap_as]=/usr/local/nagios/libexec/check_sap as $HOSTADDRESS$ $ARG1$
42# command[check_sap_ex]=/usr/local/nagios/libexec/check_sap as $ARG1$ $ARG2$
43# (for ARG1 see SAP OOS1 transaction)
44#
45##############################################################################
46
47sapinfocmd='/usr/sap/rfcsdk/bin/sapinfo'
48grepcmd=`which grep`
49wccmd=`which wc`
50cutcmd=`which cut`
51awkcmd=`which awk`
52
53##############################################################################
54
55if [ $# -lt 3 ]; then
56echo "Usage: $0 <typ_of_check> <param1> <param2> [<param3>]"
57exit 2
58fi
59
60case "$1"
61 in
62 ms)
63 if [ $4 ]
64 then
65 params="r3name=$3 mshost=$2 group=$4"
66 else
67 params="r3name=$3 mshost=$2"
68 fi
69 ;;
70 as)
71 params="ashost=$2 sysnr=$3"
72 ;;
73 *)
74 echo "The first parameter must be ms (message server) or as (application server)!"
75 exit 2
76 ;;
77esac
78
79output="$($sapinfocmd $params)"
80error="$(echo "$output" | $grepcmd ERROR | $wccmd -l)"
81if [ "$error" -gt "0" ]; then
82 output="$(echo "$output" | $grepcmd Key | $cutcmd -dy -f2)"
83 echo "CRITICAL - SAP server not ready: " $output.
84 exit 2
85else
86 output="$(echo "$output" | $grepcmd Destination | $awkcmd '{ print $2 }')"
87 echo "OK - SAP server $output available."
88 exit 0
89fi