# handler settings

**URL:** <https://discourse.sensu.io/t/handler-settings/20>\
**Category:** Sensu Classic (EOL)\
**Created:** [April 24, 2013, 10:03am UTC](https://discourse.sensu.io/t/handler-settings/20 "2013-04-24T10:03:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matt](https://avatars.discourse-cdn.com/v4/letter/m/a6a055/32.png) [@Matt](https://discourse.sensu.io/u/Matt)\
**Post date:** [April 24, 2013, 10:03am UTC](https://discourse.sensu.io/t/handler-settings/20/1 "2013-04-24T10:03:32Z")

</div>

Just pulled in the pagerduty.rb handler. I would like to set it up to  
use different PD services via api\_key.

The best option I see at the moment is to pass a key variable on the  
command or service name.

And have something like - settings['pagerduty']['#{service}\_key'],

Then add all the keys to the pagerduty config

This doesn't really play nice with the puppet module though.

Is there already an internal name I could use where the config to pull  
the variable from is the name of the handler. i.e.

handler "servicea-pagerduty"

settings[handler]['api\_key'],

{  
&nbsp;&nbsp;"servicea-pagerduty": {  
&nbsp;&nbsp;&nbsp;&nbsp;"api\_key": "mykey"  
&nbsp;&nbsp;}  
}

Thanks,

Matt

---

<div class="post-metadata">

**Author:** ![Nick\_Stielau](https://avatars.discourse-cdn.com/v4/letter/n/ed8c4c/32.png) [@Nick\_Stielau](https://discourse.sensu.io/u/Nick_Stielau)\
**Post date:** [April 24, 2013, 3:12pm UTC](https://discourse.sensu.io/t/handler-settings/20/2 "2013-04-24T15:12:35Z")

</div>

Here’s a gist that includes mixlib CLI into the PD handler, so that the PD service api\_key can be specified. This may not be drop-in ready (was using a custom parent class), but should be pretty close.

> <https://gist.github.com/nstielau/5a803b7987c0ee7b62e7>

-Nick

> **···**
>
> On Wednesday, April 24, 2013 3:03:32 AM UTC-7, Matt wrote:
> 
> > Just pulled in the pagerduty.rb handler. I would like to set it up to
> > 
> > use different PD services via api\_key.
> > 
> > The best option I see at the moment is to pass a key variable on the
> > 
> > command or service name.
> > 
> > And have something like - settings[‘pagerduty’][‘#{service}\_key’],
> > 
> > Then add all the keys to the pagerduty config
> > 
> > This doesn’t really play nice with the puppet module though.
> > 
> > Is there already an internal name I could use where the config to pull
> > 
> > the variable from is the name of the handler. i.e.
> > 
> > handler “servicea-pagerduty”
> > 
> > settings[handler][‘api\_key’],
> > 
> > {
> > 
> > “servicea-pagerduty”: {
> > 
> > ```
> > "api_key": "mykey"
> > 
> > ```
> > 
> > }
> > 
> > }
> > 
> > Thanks,
> > 
> > Matt

---

<div class="post-metadata">

**Author:** ![jspaleta](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.sensu.io/jspaleta/32/141_2.png) [@jspaleta](https://discourse.sensu.io/u/jspaleta)\
**Post date:** [November 22, 2018, 2:04am UTC](https://discourse.sensu.io/t/handler-settings/20/3 "2018-11-22T02:04:50Z")

</div>

Closed on November 22, 2018, 2:04am UTC


