Look up customer name from Mist API
Device events posted to the webhook API include a org_id
attribute. Currently, this value is posted verbatim to an incident tag kunde
, but it's not very useful, since it an opaque, Mist-internal UUID of sorts.
The kunde
tag should, in our Argus, always be the customer's top level domain (e.g. khio.no
). This information can be had by looking up the org_id
in the Mist API.
Pre-requisites
- mist-argus must be able to be configured with the URL for the Mist API, and an access token to this API. This could be in a config file, but it is preferable to have it as environment variables, so they can be easily fed into mist-argus-run from K8s secrets.
Design considerations
- Organization identifier lookups should be cached. If 200 events come in over the course of 5 seconds, and they all are tagged with the same
org_id
, it makes no sense to ask the Mist API 200 times for the same org.- Caching for 24 hours seems reasonable
- According to the Mist API docs, tokens expire if they are not used in >90 days. This ensures we use it at least once a day (provided that at least one event comes in every day)