geekxflood / workspaceone-exporter

WorkspaceOne UEM Prometheus exporter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WorkspaceOne Prometheus Exporter

WorkspaceOne UEM Prometheus exporter

Description

This exporter is used to export WorkspaceOne UEM value to OpenMetrics format.

TODO

  • Correct api_calls metrics as it doesn't count the total amount of API calls but only one made by one Prometheus scrape
  • Validate the TAG_FILTER parsing when an empty parse filter is given
  • Set some flags to be able to select if we want values per tag or not as it can consume tons of API calls
  • Introduce a throttling mechanism to avoid overloading the WS1 API
  • Create a subprocess for querying getting the device's inventory
  • Timeout the API call and produce a metric of this
  • Add more metrics (open to suggestions)

Accessing the metrics

  • Default port: 9740
  • Endpoint: /metrics

example: http://localhost:9740/metrics

Metrics

Metric Description Labels Type Implemented
api_calls The number of API calls made to the WS1 tenant none Counter
devices_number The number of devices in the WS1 tenant none Gauge
devices_os The number of devices per OS in the WS1 tenant os Gauge
devices_offline The number of devices in the WS1 tenant that are offline none Gauge
devices_online The number of devices in the WS1 tenant that are online none Gauge
tags_sum The number of tags in the WS1 tenant none Gauge
devices_online_tag The number of devices online per tag in the WS1 tenant tag, model Gauge
devices_offline_tag The number of devices offline per tag in the WS1 tenant tag, model Gauge
devices_offline_1m_tag The number of devices offline per tag in the WS1 tenant for more than the last month tag, model Gauge

Environment variables

Variable Description Type Comment
WS1_AUTH_KEY WorkspaceOne UEM user Auth Key string
WS1_TENANT_KEY WorkspaceOne UEM tenant key string
WS1_URL WorkspaceOne UEM base API URL endpoint, must finished by /API string
WS1_LGID WorkspaceOne UEM highest Group ID string
WS1_INTERVAL Interval between each WS1 check to it's enrolled devices in minutes string
TAG_PARSING Enable or disable the tag parsing string must be true of false
TAG_FILTER String to filter Tag by it string Will apply a regex filter using this string over all tags
INSECURE Enable or disable the TLS verification string must be true of false

FlowChart

graph RL
    A[Prometheus ] --> B[WorkspaceOne Exporter]
    B --> C[WorkspaceOne UEM]

Usage

Filter by Tag

You can filter the devices by tag by using the TAG_FILTER environment variable. It will enable the system to only keep the tags that contain the string you set.

Running it locally

go run ./...

Run it as a Docker container

docker build -t workspaceone-prometheus-exporter .
docker run -d -p 9740:9740 workspaceone-prometheus-exporter

Made with VHS

Useful links

About

WorkspaceOne UEM Prometheus exporter

License:MIT License


Languages

Language:Go 86.0%Language:Smarty 9.2%Language:Dockerfile 2.5%Language:Makefile 2.4%