# sensu-api /event/resolve issue

**URL:** <https://discourse.sensu.io/t/sensu-api-event-resolve-issue/134>\
**Category:** Sensu Classic (EOL)\
**Created:** [January 31, 2014, 1:38am UTC](https://discourse.sensu.io/t/sensu-api-event-resolve-issue/134 "2014-01-31T01:38:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dan\_Fischer](https://avatars.discourse-cdn.com/v4/letter/d/b19c9b/32.png) [@Dan\_Fischer](https://discourse.sensu.io/u/Dan_Fischer)\
**Post date:** [January 31, 2014, 1:38am UTC](https://discourse.sensu.io/t/sensu-api-event-resolve-issue/134/1 "2014-01-31T01:38:46Z")

</div>

I installed Sensu on Debian Wheezy using the omnibus package. Things are working fine except for this one issue I am facing. I cannot resolve events using sensu-api. Is anyone else using the API to post updates? Can this work?

My goal is to allow Pagerduty to resolve Sensu events using Pagerduty webhooks. I am testing to see how the sensu-api works for resolving active events.

I am monitoring a cron process on my sensu client. I stopped the process on the client cFQDN and waited for the event to show in the sensu-server log:  
(Note: cFQDN is my client and hFQDN is the sensu server.)

{“timestamp”:“2014-01-30T15:59:15.206641-0800”,“level”:“info”,“message”:“handler output”,“handler”:{“type”:“pipe”,“command”:"/etc/sensu/handlers/pagerduty.rb",“name”:“pagerduty”},“output”:“pagerduty – Created incident – cFQDN/cron\_check\n”}  
{“timestamp”:“2014-01-30T15:59:15.868650-0800”,“level”:“info”,“message”:“handler output”,“handler”:{“type”:“pipe”,“command”:"/etc/sensu/handlers/mailer.rb",“name”:“mailer”},“output”:“mail – sent alert for cFQDN/cron\_check to sensu@email.info\n”}

I get the alert email and see the incident on Pagerduty:  
Description: cFQDN : cron\_check : CheckProcs CRITICAL: Found 0 matching processes; cmd /cron/  
Incident Key: cFQDN/cron\_check

Now I want to manually resolve the event using the sensu-api.  
I use this php with Interactive mode enabled:  
php \> $username = “user”;  
php \> $password = “pass”;  
php \> $data = array(“client” =\> “cFQDN”, “check” =\> “cron\_check”);  
php \> $data\_string = json\_encode($data);  
php \> $ch = curl\_init();  
php \> curl\_setopt($ch, CURLOPT\_USERPWD, “$username:$password”);  
php \> curl\_setopt($ch, CURLOPT\_URL, “[http://hFQDN:4567](http://hFQDN:4567)”);  
php \> $result = curl\_exec($ch);  
curl\_setopt($ch, CURLOPT\_URL, “[http://hFQDN:4567/events](http://hFQDN:4567/events)”);  
php \> curl\_setopt($ch, CURLOPT\_URL, “[http://hFQDN:4567/events](http://hFQDN:4567/events)”);  
php \> $result = curl\_exec($ch);  
[{“output”:“CheckProcs CRITICAL: Found 0 matching processes; cmd /cron/\n”,“status”:2,“issued”:1391128634,“handlers”:[“mailer”,“pagerduty”],“flapping”:false,“occurrences”:3,“client”:“cFQDN”,“check”:“cron\_check”}]php \> echo $result,"\n";  
1  
php \> curl\_setopt($ch, CURLOPT\_POSTFIELDS, $data\_string);  
php \> curl\_setopt($ch, CURLOPT\_URL, “[http://hFQDN:4567/event/resolve](http://hFQDN:4567/event/resolve)”);  
php \> $result = curl\_exec($ch);  
php \> echo $result,"\n";  
1  
php \> curl\_close($ch);

So access through sensu-api is working. The login occurs and the /events get displayed. When the /event/resolve POST is attempted it does not resolve the event.

These are the results from sensu-api log:  
{“timestamp”:“2014-01-30T16:03:21.118570-0800”,“level”:“info”,“message”:“GET /events”,“remote\_address”:“xxx.xxx.xx.xxx”,“user\_agent”:null,“request\_method”:“GET”,“request\_uri”:"/events",“request\_body”:""}  
{“timestamp”:“2014-01-30T16:03:21.124943-0800”,“level”:“info”,“message”:“POST /event/resolve”,“remote\_address”:“xxx.xxx.xx.xxx”,“user\_agent”:null,“request\_method”:“POST”,“request\_uri”:"/event/resolve",“request\_body”:"{“client”:“cFQDN”,“check”:“cron\_check”}"}

---

<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:** [January 31, 2014, 2:07am UTC](https://discourse.sensu.io/t/sensu-api-event-resolve-issue/134/2 "2014-01-31T02:07:51Z")

</div>

Dan,

Change your post url to [http://hFQDN:4567/resolve](http://hfqdn:4567/event/resolve)

If that doesn’t work I’ll test your code.

-Bryan

> **···**
>
> On Thu, Jan 30, 2014 at 7:38 PM, Dan Fischer [ebay2007buys@gmail.com](mailto:ebay2007buys@gmail.com) wrote:
> 
> > I installed Sensu on Debian Wheezy using the omnibus package. Things are working fine except for this one issue I am facing. I cannot resolve events using sensu-api. Is anyone else using the API to post updates? Can this work?
> > 
> > My goal is to allow Pagerduty to resolve Sensu events using Pagerduty webhooks. I am testing to see how the sensu-api works for resolving active events.
> > 
> > I am monitoring a cron process on my sensu client. I stopped the process on the client cFQDN and waited for the event to show in the sensu-server log:
> > 
> > (Note: cFQDN is my client and hFQDN is the sensu server.)
> > 
> > {“timestamp”:“2014-01-30T15:59:15.206641-0800”,“level”:“info”,“message”:“handler output”,“handler”:{“type”:“pipe”,“command”:“/etc/sensu/handlers/pagerduty.rb”,“name”:“pagerduty”},“output”:“pagerduty – Created incident – cFQDN/cron\_check\n”}
> > 
> > {“timestamp”:“2014-01-30T15:59:15.868650-0800”,“level”:“info”,“message”:“handler output”,“handler”:{“type”:“pipe”,“command”:“/etc/sensu/handlers/mailer.rb”,“name”:“mailer”},“output”:“mail – sent alert for cFQDN/cron\_check to sensu@email.info\n”}
> > 
> > I get the alert email and see the incident on Pagerduty:  
> > Description: cFQDN : cron\_check : CheckProcs CRITICAL: Found 0 matching processes; cmd /cron/  
> > Incident Key: cFQDN/cron\_check
> > 
> > Now I want to manually resolve the event using the sensu-api.  
> > I use this php with Interactive mode enabled:  
> > php \> $username = “user”;  
> > php \> $password = “pass”;
> > 
> > php \> $data = array(“client” =\> “cFQDN”, “check” =\> “cron\_check”);  
> > php \> $data\_string = json\_encode($data);  
> > php \> $ch = curl\_init();  
> > php \> curl\_setopt($ch, CURLOPT\_USERPWD, “$username:$password”);
> > 
> > php \> curl\_setopt($ch, CURLOPT\_URL, “[http://hFQDN:4567](http://hFQDN:4567)”);  
> > php \> $result = curl\_exec($ch);  
> > curl\_setopt($ch, CURLOPT\_URL, “[http://hFQDN:4567/events](http://hFQDN:4567/events)”);
> > 
> > php \> curl\_setopt($ch, CURLOPT\_URL, “[http://hFQDN:4567/events](http://hFQDN:4567/events)”);  
> > php \> $result = curl\_exec($ch);  
> > [{“output”:“CheckProcs CRITICAL: Found 0 matching processes; cmd /cron/\n”,“status”:2,“issued”:1391128634,“handlers”:[“mailer”,“pagerduty”],“flapping”:false,“occurrences”:3,“client”:“cFQDN”,“check”:“cron\_check”}]php \> echo $result,“\n”;
> > 
> > 1  
> > php \> curl\_setopt($ch, CURLOPT\_POSTFIELDS, $data\_string);  
> > php \> curl\_setopt($ch, CURLOPT\_URL, “[http://hFQDN:4567/event/resolve](http://hFQDN:4567/event/resolve)”);  
> > php \> $result = curl\_exec($ch);
> > 
> > php \> echo $result,“\n”;  
> > 1  
> > php \> curl\_close($ch);
> > 
> > So access through sensu-api is working. The login occurs and the /events get displayed. When the /event/resolve POST is attempted it does not resolve the event.
> > 
> > These are the results from sensu-api log:  
> > {“timestamp”:“2014-01-30T16:03:21.118570-0800”,“level”:“info”,“message”:“GET /events”,“remote\_address”:“xxx.xxx.xx.xxx”,“user\_agent”:null,“request\_method”:“GET”,“request\_uri”:“/events”,“request\_body”:“”}
> > 
> > {“timestamp”:“2014-01-30T16:03:21.124943-0800”,“level”:“info”,“message”:“POST /event/resolve”,“remote\_address”:“xxx.xxx.xx.xxx”,“user\_agent”:null,“request\_method”:“POST”,“request\_uri”:“/event/resolve”,“request\_body”:“{"client":"cFQDN","check":"cron\_check"}”}

---

<div class="post-metadata">

**Author:** ![Dan\_Fischer](https://avatars.discourse-cdn.com/v4/letter/d/b19c9b/32.png) [@Dan\_Fischer](https://discourse.sensu.io/u/Dan_Fischer)\
**Post date:** [January 31, 2014, 2:53am UTC](https://discourse.sensu.io/t/sensu-api-event-resolve-issue/134/3 "2014-01-31T02:53:29Z")

</div>

> Dan,

> Change your post url to [http://hFQDN:4567/resolve](http://hfqdn:4567/event/resolve)

> 

> If that doesn’t work I’ll test your code.

> 

> -Bryan

> > I installed Sensu on Debian Wheezy using the omnibus package. Things are working fine except for this one issue I am facing. I cannot resolve events using sensu-api. Is anyone else using the API to post updates? Can this work?
> > 
> > My goal is to allow Pagerduty to resolve Sensu events using Pagerduty webhooks. I am testing to see how the sensu-api works for resolving active events.
> > 
> > I am monitoring a cron process on my sensu client. I stopped the process on the client cFQDN and waited for the event to show in the sensu-server log:
> > 
> > (Note: cFQDN is my client and hFQDN is the sensu server.)
> > 
> > {“timestamp”:“2014-01-30T15:59:15.206641-0800”,“level”:“info”,“message”:“handler output”,“handler”:{“type”:“pipe”,“command”:“/etc/sensu/handlers/pagerduty.rb”,“name”:“pagerduty”},“output”:“pagerduty – Created incident – cFQDN/cron\_check\n”}
> > 
> > {“timestamp”:“2014-01-30T15:59:15.868650-0800”,“level”:“info”,“message”:“handler output”,“handler”:{“type”:“pipe”,“command”:“/etc/sensu/handlers/mailer.rb”,“name”:“mailer”},“output”:“mail – sent alert for cFQDN/cron\_check to se…@email.info\n”}
> > 
> > I get the alert email and see the incident on Pagerduty:  
> > Description: cFQDN : cron\_check : CheckProcs CRITICAL: Found 0 matching processes; cmd /cron/  
> > Incident Key: cFQDN/cron\_check
> > 
> > Now I want to manually resolve the event using the sensu-api.  
> > I use this php with Interactive mode enabled:  
> > php \> $username = “user”;  
> > php \> $password = “pass”;
> > 
> > php \> $data = array(“client” =\> “cFQDN”, “check” =\> “cron\_check”);  
> > php \> $data\_string = json\_encode($data);  
> > php \> $ch = curl\_init();  
> > php \> curl\_setopt($ch, CURLOPT\_USERPWD, “$username:$password”);
> > 
> > php \> curl\_setopt($ch, CURLOPT\_URL, “[http://hFQDN:4567](http://hFQDN:4567)”);  
> > php \> $result = curl\_exec($ch);  
> > curl\_setopt($ch, CURLOPT\_URL, “[http://hFQDN:4567/events](http://hFQDN:4567/events)”);
> > 
> > php \> curl\_setopt($ch, CURLOPT\_URL, “[http://hFQDN:4567/events](http://hFQDN:4567/events)”);  
> > php \> $result = curl\_exec($ch);  
> > [{“output”:“CheckProcs CRITICAL: Found 0 matching processes; cmd /cron/\n”,“status”:2,“issued”:1391128634,“handlers”:[“mailer”,“pagerduty”],“flapping”:false,“occurrences”:3,“client”:“cFQDN”,“check”:“cron\_check”}]php \> echo $result,“\n”;
> > 
> > 1  
> > php \> curl\_setopt($ch, CURLOPT\_POSTFIELDS, $data\_string);  
> > php \> curl\_setopt($ch, CURLOPT\_URL, “[http://hFQDN:4567/event/resolve](http://hFQDN:4567/event/resolve)”);  
> > php \> $result = curl\_exec($ch);
> > 
> > php \> echo $result,“\n”;  
> > 1  
> > php \> curl\_close($ch);
> > 
> > So access through sensu-api is working. The login occurs and the /events get displayed. When the /event/resolve POST is attempted it does not resolve the event.
> > 
> > These are the results from sensu-api log:  
> > {“timestamp”:“2014-01-30T16:03:21.118570-0800”,“level”:“info”,“message”:“GET /events”,“remote\_address”:“xxx.xxx.xx.xxx”,“user\_agent”:null,“request\_method”:“GET”,“request\_uri”:“/events”,“request\_body”:“”}
> > 
> > {“timestamp”:“2014-01-30T16:03:21.124943-0800”,“level”:“info”,“message”:“POST /event/resolve”,“remote\_address”:“xxx.xxx.xx.xxx”,“user\_agent”:null,“request\_method”:“POST”,“request\_uri”:“/event/resolve”,“request\_body”:“{"client":"cFQDN","check":"cron\_check"}”}

> 

Thanks Bryan. Changing the POST to /resolve:  
php \> curl\_setopt($ch, CURLOPT\_URL, “[http://hFQDN:4567/resolve](http://hFQDN:4567/resolve)”);  
php \> $result = curl\_exec($ch);  
{“issued”:1391136306}

Seems this fixed it - results in sensu-api log:  
{“timestamp”:“2014-01-30T18:38:41.471124-0800”,“level”:“info”,“message”:“POST /resolve”,“remote\_address”:“xxx.xxx.xx.xxx”,“user\_agent”:null,“request\_method”:“POST”,“request\_uri”:“/resolve”,“request\_body”:“{"client":"cFQDN","check":"cron\_check"}”}  
{“timestamp”:“2014-01-30T18:38:41.471858-0800”,“level”:“info”,“message”:“publishing check result”,“payload”:{“client”:“cFQDN”,“check”:{“name”:“cron\_check”,“output”:“Resolving on request of the API”,“status”:0,“issued”:1391135921,“handlers”:[“mailer”,“pagerduty”],“force\_resolve”:true}}}

> **···**
>
> > On Thu, Jan 30, 2014 at 7:38 PM, Dan Fischer [ebay20...@gmail.com](mailto:ebay20...@gmail.com) wrote:
> 
> On Thursday, January 30, 2014 7:07:51 PM UTC-7, agent462 wrote:

---

<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:05am UTC](https://discourse.sensu.io/t/sensu-api-event-resolve-issue/134/4 "2018-11-22T02:05:06Z")

</div>


