ptarmiganlabs / butler

Butler brings superpowers to Qlik Sense Enterprise on Windows! Advanced reload failure alerts, task scheduler, key-value store, file system access and much more.
https://butler.ptarmiganlabs.com
MIT License
56 stars 8 forks source link

Feature: Send Task failed mail to app owner #105

Closed ot3kcw6c closed 3 years ago

ot3kcw6c commented 3 years ago

Is your feature request related to a problem? Please describe. Featurerequest. Bigger Qlik Sense environments have separated admins and Developer, therefore most of the task failed notification mails can only be forwarded to the Developer.

Describe the solution you'd like Butler 4.2 has an amazing flexibility for failed Task notification.What we miss: the right Person (App Owner=App Developer) needs this information, not only the Qlik Sense admin.

Describe alternatives you've considered Hope for new Qlik Sense Upgrade with this feature...

Additional context Qlik Sense with AD Connected have this information synced. https://help.qlik.com/en-US/sense-developer/September2020/Subsystems/ProxyServiceAPI/Content/Sense_ProxyServiceAPI/ProxyServiceAPI-Session-Module-API-User-Get.htm image

mountaindude commented 3 years ago

Good idea, I like it.

We can get the app owner from Qlik Sense, but we won't have his/her email address. It's just not part of what Qlik Sense stores about users. So... I am not sure how this could be done, except by having a separate lookup table/file, where Qlik Sense userIDs are mapped against their email addresses. Would certainly work, but require some additional configuration.

Or do you have any other ideas re this?

ot3kcw6c commented 3 years ago

Our active users are synced with Active Directory.(user directory connectors in qlik sense) Qlik stores this informations in the user properties. There are 3 Types of userproperties: 1) Qlik Sense specific Custom Properties. (Defined in the custom properties section) 2) Email 3) Active Directory Groups

Qlik stores this information, if it is connected to ldap or AD and this information is available.

image

mountaindude commented 3 years ago

You're right - this is available in the Sense repository for user directories synched with an Active Directory instance. Soo.... looks like it would be possible to send emails to app owners, at least to those app owners for which there is an email address in the Sense repository.

Things will be different for other user sources (like Azure, Google, Okta, Facebook, Twitter or whatever ppl out there use to authenticate with Sense..). Ideally a solution would cater for those alternative authentication sources too. Will take some thinking, this.

On Mon, 7 Dec 2020 at 08:36, ot3kcw6c notifications@github.com wrote:

Our active users are synced with Active Directory.(user directory connectors in qlik sense) Qlik stores this informations in the user properties. There are 3 Types of userproperties:

  1. Qlik Sense specific Custom Properties. (Defined in the custom properties section)
  2. Email
  3. Active Directory Groups

Qlik stores this information, if it is connected to ldap or AD and this information is available.

[image: image] https://user-images.githubusercontent.com/61137563/101322272-09139f80-3867-11eb-9b36-8c4b6243d240.png

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ptarmiganlabs/butler/issues/105#issuecomment-739731840, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAH3JDXI7JY7DXMCKH3UOCTSTSAWRANCNFSM4UNCAILQ .

ot3kcw6c commented 3 years ago

Your right. I can only help with AD. The KnowHow for all directory sync sources would require more specific KnowHow. Maybe your general lookup table concept would be a great idea. (independent from the directory.)

mountaindude commented 3 years ago

@ot3kcw6c,

I just wanted to give some heads up that I am working on this feature, with the goal of including it in a coming Butler 5.0 release.

The config file gives an idea of how the feature will work:

emailNotification:
    enable: true
    reloadTaskAborted:
      enable: true
      appOwnerAlert:
        enable: true              # Should app owner get notification email (assuming email address is available in Sense user directory)
        includeOwner:
          includeAll: true
          user:
            - directory: <Sense user directory name>
              userId: <Sense userId>
        excludeOwner:
          user:
            - directory: <Sense user directory name>
              userId: <Sense userId>
      rateLimit: 15               # Min seconds between emails for a given taskID. Defaults to 5 minutes.
      headScriptLogLines: 15
      tailScriptLogLines: 25
      priority: high              # high/normal/low
      subject: 'Qlik Sense reload aborted: "{{taskName}}"'
      bodyFileDirectory: config/email_templates
      htmlTemplateFile: aborted-reload
      fromAdress: Qlik Sense (no-reply) <qliksense-noreply@mycompany.com>
      toAdress:
        - addr1@mycompany.com
        - addr2@mycompany.com

So, the idea is that on the highest level you can toggle on/off sending alert emails to app owners. This can be done independently for task failures and aborted tasks (i.e. running tasks aborted from the QMC or via APIs).

There are also include/exclude lists that deal with the fact that some app owners maybe shouldn't be notified. Maybe system apps are owned by some service account that shouldn't get notifications.

If includeAll: true is set, all app owners will be notified, except those listed under excludeOwner. If includeAll: false you can instead set that specific app owners should be notified. In this scenario it doesn't make much sense to also specify an exclude list, but it's still possible.

I felt this was a reasonable starting point. As for future enhancements I am thinking along the lines of using RegEx for specifying app include/exclude app owners, and being able to specify what apps should be included/excluded.

Makes sense?

mountaindude commented 3 years ago

Closing this as the feature has been implemented and will be included in coming 5.0 version. Feel free to re-open if needed.