Skip to content

cloudeteer/m365-exporter

Repository files navigation

CI GitHub license Current Release GitHub Repo stars GitHub all releases Go Report Card


Note

This repository is publicly accessible as part of our open-source initiative. We welcome contributions from the community alongside our organization's primary development efforts.


m365-exporter

About

A Microsoft 365 exporter for Prometheus metrics. The exporter uses the Microsoft Graph API to collect metrics about Microsoft 365 services and exports them in a format that can be scraped by Prometheus.

Collectors

The following collectors are implemented:

Name Description
adsync Entra ID Connect Health
intune Intune devices
license Licenses usage
onedrive Onedrive usage
securescore Securescore
servicehealth Service Health
teams Teams

Installation

Single binary

Download the latest release from the release page.

Docker

A Docker image exists on GitHub container registry.

Tags:

  • ghcr.io/cloudeteer/m365-exporter:<VERSION>

Configuration

MS Graph Permissions

The exporter requires the following permissions to be set in the Azure AD app registration as Application permissions:

  • DeviceManagementConfiguration.Read.All
  • DeviceManagementManagedDevices.Read.All
  • Directory.Read.All
  • Files.Read.All
  • Organization.Read.All
  • SecurityEvents.Read.All
  • ServiceHealth.Read.All
  • Sites.Read.All
  • TeamSettings.Read.All
  • User.Read.All

Keep in mind, after granting the permissions, the administrator must consent to them.

Entra ID Connect Health

Permissions for Entra ID Connect Health must be set in the on the Entra ID Connect Health page via permissions. The Read permission is required.

Via config file

By default, the exporter will search in /etc/m365-exporter/ a file named m365-exporter-config.yaml, alternatively the file can be placed in the current working directory of the program. It’s possible to set a specific location of the config file via setting the M365_CONFIGFILE environment variable.

A fully fledged example config file can be found in the docs folder.

Config Parameter Info
settings.loglevel Possible values are "panic","fatal","error","warning","info","debug" and "trace". Default is "info".
settings.serviceHealthStatusRefreshRate Refresh rate of service health status in minutes. Only Integers allowed. Default is 5 minutes.
settings.serviceHealthIssueKeepDays Setting how long an Incident or Advisory should be kept as resolved in the metrics.
onedrive.scrambleNames bool whether the label for individual onedrive metrics should have a scrambled version of the UPN
onedrive.scrambleSalt Set the salt to scramble the UPNs, a default value is set, so UPN hashes are always salted

Via environment variables

Environment variables can be used to set configuration parameters. If a parameter is set via the environment, it takes precedence over the settings in the config file.

The environment variable names correspond to a key in the YAML file, by prefixing it with M365_ and where the .s are replaced by _. M365_SERVER_HOST set the server.host parameter in the YAML file.

Caution

The config provider can’t handle boolean values passed through the environment.

Authentication

m365-exporter supports all authentication supported by Azure SDK for Go.

Service principal with a secret

Variable name Value
AZURE_CLIENT_ID Application ID of an Azure service principal
AZURE_TENANT_ID ID of the application's Azure AD tenant
AZURE_CLIENT_SECRET Password of the Azure service principal

Service principal with certificate

Variable name Value
AZURE_CLIENT_ID Application ID of an Azure service principal
AZURE_TENANT_ID ID of the application's Azure AD tenant
AZURE_CLIENT_CERTIFICATE_PATH Path to a certificate file including private key (without password protection)

Use a managed identity

Variable name Value
AZURE_CLIENT_ID User-assigned managed client ID. Can be avoid, if a system assign identity is used
AZURE_TENANT_ID ID of the application's Azure AD tenant

Supporting documentation

Building

Run make help to see available make targets.

To contribute to the project, refer to the CONTRIBUTING.md file.

Commercial support

For commercial support, contact Cloudeteer.

License

This project is licensed under the MIT License.