webdevops/pagerduty-exporter

By webdevops

Updated 2 months ago

Prometheus exporter for PagerDuty

Image
Integration & delivery
API management
Monitoring & observability
0

1M+

webdevops/pagerduty-exporter repository overview

PagerDuty Exporter

license DockerHub Quay.io

Prometheus exporter for PagerDuty information (users, teams, schedules, oncalls, incidents...)

Configuration

Usage:
  pagerduty-exporter [OPTIONS]

Application Options:
      --debug                                 debug mode [$DEBUG]
  -v, --verbose                               verbose mode [$VERBOSE]
      --log.json                              Switch log output to json format [$LOG_JSON]
      --pagerduty.authtoken=                  PagerDuty auth token [$PAGERDUTY_AUTH_TOKEN]
      --pagerduty.schedule.override-duration= PagerDuty timeframe for fetching schedule overrides (time.Duration)
                                              (default: 48h) [$PAGERDUTY_SCHEDULE_OVERRIDE_TIMEFRAME]
      --pagerduty.schedule.entry-timeframe=   PagerDuty timeframe for fetching schedule entries (time.Duration)
                                              (default: 72h) [$PAGERDUTY_SCHEDULE_ENTRY_TIMEFRAME]
      --pagerduty.schedule.entry-timeformat=  PagerDuty schedule entry time format (label) (default: Mon, 02 Jan 15:04
                                              MST) [$PAGERDUTY_SCHEDULE_ENTRY_TIMEFORMAT]
      --pagerduty.incident.timeformat=        PagerDuty incident time format (label) (default: Mon, 02 Jan 15:04 MST)
                                              [$PAGERDUTY_INCIDENT_TIMEFORMAT]
      --pagerduty.disable-teams               Set to true to disable checking PagerDuty teams (for plans that don't
                                              include it) [$PAGERDUTY_DISABLE_TEAMS]
      --pagerduty.team-filter=                Passes team ID as a list option when applicable. [$PAGERDUTY_TEAM_FILTER]
      --pagerduty.max-connections=            Maximum numbers of TCP connections to PagerDuty API (concurrency)
                                              (default: 4) [$PAGERDUTY_MAX_CONNECTIONS]
      --bind=                                 Server address (default: :8080) [$SERVER_BIND]
      --scrape.time=                          Scrape time (time.duration) (default: 5m) [$SCRAPE_TIME]
      --scrape.time.live=                     Scrape time incidents and oncalls (time.duration) (default: 1m)
                                              [$SCRAPE_TIME_LIVE]

Help Options:
  -h, --help                                  Show this help message

--pagerduty.authtoken= is a required option. Please refer to the documentation on how to generate a token.

Installing and Running the Exporter

Go

You can get the exporter via the following command:

go get github.com/webdevops/pagerduty-exporter

From here on you will be able to run the exporter as described configuration section.

Container

A containerized version is available via docker pull webdevops/pagerduty-exporter Alternatively you can build the image yourself locally:

git clone [email protected]:webdevops/pagerduty-exporter.git && cd pagerduty-exporter
docker build -t webdevops/pagerduty-exporter:latest .

You are now able to run you exporter locally in a container with the following command:

docker run --rm -ti -p 8080:8080 webdevops/pagerduty-exporter:latest --pagerduty.authtoken=YourGeneratedToken

This will run the container locally, mapping container port 8080 to local port 8080, allowing you to scrape the exporter on 127.0.0.1:8080/metrics

Metrics

MetricScraperDescription
pagerduty_statsCollectorCollector stats
pagerduty_api_counterCollectorPagerDuty api call counter
pagerduty_team_infoTeamTeam informations
pagerduty_user_infoUserUser informations
pagerduty_service_infoServiceService (per team) informations
pagerduty_maintenancewindow_infoMaintanaceWindowsMaintenance window informations
pagerduty_maintenancewindow_statusMaintenance windowstatus (start and endtime)
pagerduty_schedule_infoScheduleSchedule informations
pagerduty_schedule_layer_infoScheduleSchedule layer informations
pagerduty_schedule_layer_entryScheduleSchedule layer schedule entries
pagerduty_schedule_layer_coverageScheduleSchedule layer schedule coverage
pagerduty_schedule_final_entryScheduleSchedule final (rendered) schedule entries
pagerduty_schedule_final_coverageScheduleSchedule final (rendered) schedule coverage
pagerduty_schedule_overrideScheduleSchedule override informations
pagerduty_schedule_oncallOncallSchedule oncall informations
pagerduty_incident_infoIncidentIncident informations
pagerduty_incident_statusIncidentIncident status informations (acknowledgement, assignment)

Prometheus queries

Current oncall person

pagerduty_schedule_oncall{scheduleID="$SCHEDULEID",type="startTime"}
* on (userID) group_left(userName) (pagerduty_user_info)

Next shift

bottomk(1,
  min by (userName, time) (
    pagerduty_schedule_final_entry{scheduleID="$SCHEDULEID",type="startTime"}
    * on (userID) group_left(userName) (pagerduty_user_info) 
  ) - time() > 0
)

Tag summary

Content type

Image

Digest

sha256:3ebadd841

Size

9.9 MB

Last updated

2 months ago

docker pull webdevops/pagerduty-exporter:main