summaryrefslogtreecommitdiffstats
path: root/contrib/check_sap.sh
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/check_sap.sh')
-rwxr-xr-xcontrib/check_sap.sh70
1 files changed, 70 insertions, 0 deletions
diff --git a/contrib/check_sap.sh b/contrib/check_sap.sh
new file mode 100755
index 0000000..eadf977
--- /dev/null
+++ b/contrib/check_sap.sh
@@ -0,0 +1,70 @@
1#!/bin/sh
2################################################################################
3#
4# CHECK_SAP plugin for Nagios
5#
6# Written by Karel Salavec (karel.salavec@ct.cz)
7# Last Modified: 20Apr2000
8#
9# Command line: CHECK_SAP <typ_of_check> <param1> <param2> [<param3>]
10#
11# Description:
12# This plugin will attempt to open an SAP connection with the message
13# server or application server.
14# It need the sapinfo program installed on your server (see Notes).
15#
16# Notes:
17# - This plugin requires that the saprfc-devel-45A-1.i386.rpm (or higher)
18# package be installed on your machine. Sapinfo program
19# is a part of this package.
20# - You can find this package at SAP ftp server in
21# /general/misc/unsupported/linux
22#
23#
24# Parameters:
25# $1 - type of checking - valid values: "ms" = message server
26# "as" = application server
27# $2 - SAP server identification - can be IP address, DNS name or SAP
28# connect string (for example: /H/saprouter/S/sapdp01/H/sapserv3)
29# $3 - for $1="ms" - SAP system name (for example: DEV, TST, ... )
30# for $1="as" - SAP system number - note: central instance have sysnr=00
31# $4 - valid only for $1="ms" - logon group name - default: PUBLIC
32#
33# Example of command definitions for nagios:
34#
35# command[check_sap_ms]=/usr/local/nagios/libexec/check_sap ms $HOSTADDRESS$ $ARG1$ $ARG2$
36# command[check_sap_as]=/usr/local/nagios/libexec/check_sap as $HOSTADDRESS$ $ARG1$
37# command[check_sap_ex]=/usr/local/nagios/libexec/check_sap as $ARG1$ $ARG2$
38# (for ARG1 see SAP OOS1 transaction)
39#
40##############################################################################
41
42if [ $# -lt 3 ]; then
43echo "Need min. 3 parameters"
44exit 2
45fi
46
47case "$1"
48 in
49 ms)
50 if [ $4 ]
51 then
52 params="r3name=$3 mshost=$2 group=$4"
53 else
54 params="r3name=$3 mshost=$2"
55 fi
56 ;;
57 as)
58 params="ashost=$2 sysnr=$3"
59 ;;
60 *)
61 echo "The first parametr must be ms (message server) or as (application server)!"
62 exit 2
63 ;;
64esac
65
66if /usr/sap/rfcsdk/bin/sapinfo $params | grep -i ERROR ; then
67exit 2
68else
69exit 0
70fi