You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
yzl 93958d0fb0
zabbix6.0
1 year ago
..
README.md zabbix6.0 1 year ago
template_app_travis_ci_http.yaml zabbix6.0 1 year ago

README.md

Travis CI by HTTP

Overview

The template to monitor Travis CI by Zabbix that work without any external scripts. Most of the metrics are collected in one go, thanks to Zabbix bulk data collection.

Requirements

Zabbix version: 7.0 and higher.

Tested versions

This template has been tested on:

  • Travis CI API V3 2021

Configuration

Zabbix should be configured according to the instructions in the Templates out of the box section.

Setup

You must set {$TRAVIS.API.TOKEN} and {$TRAVIS.API.URL} macros. {$TRAVIS.API.TOKEN} is a Travis API authentication token located in User -> Settings -> API authentication. {$TRAVIS.API.URL} could be in 2 different variations:

  • for a private project : api.travis-ci.com
  • for an enterprise projects: api.example.com (where you replace example.com with the domain Travis CI is running on)

Macros used

Name Description Default
{$TRAVIS.API.TOKEN}

Travis API Token

{$TRAVIS.API.URL}

Travis API URL

api.travis-ci.com
{$TRAVIS.BUILDS.SUCCESS.PERCENT}

Percent of successful builds in the repo (for trigger expression)

80

Items

Name Description Type Key and additional info
Travis: Get repos

Getting repos using Travis API.

HTTP agent travis.get_repos
Travis: Get builds

Getting builds using Travis API.

HTTP agent travis.get_builds
Travis: Get jobs

Getting jobs using Travis API.

HTTP agent travis.get_jobs
Travis: Get health

Getting home JSON using Travis API.

HTTP agent travis.get_health

Preprocessing

  • Check for not supported value

    Custom on fail: Set value to: 0

  • JavaScript: The text is too long. Please see the template.

Travis: Jobs passed

Total count of passed jobs in all repos.

Dependent item travis.jobs.total

Preprocessing

  • JSON Path: $.jobs.length()

Travis: Jobs active

Active jobs in all repos.

Dependent item travis.jobs.active

Preprocessing

  • JSON Path: $.jobs[?(@.state == "started")].length()

    Custom on fail: Set value to: 0

Travis: Jobs in queue

Jobs in queue in all repos.

Dependent item travis.jobs.queue

Preprocessing

  • JSON Path: $.jobs[?(@.state == "received")].length()

    Custom on fail: Set value to: 0

Travis: Builds

Total count of builds in all repos.

Dependent item travis.builds.total

Preprocessing

  • JSON Path: $.builds.length()

Travis: Builds duration

Sum of all builds durations in all repos.

Dependent item travis.builds.duration

Preprocessing

  • JSON Path: $..duration.sum()

    Custom on fail: Discard value

Triggers

Name Description Expression Severity Dependencies and additional info
Travis: Service is unavailable

Travis API is unavailable. Please check if the correct macros are set.

last(/Travis CI by HTTP/travis.get_health)=0 High Manual close: Yes
Travis: Failed to fetch home page

Zabbix has not received any data for items for the last 30 minutes.

nodata(/Travis CI by HTTP/travis.get_health,30m)=1 Warning Manual close: Yes

LLD rule Repos metrics discovery

Name Description Type Key and additional info
Repos metrics discovery

Metrics for Repos statistics.

Dependent item travis.repos.discovery

Preprocessing

  • JavaScript: The text is too long. Please see the template.

  • Discard unchanged with heartbeat: 1h

Item prototypes for Repos metrics discovery

Name Description Type Key and additional info
Travis: Repo [{#SLUG}]: Get builds

Getting builds of {#SLUG} using Travis API.

HTTP agent travis.repo.get_builds[{#SLUG}]
Travis: Repo [{#SLUG}]: Get caches

Getting caches of {#SLUG} using Travis API.

HTTP agent travis.repo.get_caches[{#SLUG}]
Travis: Repo [{#SLUG}]: Cache files

Count of cache files in {#SLUG} repo.

Dependent item travis.repo.caches.files[{#SLUG}]

Preprocessing

  • JSON Path: $.caches.length()

Travis: Repo [{#SLUG}]: Cache size

Total size of cache files in {#SLUG} repo.

Dependent item travis.repo.caches.size[{#SLUG}]

Preprocessing

  • JSON Path: $.caches..size.sum()

    Custom on fail: Set value to: 0

Travis: Repo [{#SLUG}]: Builds passed

Count of all passed builds in {#SLUG} repo.

Dependent item travis.repo.builds.passed[{#SLUG}]

Preprocessing

  • JavaScript: The text is too long. Please see the template.

Travis: Repo [{#SLUG}]: Builds failed

Count of all failed builds in {#SLUG} repo.

Dependent item travis.repo.builds.failed[{#SLUG}]

Preprocessing

  • JavaScript: The text is too long. Please see the template.

Travis: Repo [{#SLUG}]: Builds total

Count of total builds in {#SLUG} repo.

Dependent item travis.repo.builds.total[{#SLUG}]

Preprocessing

  • JSON Path: $.builds.length()

Travis: Repo [{#SLUG}]: Builds passed, %

Percent of passed builds in {#SLUG} repo.

Calculated travis.repo.builds.passed.pct[{#SLUG}]
Travis: Repo [{#SLUG}]: Description

Description of Travis repo (git project description).

Dependent item travis.repo.description[{#SLUG}]

Preprocessing

  • JSON Path: $.repositories[?(@.slug == "{#SLUG}")].description.first()

  • Discard unchanged with heartbeat: 1h

Travis: Repo [{#SLUG}]: Last build duration

Last build duration in {#SLUG} repo.

Dependent item travis.repo.last_build.duration[{#SLUG}]

Preprocessing

  • JSON Path: $.builds[0].duration

    Custom on fail: Discard value

  • Discard unchanged with heartbeat: 1h

Travis: Repo [{#SLUG}]: Last build state

Last build state in {#SLUG} repo.

Dependent item travis.repo.last_build.state[{#SLUG}]

Preprocessing

  • JSON Path: $.builds[0].state

  • Discard unchanged with heartbeat: 1h

Travis: Repo [{#SLUG}]: Last build number

Last build number in {#SLUG} repo.

Dependent item travis.repo.last_build.number[{#SLUG}]

Preprocessing

  • JSON Path: $.builds[0].number

  • Discard unchanged with heartbeat: 1h

Travis: Repo [{#SLUG}]: Last build id

Last build id in {#SLUG} repo.

Dependent item travis.repo.last_build.id[{#SLUG}]

Preprocessing

  • JSON Path: $.builds[0].id

  • Discard unchanged with heartbeat: 1h

Trigger prototypes for Repos metrics discovery

Name Description Expression Severity Dependencies and additional info
Travis: Repo [{#SLUG}]: Percent of successful builds

Low successful builds rate.

last(/Travis CI by HTTP/travis.repo.builds.passed.pct[{#SLUG}])<{$TRAVIS.BUILDS.SUCCESS.PERCENT} Warning Manual close: Yes
Travis: Repo [{#SLUG}]: Last build status is 'errored'

Last build status is errored.

find(/Travis CI by HTTP/travis.repo.last_build.state[{#SLUG}],,"like","errored")=1 Warning Manual close: Yes

Feedback

Please report any issues with the template at https://support.zabbix.com

You can also provide feedback, discuss the template, or ask for help at ZABBIX forums