The Surly Admin

Father, husband, IT Pro, cancer survivor

Pebble and Pushover

Want to send alets to your Smartphone and Pebble directly from Powershell? Read on!

Pushover

Pushover is a cool little web app that allows you to send custom notifications to your smart phone. Install the app on your smart phone and sign in and you’re ready to go. One cool thing is that there is a Pushover channel on IFTTT, which means pretty much anything you can do on that site you can send a notification to Pushover and from there to your wrist. Of course, a problem with Pushover to Pebble is the notification dance you have to do but I’m hoping this will get resolved with iOS 7 (which is in beta 4 as of this writing).

To get this working with Powershell you have to sign up for Pushover and get head over to the profile page. From there you can get your user key. Then you need to create an application token, which you do by creating an application on the same page.

  1. Next to Your Applications click on the Edit link.
  2. On the Applications page click on the Create a new Application link.
  3. Give it a name, I called my Powershell Notif
  4. Type: Script
  5. That’s it, hit Save.

Once saved click on your new application and you now see the application token at the top.

Powershell

I wish I could take credit for this code, but I found it using Google. I’m tried finding the original page but haven’t been able to! Sorry credit to whoever I saw this from, I’ll keep looking and update this post if I find you. Luckily, if you Google “Powershell Pushover” you’ll find all kinds of things–someone even wrote a full module! I like to keep it simple and that’s what I’ll post here.

$PushoverToken = "yourapplicationtoken"
$PushoverUser = "yourusertoken"

#Send Pushover notification
$parameters = New-Object System.Collections.Specialized.NameValueCollection
$parameters.Add("token", $PushoverToken) | Out-Null
$parameters.Add("user", $PushoverUser ) | Out-Null
$parameters.Add("title","Alert") | Out-Null
$parameters.Add("message", "Servers down!!  PANIC!!") | Out-Null
$client = New-Object System.Net.WebClient
$client.UploadValues("https://api.pushover.net/1/messages.json", $parameters) | Out-Null

That’s all there is. Make sure to plug in your application token and your user token in the first two lines and then enjoy sending notifications to your smart phone. And if you have notifications to your Pebble working than it will vibrate on your wrist too.

How would you put this to use? Plug it into your server monitoring application?

Advertisement

August 5, 2013 - Posted by | General, PowerShell | , ,

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: