This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Problem with monitoring Linux Service.

We've created the following bash script to monitor the status of a specific linux service, while running the script from the server itself it returns the proper result ("failed"), solarwinds returns status up

#!/bin/bash
STR=$(systemctl status <service name> | grep Active | awk '{print $2}')

if [$STR -eq "failed"]
then
echo "Statistic: 1"
else
echo "Statistic: 0"
fi

I've also tried using the linux service monitor someone created here for RHEL, and it also didn't work (showed status down when service was up)