Automatic deregister hosts/instances when sensu-client is shutdown cleanly


#1

Hi,

According to the update in 0.20.6 (https://github.com/sensu/sensu/blob/master/CHANGELOG.md#0206---2015-09-22), am I understanding correctly that

when sensu-client service is stopped on a host

and there are no outstanding “alerts” for that host

then the sensu-api service will remove the host from sensu

is this correct ?

If not, is the above “feature” still being worked on ? If so, is there a github issue for it and a ETA for it (or a roadmap) ?

Thanks

Alex


#2

This is not correct. This changelog entry references the "Sensu API",
and removing client from it. (sensu-cli client delete, etc) This is
not related to stopping the sensu-client service.

AFAIK the above feature is not being worked on, as it would violate
the principle of least surprise.
If you wanted to implement this feature locally, you could do
something like the equivalent of a "post-start" script in upstart that
runs "sensu-cli client delete" to delete the client.
At work we have a similar init script that runs a deregister on
runlevel 0 (halt).

···

On Fri, Jan 8, 2016 at 3:25 AM, Alex Leonhardt <aleonhardt.py@gmail.com> wrote:

Hi,

According to the update in 0.20.6
(https://github.com/sensu/sensu/blob/master/CHANGELOG.md#0206---2015-09-22),
am I understanding correctly that

when sensu-client service is stopped on a host
and there are no outstanding "alerts" for that host
then the sensu-api service will remove the host from sensu

is this correct ?

If not, is the above "feature" still being worked on ? If so, is there a
github issue for it and a ETA for it (or a roadmap) ?

Thanks
Alex


#3

Oh I see - there was a forum post some time ago where someone said that it was going to be part of 0.21 (or on the roadmap for it) but then didn’t see it in the changelog for it, then saw the 0.20.6 update which sounded like it…

Does the client need to have access to the api(make api call) or is the delete happening via MQ when using sensu-cli ? Fwiw, I didn’t even know about sensu-cli existing so thanks! :slight_smile:

Thanks!

Alex

···

On 8 Jan 2016 3:47 p.m., “Kyle Anderson” kyle@xkyle.com wrote:

This is not correct. This changelog entry references the “Sensu API”,

and removing client from it. (sensu-cli client delete, etc) This is

not related to stopping the sensu-client service.

AFAIK the above feature is not being worked on, as it would violate

the principle of least surprise.

If you wanted to implement this feature locally, you could do

something like the equivalent of a “post-start” script in upstart that

runs “sensu-cli client delete” to delete the client.

At work we have a similar init script that runs a deregister on

runlevel 0 (halt).

On Fri, Jan 8, 2016 at 3:25 AM, Alex Leonhardt aleonhardt.py@gmail.com wrote:

Hi,

According to the update in 0.20.6

(https://github.com/sensu/sensu/blob/master/CHANGELOG.md#0206—2015-09-22),

am I understanding correctly that

when sensu-client service is stopped on a host

and there are no outstanding “alerts” for that host

then the sensu-api service will remove the host from sensu

is this correct ?

If not, is the above “feature” still being worked on ? If so, is there a

github issue for it and a ETA for it (or a roadmap) ?

Thanks

Alex


#4

I guess you’re using this : https://github.com/agent462/sensu-cli - which does use the api to remove itself :frowning: … as our sensu server actually lives in a completely separate network (with hosts that run sensu-client not able to access it) this won’t work, still … :confused:

I’ll see if I find an alternative solution then - we already have one when the ASG terminates a host, but it’s not ideal … I’d rather have the client drop a message to the sensu-api (when/if it shuts down cleanly) to tell the sensu-server (receiving the message) to send a api request to delete that host / resource …

Ta!

Alex

···

On 8 January 2016 at 16:11, Alex Leonhardt aleonhardt.py@gmail.com wrote:

Oh I see - there was a forum post some time ago where someone said that it was going to be part of 0.21 (or on the roadmap for it) but then didn’t see it in the changelog for it, then saw the 0.20.6 update which sounded like it…

Does the client need to have access to the api(make api call) or is the delete happening via MQ when using sensu-cli ? Fwiw, I didn’t even know about sensu-cli existing so thanks! :slight_smile:

Thanks!

Alex

On 8 Jan 2016 3:47 p.m., “Kyle Anderson” kyle@xkyle.com wrote:

This is not correct. This changelog entry references the “Sensu API”,

and removing client from it. (sensu-cli client delete, etc) This is

not related to stopping the sensu-client service.

AFAIK the above feature is not being worked on, as it would violate

the principle of least surprise.

If you wanted to implement this feature locally, you could do

something like the equivalent of a “post-start” script in upstart that

runs “sensu-cli client delete” to delete the client.

At work we have a similar init script that runs a deregister on

runlevel 0 (halt).

On Fri, Jan 8, 2016 at 3:25 AM, Alex Leonhardt aleonhardt.py@gmail.com wrote:

Hi,

According to the update in 0.20.6

(https://github.com/sensu/sensu/blob/master/CHANGELOG.md#0206—2015-09-22),

am I understanding correctly that

when sensu-client service is stopped on a host

and there are no outstanding “alerts” for that host

then the sensu-api service will remove the host from sensu

is this correct ?

If not, is the above “feature” still being worked on ? If so, is there a

github issue for it and a ETA for it (or a roadmap) ?

Thanks

Alex

gpg public key: http://dpaste.com/1CEJ38Z


#5

Sensu-client will send anything on :3030 to the server via rmq. Just have an init script that upon shutdown drops something on that port for the server to recieve. On the server side have a handler that issues the api call. Simple, easy, and effective.

···

On Fri, Jan 8, 2016 at 11:54 AM, Alex Leonhardt aleonhardt.py@gmail.com wrote:

I guess you’re using this : https://github.com/agent462/sensu-cli - which does use the api to remove itself :frowning: … as our sensu server actually lives in a completely separate network (with hosts that run sensu-client not able to access it) this won’t work, still … :confused:

I’ll see if I find an alternative solution then - we already have one when the ASG terminates a host, but it’s not ideal … I’d rather have the client drop a message to the sensu-api (when/if it shuts down cleanly) to tell the sensu-server (receiving the message) to send a api request to delete that host / resource …

Ta!

Alex

On 8 January 2016 at 16:11, Alex Leonhardt aleonhardt.py@gmail.com wrote:

Oh I see - there was a forum post some time ago where someone said that it was going to be part of 0.21 (or on the roadmap for it) but then didn’t see it in the changelog for it, then saw the 0.20.6 update which sounded like it…

Does the client need to have access to the api(make api call) or is the delete happening via MQ when using sensu-cli ? Fwiw, I didn’t even know about sensu-cli existing so thanks! :slight_smile:

Thanks!

Alex

On 8 Jan 2016 3:47 p.m., “Kyle Anderson” kyle@xkyle.com wrote:

This is not correct. This changelog entry references the “Sensu API”,

and removing client from it. (sensu-cli client delete, etc) This is

not related to stopping the sensu-client service.

AFAIK the above feature is not being worked on, as it would violate

the principle of least surprise.

If you wanted to implement this feature locally, you could do

something like the equivalent of a “post-start” script in upstart that

runs “sensu-cli client delete” to delete the client.

At work we have a similar init script that runs a deregister on

runlevel 0 (halt).

On Fri, Jan 8, 2016 at 3:25 AM, Alex Leonhardt aleonhardt.py@gmail.com wrote:

Hi,

According to the update in 0.20.6

(https://github.com/sensu/sensu/blob/master/CHANGELOG.md#0206—2015-09-22),

am I understanding correctly that

when sensu-client service is stopped on a host

and there are no outstanding “alerts” for that host

then the sensu-api service will remove the host from sensu

is this correct ?

If not, is the above “feature” still being worked on ? If so, is there a

github issue for it and a ETA for it (or a roadmap) ?

Thanks

Alex

gpg public key: http://dpaste.com/1CEJ38Z

Matt Jones @DevopsMatt

Infrastructure Engineer - Yieldbot Inc.

Core Contributor - Sensu Plugins

Co-Organizer - Boston Infrastructure Coders

https://linkedin.com/in/mattyjones


#6

Oh, great stuff, thanks! I’ll try that! :slight_smile:

Thanks!

Alex

···

On 8 January 2016 at 19:26, Matt Jones mattjones@yieldbot.com wrote:

Sensu-client will send anything on :3030 to the server via rmq. Just have an init script that upon shutdown drops something on that port for the server to recieve. On the server side have a handler that issues the api call. Simple, easy, and effective.

On Fri, Jan 8, 2016 at 11:54 AM, Alex Leonhardt aleonhardt.py@gmail.com wrote:

I guess you’re using this : https://github.com/agent462/sensu-cli - which does use the api to remove itself :frowning: … as our sensu server actually lives in a completely separate network (with hosts that run sensu-client not able to access it) this won’t work, still … :confused:

I’ll see if I find an alternative solution then - we already have one when the ASG terminates a host, but it’s not ideal … I’d rather have the client drop a message to the sensu-api (when/if it shuts down cleanly) to tell the sensu-server (receiving the message) to send a api request to delete that host / resource …

Ta!

Alex

Matt Jones @DevopsMatt

Infrastructure Engineer - Yieldbot Inc.

Core Contributor - Sensu Plugins

Co-Organizer - Boston Infrastructure Coders

https://linkedin.com/in/mattyjones

On 8 January 2016 at 16:11, Alex Leonhardt aleonhardt.py@gmail.com wrote:

Oh I see - there was a forum post some time ago where someone said that it was going to be part of 0.21 (or on the roadmap for it) but then didn’t see it in the changelog for it, then saw the 0.20.6 update which sounded like it…

Does the client need to have access to the api(make api call) or is the delete happening via MQ when using sensu-cli ? Fwiw, I didn’t even know about sensu-cli existing so thanks! :slight_smile:

Thanks!

Alex

On 8 Jan 2016 3:47 p.m., “Kyle Anderson” kyle@xkyle.com wrote:

This is not correct. This changelog entry references the “Sensu API”,

and removing client from it. (sensu-cli client delete, etc) This is

not related to stopping the sensu-client service.

AFAIK the above feature is not being worked on, as it would violate

the principle of least surprise.

If you wanted to implement this feature locally, you could do

something like the equivalent of a “post-start” script in upstart that

runs “sensu-cli client delete” to delete the client.

At work we have a similar init script that runs a deregister on

runlevel 0 (halt).

On Fri, Jan 8, 2016 at 3:25 AM, Alex Leonhardt aleonhardt.py@gmail.com wrote:

Hi,

According to the update in 0.20.6

(https://github.com/sensu/sensu/blob/master/CHANGELOG.md#0206—2015-09-22),

am I understanding correctly that

when sensu-client service is stopped on a host

and there are no outstanding “alerts” for that host

then the sensu-api service will remove the host from sensu

is this correct ?

If not, is the above “feature” still being worked on ? If so, is there a

github issue for it and a ETA for it (or a roadmap) ?

Thanks

Alex

gpg public key: http://dpaste.com/1CEJ38Z

gpg public key: http://dpaste.com/1CEJ38Z