Page MenuHomePhabricator

Improve automation for the vendor maintenance calendar
Open, LowPublic

Event Timeline

See also T230835: Investigate janitor, maintenance emails parser

Putting my clinic duty hat on: @andrea.denisse please assign a subteam and a priority.

cmooney subscribed.

Setting to low as it seems reasonable, @andrea.denisse feel free to change.

Thanks for your comments @ayounsi and @cmooney.

While Janitor looks promising, I believe Google Apps Script. would be the ideal solution for automating our vendor maintenance calendar.

In broad terms the process would involve handling email data from Gmail and creating events in Google Calendar. Here's a brief outline of the proposed automation workflow:

  1. Fetch Emails: Retrieve all emails sent to the maint-calendar inbox.
  2. Process Emails: Extract event information from the emails. If an iCal attachment is not present, parse the email content to generate a calendar event. For this step, we can leverage the existing JavaScript tooling developed by @fgiunchedi for parsing email content, as found in the operations-software/clinic-duty/ repository.
  3. Create Calendar Events: Use the Google Calendar API to add the processed events to the Maintenance calendar.

To demonstrate the ease of handling email data with Google Apps Script, I've linked a snippet of the alertreview code: async function fetchAndProcessEmailAlerts().

Once the process is established, we can set up a time-trigger to execute the script, for example, twice a day to ensure that our calendar is always up-to-date.

Please let me know what you think.

Thanks for looking into it !

I worry about re-writing an in house library to parse vendor emails, as those emails come in all shapes and forms and change regularly, from attached ICS, to maintenance modification emails, cancellation, etc. So to me it makes sens to re-use a well known library like https://github.com/networktocode/circuit-maintenance-parser instead.

The Google Calendar part is also the tip of the iceberg. For example we rely on clinic duty SREs to analyses those maintenance events to ensure they're not on redundant links, which is error prone. Storing them in a database (Netbox seems the most suitable, but other could work) would allow us to take pre-emptive actions (depool, mute monitoring, alert on problematic maintenance).

Longer term we could even get rid of the provider maintenance calendar :)