On Wed, Apr 1, 2015 at 12:11 PM, Akshay Kapoor
akshay.anilkapoor@gmail.com wrote:
Thanks Kyle for your explanation. I have a couple of questions based on what
you’ve said. It is a bit length as i tried being as verbose as i can so as
to avoid confusion.
In the sensu-handlers project of yelp, if i understand correctly, the
team-name is the tenant-name per say for the multi-tenant model. So the
client-name remains the sensu-client name and the team-name gets added to
the event data
How can you list all events based on per tenant from the currently exposed
sensu APIs or you guys use something else for that?
Correct.
We just use uchiwa and type in the team name in the search box.
Based on my use-case which is to be able to list out all the events per
tenant and query the same, looking at the sensu code i figured the
following,
For the multi-tenant i believe, since redis stores the key:value pair as
client-name: where client name is the sensu-client hostname. To have
for example all active events from each tenant and to be able to use the
existing APIs exposed by sensu (because that would be needed by some
application in my case, to get all the events wrt tenant) i suppose i would
need to store them with tenant-name: (Not sure if i could do that
without requiring to fork sensu and manage stuff [maintain, rebase sensu for
all new versions)] by myself, probably that is not the desired approach i
think)
You can add tenant-name right now without forking Sensu.
I strongly recommend just using the flexibility of being able to
provide arbitrary key-value pairs to inject the data you need.
Then, I think it would be easiest to write tools around that, or heck
just an http frontend that wraps the api as you need:
raw_api_json = fetch_sensu_event_api()
for event in raw_api_json:
if event['tenant'] == tenant #foo here
print event
Then you can use standard dashboards and get a customized view?
Obviously this is simplifying things.
Also flapjack.io does some of this.
Regarding the external check-results to be sent to sensu, i wanted to
confirm if what i’m thinking is correct and just want you to confirm for
correctness
I have some events in logstash which needs to be sent out to sensu for
raising a notification. For this i send it to the localhost port 3030 that
sensu-client is listening on (Not sure if this is the best approach to get
events from logs; maybe you could suggest improvements if any).
When this is sent out to sensu, it sends a notification using a handler as
defined in the event in logstash (as there is no check definition defined on
the sensu-server for this, i cannot add threshold values for the handler to
use, may be i can just set that in the logstash event to have it available
as a part of the event data)
So is it possible to have check-definitions on the sensu-server or client
for external results sent to the sensu-client on port 3030 (because i’m
trying to get in events from logstash)
Yes, you can send any arbitrary key-value pair to port 3030, just like
a check definition. (and yes, without a check definition, sensu
doesn’t care)
Including tenant, refresh, occurrences. In Yelp’s case, we do “team”,
“page”, “ticket”, etc.
Isn’t Sensu liberating? You can just like, “send alerts” for whatever?
Thanks,
Akshay
P.S - Sorry for being so verbose, it’s because of my little knowledge on
sensu (trying to catch up on it with help from people like you)
On Tue, Mar 31, 2015 at 6:48 PM, Kyle Anderson kyle@xkyle.com wrote:
On Tue, Mar 31, 2015 at 11:30 AM, Akshay Kapoor
akshay.anilkapoor@gmail.com wrote:
Hi,
I’m wanting to use sensu in a multi-tenant environment. Given that use
case,
how is it that one can list all the events specific to a particular
tenant.
There is no built-in functionality for sensu for that, and probably won’t
be.
However, you can add arbitrary key values into the event data and use
that to filter based on different tenants.
We use that here:
https://github.com/Yelp/sensu_handlers
https://github.com/Yelp/monitoring_check
Once this tenant data is in the event json, you can write your own
tools to filter.
(sensu-cli event list -f json | jq “.tenant = ‘your tenant’”)
You also might want to look at http://flapjack.io/
As it is designed to be multi-tenant, and Sensu can feed it.
Also, is it possible to have thresholds defined for external results
sent to
sensu on port 3030. More like can i specify the thresholds for specific
checks via a check definition on the client/server.
What kind of thresholds?
If it is data for the handler to consume (like occurences/refresh), then
Yes.
If it is for keepalive thresholds, then No (but there is a PR
https://github.com/sensu/sensu/pull/910)
Yes, you can specify specific check thresholds (occurences/refresh) by
modifying the check definition.
If you are doing this on the client, it must be a standalone check.
(otherwise the check as defined on the server will take precedence.)