Does anyone have a SAM component template for monitoring the output a Linux command?
We have two Linux servers we have configured to use SSSD authentication to an AD server with LDAP and Kerberos. For some reason, the SSSD service keeps dying. If I login manually and run the command:
service sssd status
I get the following result:
sssd dead but subsys locked
I would like a Linux script template that will monitor the service using the service x status command, and if the word "dead" is in the response, I want to be paged.
If possible, I'd also like the script to run the start command as well. So, I need a script that:
1) run "service sssd status"
2) And reacts
a) if finds "running" returns "up"
b) if finds "stopped" returns "down"
c) if finds "dead" starts the service and maybe sends an alert email.
Can anyone help? Note, not a perl user, but I'll by a book if necessary.....
Also, if this can be done on the Orion server by using an ssh command and reacting to the result, that is fine too. I can do vbscript better than perl. For example, if there is an orion monitor that runs a ssh command
ssh root@remoteserver "service sssd status"
sssd (pid 31198) is running...
There is a SAM template that you could probably re-purpose for this called 'Linux single running process status.'
Copy that as new and edit it. Then you can edit the script which is written in bash. You shouldn't need to tweak it too much to get the results you're looking for, including the service restarts.