May 22, 2021, 5:01 PM

OHS Health/Webpage URL monitoring is quite simple to create then take action when instance/URL:port performance exceeds the threshold. The DevOps MBean consists of the following file parts: WLSDM-LinuxURLPortMonitoring.sh, WLSDM-URLProperties, WLSDM-Health.sh and WLSDM-WebServer.conf.

DevOps MBean Script:

OHS Health/Webpage URL Monitoring. Support multiple URL monitoring.

#Author: Fevzi Korkutata
rootpath=/data/webadmin/volthread/scripts/wlsdm.monitoring/curl.health

propertiesfile=$rootpath/urls.properties

while IFS='=' read -r hostname url;do
        
        resp=$(curl --max-time 10 -s -w %{time_total}\\n -o /dev/null $url)
        awk "BEGIN {printf \"$hostname=%s\\n\", int($resp*1000)}"

done < $propertiesfile

urls.properties file:

TEST_LB_80=http://127.0.0.1/health
TEST_WEB1_7777=http://127.0.0.2:7777/health
TEST_WEB2_7777=http://127.0.0.3:7777/health

healthsh file: for http://{IP}:{OHS-PORT}/health

#Author: Fevzi Korkutata
#!/bin/sh
echo Content-type: text/html
echo
printf "<html>\n";
printf "<head>\n";
printf "<title>OHS Health Check</title>\n";
printf "</head>\n";
printf "<body>\n";
printf "<h3>Hi!</h3>\n";
printf "<p>OHS WebServer HealthCheck Application</p>\n";
printf "<p><b>_date:</b> $(date)</p>\n";
printf "<p><b>_rand01:</b> $(od -N 12 -t uL -An /dev/urandom | tr -d " ")</p>\n";
printf "</body>\n";
printf "</html>\n";

Apache or OHS Configuration:

#Author: Fevzi Korkutata
<Directory "/">
 AllowOverride None
 Require all granted
 Options +ExecCGI
 AddHandler cgi-script .sh
</Directory>Options +MultiViews
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/$1\.html -f [NC]
RewriteRule ^(.+?)/?$ /$1.html [L]RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/$1\.sh -f [NC]
RewriteRule ^(.+?)/?$ /$1.sh [L]

WLSDM Chart Output:

18a5aaa0-b68f-4f71-a86f-d2f33a09103c-image.png


Author: Fevzi Korkutata