HEX
Server: Apache/2.4.34 (Red Hat) OpenSSL/1.0.2k-fips
System: Linux WORDPRESS 3.10.0-1160.118.1.el7.x86_64 #1 SMP Thu Apr 4 03:33:23 EDT 2024 x86_64
User: digital (1020)
PHP: 7.2.24
Disabled: NONE
Upload Files
File: //var/opt/OV/bin/instrumentation/check_SAP_Portal.sh
#!/bin/bash
# Monitoreo de los prosesos de java
#  server0 - icm - SDM - dispatcher.
# por ARiel Tarallo -. 06-01-2012 Level 3
#
mon_name=$1 # recibe nombre de monitor. 
usuario=$2
service=$3
instancia=$4
stat1="J2EE_RUNNING"
stat2="Running"

#echo "Running services status:"

#Verifico los servicios de SAP 

su - $usuario -c "sapcontrol -nr $instancia -function J2EEGetProcessList"| grep $service |awk -F',' '{print $2 "|" $7 "|" $8}' | while read LINE
do
# leo el resultado y busco el servicio.
	status1=$(echo $LINE | awk -F'|' '{print $2}')
	status1=`echo $status1`
	status2=$(echo $LINE | awk -F'|' '{print $3}')
	status2=`echo $status2`
	if [ $status1 == $stat1 ]; then
		if [ $status2 == $stat2 ]; then
			/opt/OV/bin/opcmon $mon_name=0 -object $service:$instancia 
		else
			/opt/OV/bin/opcmon $mon_name=1 -object $service:$instancia 
		fi
	else
			/opt/OV/bin/opcmon $mon_name=2 -object $service:$instancia 
	fi
done

exit 0