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.

Monitor a linux service and respond to output of a command

I have a service, sssd, that keeps dying on two  Linux servers. While I am waiting to resolve that, I would like to be able to monitor the output of the command:

service sssd status

With the following actions

1) if the word "running" is in the result, set condition up

2) if the word "down" is in the result, set condition down

3) if the word "dead" is in the result, run the command "service sssd restart"

When the service dies, if I login and run the above command, I get the result:

[root@dwdataaccm1 ~]# service sssd status

sssd dead but subsys locked

[root@dwdataaccm1 ~]# service sssd restart

Stopping sssd: cat: /var/run/sssd.pid: No such file or directory

                                                           [FAILED]

Starting sssd:                                             [  OK  ]

[root@dwdataaccm1 ~]#

I would like to use Orion to manage this while we try to find the root cause. Can anyone help? I have searched already and find lots of posts, but none that seem to use the service command, and I don't know perl well enough to modify the existing samples.

Thanks.

  • I have a service, sssd, that keeps dying on two  Linux servers. While I am waiting to resolve that, I would like to be able to monitor the output of the command:

    service sssd status

    With the following actions

    1) if the word "running" is in the result, set condition up

    2) if the word "down" is in the result, set condition down

    3) if the word "dead" is in the result, run the command "service sssd restart"

    Same question here and this is what I understand thus far:

    1. the only way to do what you need is to use a "Linux/Unix Script Monitor" available via "Server and Application Monitor" (SAM) product - which is separate from NPM.
    2. this would involve writing a short script that runs a "service status" status command and captures the output
    3. restarting a service would involve creating an alert where a "trigger" action is a script

    (I wish this was as simple as with Windows services)