what is the best way to monitor server availability & reachability using (operations agent policy templates) only without relaying on using the SiteScope ping monitor
Cybersecurity
DevOps Cloud
IT Operations Cloud
If an answer to your question is correct, click on "Verify Answer" under the "More" button. The answer will now appear with a checkmark. Please be sure to always mark answers that resolve your issue as verified. Your fellow Community members will appreciate it!  Learn more
what is the best way to monitor server availability & reachability using (operations agent policy templates) only without relaying on using the SiteScope ping monitor
Hello,
Thanks for the post.
Below is a sample unsupported script you can use to check if a server is online using ping
and verify if a web service is running. This is a basic example intended to demonstrate how you can achieve your goals.
Please note:
echo
lines (e.g., prepend with #
) before using the script in production to avoid unnecessary output.opcmsg
utility uses the -node
option, which allows you to test the status of a node from another node.opcmon
rather than opcmsg
, you can include the -option nodename=$SERVER_NAME
parameter which is used to pass the remote node name into the monitor.#!/bin/bash
# Unsupported script
SERVER_NAME="server.name.com"
SERVICE_URL=http://$SERVER_NAME/myservice
OPCMSG=/opt/OV/bin/opcmsg
# Check if the server is online using ping:
if ping -c 1 "$SERVER_NAME" &> /dev/null; then
echo "$SERVER_NAME is online."
# Check if the web service is running:
echo "Checking service at $SERVICE_URL..."
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" "$SERVICE_URL")
if [ "$HTTP_STATUS" -eq 200 ]; then
echo "Service is running. HTTP Status: $HTTP_STATUS"
# Send opcmsg or opcmon:
$OPCMSG o=webserver a=myApp \
msg_text="Service is running. HTTP Status: $HTTP_STATUS" \
-node=$SERVER_NAME severity=normal
else
echo "Service is not running. HTTP Status: $HTTP_STATUS"
# Send opcmsg or opcmon:
$OPCMSG o=webserver a=myApp \
msg_text="Service is NOT running. HTTP Status: $HTTP_STATUS" \
-node=$SERVER_NAME severity=critical
fi
else
echo "Server $SERVER_NAME is offline."
# Send opcmsg or opcmon:
$OPCMSG o=webserver a=myApp \
msg_text="Server is offline." \
-node=$SERVER_NAME severity=critical
fi
This script is intended to provide a starting point for your implementation.
I hope this helps.
how to use the above script , which policy type ?
Hello,
The above example uses opcmsg which is the "Open Message Interface Policy" type. This is the policy type that opcmsg uses and is used in the above sample example:
https://docs.microfocus.com/doc/Operations_Bridge_Manager/2023.05/omucptopenmsghtml
https://docs.microfocus.com/doc/Operations_Agent/12.27/opcmsg
But you could also use opcmon which is the "Measurement Threshold Policy" type:
https://docs.microfocus.com/doc/Operations_Bridge_Manager/2023.05/OmptMeasurementThresholdhtml
https://docs.microfocus.com/doc/Operations_Agent/12.27/opcmon
However there are other choices you can make: the various policy templates are described here: https://docs.microfocus.com/doc/Operations_Bridge_Manager/2023.05/OmPtAbouthtml
Thanks.