Simple check to see if a service is running


#1

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.


#2

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.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.


#3

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.


#4

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

···

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.

{
  "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.


#5

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

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.


#6

I copy-pasted the plugin and changed the service to “ssh”, and the configurtion. But I am getting this error in sensu: 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

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.


#7

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_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

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.


#8

I copy-pasted the configuration you linked to but changed the service to ssh. It’s not working at all. 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

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.


#9

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

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.