Latest Stories
M1 Max MacBook Pro and External Display: When Productivity Becomes Frustration Social Media Limbo kamshin.com on hiatus Some thoughts on the new MacBook Pro Opportunities And Challenges With Personal Health Data – Looking at Garmin Data

kamshin

  • Home
  • All Posts
  • Categories
    • General
    • Tech Field Day
    • Storage
    • Nutanix
    • Certifications
    • Conferences
    • Worth reading
    • Design
    • Rants
    • Active Directory
  • Media & Press
  • Podcast
  • About me
    • About me
    • Where is Max?
    • Disclosure & Policies

Sending PRTG notifications to iPhones via Prowl through Corporate Proxies

March 22, 2010

FacebookTwitter

Hello,

after reading Dirk Paessler’s excellent blog article on Prowl and the iPhone, I decided to test this feature, owning an iPhone myself. Unbeknownst to me was the fact that although Paessler PRTG Network Monitor 7 is a wonderful program, it unfortunately doesn’t supports passing an “Execute HTTP Action” alert through a proxy.

When you work in secured environments, there’s no way you can evade some policies or make the rules by yourself, therfore you have to act a bit smarter and come up with a relatively elegant solution.

My first thought was to change the credentials upon which PRTG runs by default (LocalSystem) and make it run under a service account that would be granted Internet Access and Proxy rights. This unfortunately didn’t work, so I told myself I would try to find out a program that will go through the proxy then handle the HTTP action.

After a quick googling, I found about CURL, and upon reading its parameters from the command line, I told myself I will make a BAT file, then will set Paessler notification to launch the BAT file and pass parameters to it. Then the BAT file would parse the parameters, handle them to CURL (with appropriate username and proxy settings) and finally push everything to the Prowl Web API.

First try isn’t always best try…

so I’ve installed curl.exe in the Notifications/EXE folder, then I’ve created a BAT file. The EXE sensor passes several variables as an argument to the BAT file, the BAT files processes those and concatenates them into a string (an URL) which is then passed to curl.exe with additional command line parameters to provide curl with a proxy address, username and password of an authorized user to use the proxy (in my case a service account) and finally the HTTP action to perform.

Because this URL is in fact a prowl/growl API command, the URL needs to be passed properly, hence character substitution must be done for & (ampersand) symbols, otherwise the cmd.exe interpreter sees this as an action to run after the first command (command concatenation i.e. run program1.exe & program2.exe & program3.exe)

Passing these variables to the BAT file has one BIG issue though: some of the values passed as parameters to the BAT file by paessler contain spaces, therefore the BAT reads each space as a delimiter to fill the next variable, leading to shifting in the originally desired values. You know something’s gone down, but it’s better when all gets properly parsed.

I decided to let the weekend flow over this, and give it another thought on monday morning at work. When I hooked again onto this, I slapped my forehead and shouted “VBS!”. I was enlightened!

I prepared the little VBS below, it works perfectly so far :

dim x,Params,increment,ArgObj,cmdline

Set ArgObj=Wscript.Arguments
Set WshShell=Wscript.CreateObject(“Wscript.Shell”)
Params=””

For increment=0 to ArgObj.count – 1
Params = Params & ArgObj(increment) & “%20″
Next

cmdline=”-U domain\user:password -k -x myproxy.company.org:80 ”
&”https://prowl.weks.net/publicapi/add?apikey=MY0000API0000KEY&application=My%20Monitoring&event=Alarm&description=”
& params

x = WshShell.Run(“””C:\program files\PRTG Network Monitor\Notifications\EXE
\curl.exe””” & cmdline)

Do not forget to substitute the highlighted elements!

This is just a beginning and you can setup various alerts and levels for alarms, and play with PRTG Network monitor flexible interface to achieve the needed results.

Have a nice week,
Max

Share this:

  • Click to share on Facebook (Opens in new window)
  • Click to share on LinkedIn (Opens in new window)
  • Click to share on Twitter (Opens in new window)
  • Click to share on Reddit (Opens in new window)

Related

A note to our readers

kamshin.com has a strict no advertisement policy. If you enjoy this website, please consider making a donation to one of these non-profit organizations that I personally support:


People in Need - Czech Republic

A Czech-based non-governmental, non-profit organization founded on the ideals of humanism, freedom, equality and solidarity, helping people in the Czech Republic and in the entire world.

People In Need Logo

Greenpeace

Hopefully this one doesn't requires any explanation. Act for our planet. Act now.

Greenpeace Logo

826 National

US-based charity. An international proof point for writing as a tool for young people to ignite and channel their creativity, explore identity, advocate for themselves and their community, and achieve academic and professional success.

826 National Logo

 


Electronic Frontier Foundation

The leading nonprofit defending digital privacy, free speech, and innovation.

EFF Logo

 


Thank you!

RSS Latest Podcast Episodes

  • EP 30 -Rose Ross Chief Tech Trailblazer on the Tech Trailblazer awards
  • EP29 – Imagine the possibilities to manage your data with Data Dynamics StorageX – with Piyush Mehta
  • EP28 – Introducing Clumio, A Cloud-Based Data Platform Launching With Data Protection As A Service – with Poojan Kumar
  • EP27 – VAST Data – A Revolutionary Storage Platform For The Next Decade – with Howard Marks

Categories

  • Active Directory (5)
  • Certifications (8)
  • Conferences (22)
  • Design (1)
  • Featured (1)
  • General (89)
  • Nutanix (4)
  • Rants (2)
  • Storage (38)
  • Tech Field Day (44)
  • Worth reading (4)

Latest Tweets

My Tweets

Popular posts this week

  • Using Virtual Machine custom attributes with PowerCLI for snapshotting
  • Rubrik - A Refreshing Approach to Backups
  • Pure Storage's FlashBlade - Against The Grain
  • Scality RING - Object Storage? Yes, but Software-Defined please!
  • Intel SPDK - A foundation block for new generation storage

Categories

  • Active Directory
  • Certifications
  • Conferences
  • Design
  • Featured
  • General
  • Nutanix
  • Rants
  • Storage
  • Tech Field Day
  • Worth reading

Pages

  • Blog
  • Disclosure & Policies
  • Home
  • Media & Press
  • VCAP5-DCD Resources
  • VCP5 Certification Resources
  • About me

Archives

Copyright ©2016 kamshin