Integrate external website monitoring with SCOM & UptimeRobot

Hello Everyone,

Today I want to talk about a little management pack I made together with the help of Martin Erhnst, who helped redesign the MP to work with the new API.

Uptimerobot is a website that allows you to create up to 50 web checks for free. This includes TCP, Ping, HTTP checks. It literally takes 5 minutes to create a few checks. There is also a paid plan if you want to create more web checks and unlock more features.

What makes UptimeRobot great is that it has an easy to use API that exposes all your webcheck data. This allows us to query that data through powershell, and integrate it into a management pack.

Let’s go through what you need to do to set up the management pack.

First, you need to create an account on UptimeRobot.

Once logged in, you can start creating webchecks! Click the add New Monitor button.

2017-06-28 17_29_08-Dashboard _ Uptime Robot

Choose the type and fill in the blanks.2017-06-28 17_31_02-Dashboard _ Uptime Robot

Once your webchecks are created, we’ll need the APIkey to get the data from the API. You can find this under My settings on the right bottom side of the page.

2017-06-28 17_33_53-Clipboard

Next up we need to designate one or more servers that have access to the internet that will be polling the information from the API. These will be our web check watcher nodes.
To designate a server you need to create a registry key with a string value to trigger the discovery in SCOM. (Should create a task for this later)
Create a key UptimeRobot under HKLM\Software, in the key create a value APIkey, containing the APIkey from the web page.
A potential improvement, as Martin pointed out, would be to put this into a run as account.
2017-06-28 17_38_14-Clipboard

Next you’ll need to define an AD account that has permissions to access the internet and create it in SCOM.

Once that’s created go to Administration -> Create Run As Account.

2017-06-30 11_12_59-domav401.belgianrail.be - Remote Desktop Connection

Select Windows and give the account a name.

2017-06-30 11_14_01-domav401.belgianrail.be - Remote Desktop Connection

Fill in the credentials

2017-06-30 11_17_10-Clipboard

Choose Less Secure and click Create

2017-06-30 11_18_03-domav401.belgianrail.be - Remote Desktop Connection

Once created, you can distribute the account to the watcher nodes that will execute the web checks.
Right click the account you created and select the Distribution tab.

2017-06-30 11_21_20-Clipboard

Next up, we’ll add the account to the Run as Profile, Go to Administration -> Profiles

2017-06-30 11_22_14-domav401.belgianrail.be - Remote Desktop Connection

Choose the Web Checks Monitoring Account we created and click Save

2017-06-30 11_22_57-domav401.belgianrail.be - Remote Desktop Connection

That’s it! Once the discoveries are done, the web checks will show up in SCOM.
The management pack contains 2 monitors and 1 rule. 1 Monitor which will poll the status from the API, another one will check the average response time over a default sample rate of 3 . The performance rule polls the response time of the web check.

Martin also created a task that will allow you to create web checks from the console, neat right?

2017-06-30 13_10_06-Clipboard

Views are created under the UptimeRobot folder, or if you’re like me and prefer to create a Squared Up dashboard, that’s up to you.
2017-06-30 13_18_43-Uptime Robot Dashboard - Squared Up

You can download the MP and VS Solution here:

Jasper

 

Advertisements

22 thoughts on “Integrate external website monitoring with SCOM & UptimeRobot

  1. HI Jasper,

    Thanks for this very handy info and MP.
    I have tried this out but have ran into a problem.
    My WatcherNode is showing as Not Monitored. I have tried a few different Nodes but its still the same.
    Any ideas?
    Regarding the AD account – you have created the account called “Webmonitoring”, is this the AD account that has access to the internet?
    Does this account also need to have a User role setup in SCOM?

    Regards
    Saiyad

    Like

    1. Hey Saiyad,

      As long as you don’t use a proxy to connect to the internet, you do not need to configure an account. Otherwise you do need one account that has access to the internet which you have to add in SCOM and add to the profile.
      Regarding the watcher node, there is no health rollup from the web checks to the watcher node. This is to prevent that the server will become critical when a webcheck fails. So it is unmonitored because there are no monitors associated with it. There are monitors associated with the webchecks.

      Br,
      Jasper

      Like

  2. Thanks Jasper, that makes sense.
    Since I have set this up, I do not see anything in Web alert view and State View.
    How do I know or where do I go and see if this setup is pulling data from Uptime Robot on my particular site?
    Also do you have any instructions on how you set this up in Squared Up or point me to a KB I can use to set this and any other URL monitoring using SquaredUp dashboard.
    I am trialling out v3 at the moment.

    Regards
    SR

    Like

  3. Hey Saiyad,

    If you go into the Eventviewer of the watcher node, under Operations Manager, there should be event id’s 8001-8002-8003 which shows if there were any web checks found.

    Other than that they should show up under the web checks state view. Keep in mind that the discovery only runs every hour.

    Regarding squared up resources. I’ll see if I can export my dashboard and share it, but do not have access right now. Will keep you posted.

    BR,
    Jasper

    Like

  4. Hi Jasper,

    I can see 8001 and 8002: WebChecksDiscovery.ps1 : Discovery Started.
    But I could not find 8003.

    Still the Web check state view is empty.

    Like

    1. Hey Saiyad, if you don’t see any 8003 events and you have configured your API key properly, I would think this is related to your internet connection. I have it running here properly. Are you using any proxy?

      Like

      1. Yes I am but the account that i am using has access to the internet as it has been tested.
        I did a Discovered Inventory where I changed Target to “UptimeRobot Web Check” and there are no objects showing up. What does this mean and what should I do? Its been about 4 days since I installed the MP. Should I remove and re do the whole thing again?

        Like

  5. Hey Saiyad,

    Could you tell me if you are using a proxy or not? Have you distributed the credentials in SCOM to the Watcher Node? Otherwise it will keep using the local system account.
    If you are using a proxy, I would also recommend running ‘netsh winhttp set proxy import ie’ in a command prompt to force every user to use the proxy.

    Br,
    Jasper

    Like

    1. Alright. Can you try to run the following part of the powershell script of the discovery manually with that specific user to see if it works? Check if $webmonitors contains any output. That should contain your webchecks.

      $APIKey =
      $Header = @{
      “Content-Type” = “application/x-www-form-urlencoded”
      “Cache-Control” = “no-cache”
      }

      $body = @{
      “api_key” = $APIKey
      “time_zone” = “1”
      “format” = “json”
      }

      $URL = ‘https://api.uptimerobot.com/v2/getMonitors’

      $WebMonitors = (Invoke-RestMethod -Method POST -uri $URL -Headers $header -Body $body).Monitors

      Like

  6. Hi JVD,

    Seems like the last few of my replies didn’t make it through.
    Long story short, Yes – i think my issue was proxy.
    Initially when i ran your script, i got = Invoke-RestMethod : The remote server returned an error: (407) Proxy Authentication Required.
    I passed credentials in the PS script and it retrieved the web checks.

    I moved my Watcher Node to a server in the DMZ.
    Got my Event ID 8003 (finally).
    Now I am getting my Websites Web check in State View but it is Red in critical .

    Health Explorer:
    Webcheck Response Time Monitor – 1- http://www.blah.blah (UptimeRobotWebCheck)
    Value is 688

    But there is nothing in the Web Checks Alert View

    Did I miss something?

    SR

    Like

  7. Ok – Got alert in Alert View.
    but next question is, this is telling me that site is responding slow but in UptimeRobot the site is only peaked at 1328ms (1.3sec). If this API is reading data from Uptime Robot than i was expecting the same reading or is the alert show the time it took to get data from Uptime Robot?

    Like

  8. Hello here,

    Same issue.. no event 8003 and no elements in the State View.
    I tried to run the task “Add new Webcheck monitor”, the task is successful but nothing happened.

    Any help ?

    Like

    1. Hey Mona,

      If you add a web check through the website itself, do those show up? Are you using a proxy to connect to the internet?

      Br,
      Jasper

      Like

      1. Hello Jesper,

        Thanks for your reply !
        Finnaly it works ! But during 25 minutes only..

        Yes, I use the proxy to connect at Internet. But we cannot configure any proxy, the connection is direct. So we did an exception to allow this.

        After this, I got all monitors in the state view.. but.. after 25 minutes the Watcher Node State View State change to Critical and all monitors switch to Critical. I don’t understand why…

        Like

  9. Hello Guys,
    Finnaly it works ! But during 25 minutes only..
    Yes, the problem was the FW. In fact, we cannot configure any proxy so the connection is direct. We did an exception to allow this.
    So I got all monitors in the state view.. but.. after 25 minutes the Watcher Node State View State change to Critical and all monitors switch to Critical. I don’t understand why…

    Like

  10. Can you please delete my last comment ?

    It should be interesting to know all urls that must be allowed in the FW.
    Do you know it ?

    I’m available by email.

    Like

  11. [PROBLEM SOLVED]
    Hi Jespers,
    Finallay everything works fine !! The threshold was too low that’s why I got alerts ahaha 🙂
    So I did some override and now it’s perfect !
    Thank you !!

    Like

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 )

Google+ photo

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

Connecting to %s