# Simple check to see if a service is running

**URL:** <https://discourse.sensu.io/t/simple-check-to-see-if-a-service-is-running/302>\
**Category:** Sensu Classic (EOL)\
**Created:** [November 4, 2014, 4:49pm UTC](https://discourse.sensu.io/t/simple-check-to-see-if-a-service-is-running/302 "2014-11-04T16:49:02Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![anders\_johannsen](https://avatars.discourse-cdn.com/v4/letter/a/53a042/32.png) [@anders\_johannsen](https://discourse.sensu.io/u/anders_johannsen)\
**Post date:** [November 4, 2014, 4:49pm UTC](https://discourse.sensu.io/t/simple-check-to-see-if-a-service-is-running/302/1 "2014-11-04T16:49:02Z")

</div>

Hello! I am new to sensu, I have managed to install it on the Server and Client and the Keep Alive works great.

Is anyone able to show me an example of a simple check which checks if the service ssh or postfix is running? I have not been able to find an simple example yet. Thanks alot.

---

<div class="post-metadata">

**Author:** ![Bryan\_Brandau](https://avatars.discourse-cdn.com/v4/letter/b/a87d85/32.png) [@Bryan\_Brandau](https://discourse.sensu.io/u/Bryan_Brandau)\
**Post date:** [November 4, 2014, 4:53pm UTC](https://discourse.sensu.io/t/simple-check-to-see-if-a-service-is-running/302/2 "2014-11-04T16:53:37Z")

</div>

Most people are probably using the nagios check\_procs plugin.

{  
&nbsp;&nbsp;"checks": {  
&nbsp;&nbsp;&nbsp;&nbsp;"sshd-min1-max12": {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"command": "PATH=$PATH:/usr/lib64/nagios/plugins check\_procs -C  
sshd -c 1:12",  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"handlers": [  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"bby"  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;],  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"subscribers": [  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;“web"  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;],  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"interval": 60,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"refresh": 1800,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"occurrences": 2  
&nbsp;&nbsp;&nbsp;&nbsp;}  
&nbsp;&nbsp;}  
}

> **···**
>
> On Tue, Nov 4, 2014 at 10:49 AM, anders johannsen \<anders.steria@gmail.com\> wrote:
> 
> > Hello! I am new to sensu, I have managed to install it on the Server and  
> > Client and the Keep Alive works great.
> > 
> > Is anyone able to show me an example of a simple check which checks if the  
> > service ssh or postfix is running? I have not been able to find an simple  
> > example yet. Thanks alot.

---

<div class="post-metadata">

**Author:** ![anders\_johannsen](https://avatars.discourse-cdn.com/v4/letter/a/53a042/32.png) [@anders\_johannsen](https://discourse.sensu.io/u/anders_johannsen)\
**Post date:** [November 4, 2014, 4:57pm UTC](https://discourse.sensu.io/t/simple-check-to-see-if-a-service-is-running/302/3 "2014-11-04T16:57:43Z")

</div>

Is it any way to do it with sensu?

> **···**
>
> On Tuesday, November 4, 2014 5:53:38 PM UTC+1, agent462 wrote:
> 
> > Most people are probably using the nagios check\_procs plugin.
> > 
> > {  
> > “checks”: {  
> > “sshd-min1-max12”: {  
> > “command”: “PATH=$PATH:/usr/lib64/nagios/plugins check\_procs -C  
> > sshd -c 1:12”,  
> > “handlers”: [  
> > “bby”  
> > ],  
> > “subscribers”: [  
> > “web"  
> > ],  
> > “interval”: 60,  
> > “refresh”: 1800,  
> > “occurrences”: 2  
> > }  
> > }  
> > }
> > 
> > On Tue, Nov 4, 2014 at 10:49 AM, anders johannsen \> [anders...@gmail.com](mailto:anders...@gmail.com) wrote:
> > 
> > > Hello! I am new to sensu, I have managed to install it on the Server and  
> > > Client and the Keep Alive works great.
> > > 
> > > Is anyone able to show me an example of a simple check which checks if the  
> > > service ssh or postfix is running? I have not been able to find an simple  
> > > example yet. Thanks alot.

---

<div class="post-metadata">

**Author:** ![Bryan\_Brandau](https://avatars.discourse-cdn.com/v4/letter/b/a87d85/32.png) [@Bryan\_Brandau](https://discourse.sensu.io/u/Bryan_Brandau)\
**Post date:** [November 4, 2014, 4:59pm UTC](https://discourse.sensu.io/t/simple-check-to-see-if-a-service-is-running/302/4 "2014-11-04T16:59:54Z")

</div>

This is using sensu. You can use any of the nagios plugins with Sensu.

It’s talked about here: [http://sensuapp.org/docs/latest/checks](http://sensuapp.org/docs/latest/checks)

> **···**
>
> On Tue, Nov 4, 2014 at 10:57 AM, anders johannsen \<anders.steria@gmail.com\> wrote:
> 
> > Is it any way to do it with sensu?
> > 
> > On Tuesday, November 4, 2014 5:53:38 PM UTC+1, agent462 wrote:
> > 
> > > Most people are probably using the nagios check\_procs plugin.
> > > 
> > > {  
> > > &nbsp;&nbsp;"checks": {  
> > > &nbsp;&nbsp;&nbsp;&nbsp;"sshd-min1-max12": {  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"command": "PATH=$PATH:/usr/lib64/nagios/plugins check\_procs -C  
> > > sshd -c 1:12",  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"handlers": [  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"bby"  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;],  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"subscribers": [  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;“web"  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;],  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"interval": 60,  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"refresh": 1800,  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"occurrences": 2  
> > > &nbsp;&nbsp;&nbsp;&nbsp;}  
> > > &nbsp;&nbsp;}  
> > > }
> > > 
> > > On Tue, Nov 4, 2014 at 10:49 AM, anders johannsen \>\> \<anders...@gmail.com\> wrote:  
> > > \> Hello! I am new to sensu, I have managed to install it on the Server and  
> > > \> Client and the Keep Alive works great.  
> > > \>  
> > > \> Is anyone able to show me an example of a simple check which checks if  
> > > \> the  
> > > \> service ssh or postfix is running? I have not been able to find an  
> > > \> simple  
> > > \> example yet. Thanks alot.

---

<div class="post-metadata">

**Author:** ![anders\_johannsen](https://avatars.discourse-cdn.com/v4/letter/a/53a042/32.png) [@anders\_johannsen](https://discourse.sensu.io/u/anders_johannsen)\
**Post date:** [November 4, 2014, 5:22pm UTC](https://discourse.sensu.io/t/simple-check-to-see-if-a-service-is-running/302/5 "2014-11-04T17:22:51Z")

</div>

Thanks! One fast question for you. Do I need both the plugin and check configuration on both client and the server ?

> **···**
>
> On Tuesday, November 4, 2014 5:59:55 PM UTC+1, agent462 wrote:
> 
> > This is using sensu. You can use any of the nagios plugins with Sensu.
> > 
> > It’s talked about here: [http://sensuapp.org/docs/latest/checks](http://sensuapp.org/docs/latest/checks)
> > 
> > On Tue, Nov 4, 2014 at 10:57 AM, anders johannsen \> [anders...@gmail.com](mailto:anders...@gmail.com) wrote:
> > 
> > > Is it any way to do it with sensu?
> > > 
> > > On Tuesday, November 4, 2014 5:53:38 PM UTC+1, agent462 wrote:
> > > 
> > > > Most people are probably using the nagios check\_procs plugin.
> > > > 
> > > > {  
> > > > “checks”: {  
> > > > “sshd-min1-max12”: {  
> > > > “command”: “PATH=$PATH:/usr/lib64/nagios/plugins check\_procs -C  
> > > > sshd -c 1:12”,  
> > > > “handlers”: [  
> > > > “bby”  
> > > > ],  
> > > > “subscribers”: [  
> > > > “web"  
> > > > ],  
> > > > “interval”: 60,  
> > > > “refresh”: 1800,  
> > > > “occurrences”: 2  
> > > > }  
> > > > }  
> > > > }
> > > > 
> > > > On Tue, Nov 4, 2014 at 10:49 AM, anders johannsen \> \>\> [anders...@gmail.com](mailto:anders...@gmail.com) wrote:
> > > > 
> > > > > Hello! I am new to sensu, I have managed to install it on the Server and  
> > > > > Client and the Keep Alive works great.
> > > > > 
> > > > > Is anyone able to show me an example of a simple check which checks if  
> > > > > the  
> > > > > service ssh or postfix is running? I have not been able to find an  
> > > > > simple  
> > > > > example yet. Thanks alot.

---

<div class="post-metadata">

**Author:** ![anders\_johannsen](https://avatars.discourse-cdn.com/v4/letter/a/53a042/32.png) [@anders\_johannsen](https://discourse.sensu.io/u/anders_johannsen)\
**Post date:** [November 4, 2014, 5:42pm UTC](https://discourse.sensu.io/t/simple-check-to-see-if-a-service-is-running/302/6 "2014-11-04T17:42:00Z")

</div>

I copy-pasted the plugin and changed the service to “ssh”, and the configurtion. But I am getting this error in sensu: [Dropbox - Error - Simplify your life](https://www.dropbox.com/s/tfgcbswvtt7raa8/2014-11-04%2018_40_49-chef_client%20-%20loadbalancer01-pound%20_%20Uchiwa.png?dl=0)

> **···**
>
> On Tuesday, November 4, 2014 5:59:55 PM UTC+1, agent462 wrote:
> 
> > This is using sensu. You can use any of the nagios plugins with Sensu.
> > 
> > It’s talked about here: [http://sensuapp.org/docs/latest/checks](http://sensuapp.org/docs/latest/checks)
> > 
> > On Tue, Nov 4, 2014 at 10:57 AM, anders johannsen \> [anders...@gmail.com](mailto:anders...@gmail.com) wrote:
> > 
> > > Is it any way to do it with sensu?
> > > 
> > > On Tuesday, November 4, 2014 5:53:38 PM UTC+1, agent462 wrote:
> > > 
> > > > Most people are probably using the nagios check\_procs plugin.
> > > > 
> > > > {  
> > > > “checks”: {  
> > > > “sshd-min1-max12”: {  
> > > > “command”: “PATH=$PATH:/usr/lib64/nagios/plugins check\_procs -C  
> > > > sshd -c 1:12”,  
> > > > “handlers”: [  
> > > > “bby”  
> > > > ],  
> > > > “subscribers”: [  
> > > > “web"  
> > > > ],  
> > > > “interval”: 60,  
> > > > “refresh”: 1800,  
> > > > “occurrences”: 2  
> > > > }  
> > > > }  
> > > > }
> > > > 
> > > > On Tue, Nov 4, 2014 at 10:49 AM, anders johannsen \> \>\> [anders...@gmail.com](mailto:anders...@gmail.com) wrote:
> > > > 
> > > > > Hello! I am new to sensu, I have managed to install it on the Server and  
> > > > > Client and the Keep Alive works great.
> > > > > 
> > > > > Is anyone able to show me an example of a simple check which checks if  
> > > > > the  
> > > > > service ssh or postfix is running? I have not been able to find an  
> > > > > simple  
> > > > > example yet. Thanks alot.

---

<div class="post-metadata">

**Author:** ![Bryan\_Brandau](https://avatars.discourse-cdn.com/v4/letter/b/a87d85/32.png) [@Bryan\_Brandau](https://discourse.sensu.io/u/Bryan_Brandau)\
**Post date:** [November 4, 2014, 5:45pm UTC](https://discourse.sensu.io/t/simple-check-to-see-if-a-service-is-running/302/7 "2014-11-04T17:45:10Z")

</div>

The answer would depend on what type you are using. There are  
stand-alone checks and subscriptions.

At the top of these articles, you will see bullet points of what are needed:  
[http://sensuapp.org/docs/latest/adding\_a\_check](http://sensuapp.org/docs/latest/adding_a_check)  
[http://sensuapp.org/docs/latest/adding\_a\_standalone\_check](http://sensuapp.org/docs/latest/adding_a_standalone_check)

> **···**
>
> On Tue, Nov 4, 2014 at 11:22 AM, anders johannsen \<anders.steria@gmail.com\> wrote:
> 
> > Thanks! One fast question for you. Do I need both the plugin and check  
> > configuration on both client and the server ?
> > 
> > On Tuesday, November 4, 2014 5:59:55 PM UTC+1, agent462 wrote:
> > 
> > > This is using sensu. You can use any of the nagios plugins with Sensu.
> > > 
> > > It’s talked about here: [http://sensuapp.org/docs/latest/checks](http://sensuapp.org/docs/latest/checks)
> > > 
> > > On Tue, Nov 4, 2014 at 10:57 AM, anders johannsen \>\> \<anders...@gmail.com\> wrote:  
> > > \> Is it any way to do it with sensu?  
> > > \>  
> > > \> On Tuesday, November 4, 2014 5:53:38 PM UTC+1, agent462 wrote:  
> > > \>\>  
> > > \>\> Most people are probably using the nagios check\_procs plugin.  
> > > \>\>  
> > > \>\> {  
> > > \>\> "checks": {  
> > > \>\> "sshd-min1-max12": {  
> > > \>\> "command": "PATH=$PATH:/usr/lib64/nagios/plugins check\_procs -C  
> > > \>\> sshd -c 1:12",  
> > > \>\> "handlers": [  
> > > \>\> "bby"  
> > > \>\> ],  
> > > \>\> "subscribers": [  
> > > \>\> “web"  
> > > \>\> ],  
> > > \>\> "interval": 60,  
> > > \>\> "refresh": 1800,  
> > > \>\> "occurrences": 2  
> > > \>\> }  
> > > \>\> }  
> > > \>\> }  
> > > \>\>  
> > > \>\> On Tue, Nov 4, 2014 at 10:49 AM, anders johannsen \>\> \>\> \<anders...@gmail.com\> wrote:  
> > > \>\> \> Hello! I am new to sensu, I have managed to install it on the Server  
> > > \>\> \> and  
> > > \>\> \> Client and the Keep Alive works great.  
> > > \>\> \>  
> > > \>\> \> Is anyone able to show me an example of a simple check which checks  
> > > \>\> \> if  
> > > \>\> \> the  
> > > \>\> \> service ssh or postfix is running? I have not been able to find an  
> > > \>\> \> simple  
> > > \>\> \> example yet. Thanks alot.

---

<div class="post-metadata">

**Author:** ![anders\_johannsen](https://avatars.discourse-cdn.com/v4/letter/a/53a042/32.png) [@anders\_johannsen](https://discourse.sensu.io/u/anders_johannsen)\
**Post date:** [November 4, 2014, 6:21pm UTC](https://discourse.sensu.io/t/simple-check-to-see-if-a-service-is-running/302/8 "2014-11-04T18:21:30Z")

</div>

I copy-pasted the configuration you linked to but changed the service to ssh. It’s not working at all. [Dropbox - Error - Simplify your life](https://www.dropbox.com/s/tfgcbswvtt7raa8/2014-11-04%2018_40_49-chef_client%20-%20loadbalancer01-pound%20_%20Uchiwa.png?dl=0)

> **···**
>
> On Tuesday, November 4, 2014 5:59:55 PM UTC+1, agent462 wrote:
> 
> > This is using sensu. You can use any of the nagios plugins with Sensu.
> > 
> > It’s talked about here: [http://sensuapp.org/docs/latest/checks](http://sensuapp.org/docs/latest/checks)
> > 
> > On Tue, Nov 4, 2014 at 10:57 AM, anders johannsen \> [anders...@gmail.com](mailto:anders...@gmail.com) wrote:
> > 
> > > Is it any way to do it with sensu?
> > > 
> > > On Tuesday, November 4, 2014 5:53:38 PM UTC+1, agent462 wrote:
> > > 
> > > > Most people are probably using the nagios check\_procs plugin.
> > > > 
> > > > {  
> > > > “checks”: {  
> > > > “sshd-min1-max12”: {  
> > > > “command”: “PATH=$PATH:/usr/lib64/nagios/plugins check\_procs -C  
> > > > sshd -c 1:12”,  
> > > > “handlers”: [  
> > > > “bby”  
> > > > ],  
> > > > “subscribers”: [  
> > > > “web"  
> > > > ],  
> > > > “interval”: 60,  
> > > > “refresh”: 1800,  
> > > > “occurrences”: 2  
> > > > }  
> > > > }  
> > > > }
> > > > 
> > > > On Tue, Nov 4, 2014 at 10:49 AM, anders johannsen \> \>\> [anders...@gmail.com](mailto:anders...@gmail.com) wrote:
> > > > 
> > > > > Hello! I am new to sensu, I have managed to install it on the Server and  
> > > > > Client and the Keep Alive works great.
> > > > > 
> > > > > Is anyone able to show me an example of a simple check which checks if  
> > > > > the  
> > > > > service ssh or postfix is running? I have not been able to find an  
> > > > > simple  
> > > > > example yet. Thanks alot.

---

<div class="post-metadata">

**Author:** ![Florin\_Andrei](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.sensu.io/florin_andrei/32/674_2.png) [@Florin\_Andrei](https://discourse.sensu.io/u/Florin_Andrei)\
**Post date:** [November 5, 2014, 1:08am UTC](https://discourse.sensu.io/t/simple-check-to-see-if-a-service-is-running/302/9 "2014-11-05T01:08:52Z")

</div>

This is literally the first task in the Documentation after installing Sensu:

[http://sensuapp.org/docs/latest/adding\_a\_check](http://sensuapp.org/docs/latest/adding_a_check)

Replace “crond” in that example with “sshd” or whatever.

> **···**
>
> On Tuesday, November 4, 2014 8:49:02 AM UTC-8, anders johannsen wrote:
> 
> > Hello! I am new to sensu, I have managed to install it on the Server and Client and the Keep Alive works great.
> 
> > Is anyone able to show me an example of a simple check which checks if the service ssh or postfix is running? I have not been able to find an simple example yet. Thanks alot.
