Sync-to-Chain diagram

Video demo:

BENEFITS:

  • Visual schedules are more intuitive and allow you to see who’s “on-call” and that you have “coverage” the entire time.
  • The calendar can inform and remind your staff WHO is on-call/duty at any time.
  • Overcome the limitations of the “time-based chain” which can’t currently do “overnight” shifts like “6pm to 8am the next morning” and rotations that change each week or on a specified date.

HOW DOES IT WORK?

UPDATE!  If you’re using Office365, please use a new version that doesn’t require Cronofy (June 2018).
This is a datasource (PowerShell script) that reads your calendar every ~5 minutes and verifies or changes your LogicMonitor Escalation chain(s) to match the calendar. It uses free ‘middleware’ called Cronofy so one script can support 4 different calendar vendors (i.e. google, Microsoft Office 365, etc). If I see enough demand for a single type of calendar, I could write directly to that without using Cronofy.

 

REQUIREMENTS:

  • FYI: This datasource has been updated from our older RPC API to newer REST API.
  • Calendars supported: Google, Office 365, On-Premise Exchange 2010 or newer
  • Your escalation chains must have the word “schedule” in the names (not case-sensitive)
  • Your calendar name must match the name of your Escalation chain (not case-sensitive)
  • The event names on your calendar must specify usernames in the event name e.g. 1=Al (SMS), 2=Bob (voice). Email is the default so you don’t need to specify that in parenthesis.
  • You can only have one event on the same calendar at the same time (otherwise it will get confused)
  • Disclaimer: This is not officially supported by LogicMonitor tech support. Use at your own risk. If you need help, email me mike [at] wowie.us

INSTRUCTIONS TO SETUP:

  • Sign up for a free account at www.Cronofy.com and create your authentication “token”
  • I suggest you create a user account in LogicMonitor for the API calls. Generate the API ID and key and save them. Set a property for ‘api.key’ at the device or group or account level.
  • Download the datasource and import it into your account
  • Set a property on your device (preferably your collector) so the datasource will be applied:
    sync_calendar = whatever
  • Set some settings at the top of PowerShell script in datasource (or use variables). $CRONOFYclientID, $LMtenant (your logicmonitor portal name), and $LMACCESSID (i.e. your LogicMonitor API access ID)
  • If you haven’t already, create your schedules.
  • Test by using ‘test script’ and look at graphs in datasource for errors/alerts. A status of 0 or 1 are ok, other numbers indicate problems as follows:
    0=no changes needed
    1=ok – changes were successful
    2=Calendar named (CCCC) has no matching ‘chain’ in LogicMonitor
    3=Calendar event named (EEEE) does not specify a username that exists in LogicMonitor
    4=Calendar named (CCCC) has 2 or more events but only 1 is allowed
    5=For some unknown reason, after the script changed the chain (HHHH) ; the chain doesn’t match the event.
    6=No calendar event found for this time

 

DOWNLOAD:

Download this DataSource file and add it into your LogicMonitor account (Settings > DataSources > Add > From file )

TROUBLESHOOTING:

If you need to debug, you can run the script in the LogicMonitor interactive debug command window ( Settings > Collectors > Manage > Support > Run Debug Command)

Type “!posh” to open a window. Paste in the contents of the script. You will need to change the ##api.pass## to your real password. Then click “Submit”

>>!posh
returns 1
output:
[20160316 04:32:51]-REST status: 200, 5 total escalation chains found for suding account.
[20160316 04:32:51]-2 escalation chains found that contain 'schedule'.
[20160316 04:32:52]-DEBUG: 6 calendars found for client_id xxxxxxxxx[redacted]
[20160316 04:32:52]-2 calendars found that contain 'schedule'.
[20160316 04:32:53]-DEBUG: 70 events found for client_id xxxxxxxx[redacted]
[20160316 04:32:53]-Processing calendar 'Network on-call schedule'.
[20160316 04:32:53]-Processing calendar 'Database on-call schedule'.
[20160316 04:32:53]-66 on call events found in 2 calendars.
[20160316 04:32:53]-Current Date is Wednesday, March 16, 2016 11:32:53 AM UTC.
[20160316 04:32:53]-The current event is evt_external_56e4380773767685b80808d4 - start 2016-03-16T00:00:00Z UTC, end 2016-03-16T15:00:00Z UTC, summary: 1=Bob (sms) 2=Cole.
[20160316 04:32:53]-The current event is evt_external_56e6f90a73767685b80b3050 - start 2016-03-15T23:00:00Z UTC, end 2016-03-16T16:00:00Z UTC, summary: Al (voice).
[20160316 04:32:54]-DEBUG: Event has 2 stages, listing contacts:
[20160316 04:32:54]-DEBUG: Stage 1, addr Bob, method sms
[20160316 04:32:54]-DEBUG: Stage 2, addr Cole, method email
[20160316 04:32:54]-DEBUG: Escalation chain has 2 stages, listing contacts:
[20160316 04:32:54]-DEBUG: Stage 1, addr Don, method email
[20160316 04:32:54]-DEBUG: Stage 2, addr Ed, method sms
[20160316 04:32:54]-Updating LM escalation chain.
[20160316 04:32:56]-Update successful, REST status 200.
[20160316 04:32:56]-DEBUG: Event has 1 stages, listing contacts:
[20160316 04:32:56]-DEBUG: Stage 1, addr Al, method voice
[20160316 04:32:56]-DEBUG: Escalation chain has 1 stages, listing contacts:
[20160316 04:32:56]-DEBUG: Stage 1, addr Al, method voice
[20160316 04:32:56]-No update to LM escalation chain required.
[20160316 04:32:56]-EXIT Status/Error 1: Changes applied successfully