Travis CI

Travis CI is a hosted continuous integration service used to build and test software projects hosted on GitHub and Bitbucket. Travis CI was the first CI service which provided services to open-source projects for free and continues to do so.

Available solutions




This template is for Zabbix version: 5.4

Source: https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/app/travis_http?at=release/5.4

Travis CI by HTTP

Overview

For Zabbix version: 5.4 and higher
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.

This template was tested on:

  • Travis CI, version API V3 2021

Setup

See Zabbix template operation for basic instructions.

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)

Zabbix configuration

No specific Zabbix configuration is required.

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

Template links

There are no template links in this template.

Discovery rules

Name Description Type Key and additional info
Repos metrics discovery

Metrics for Repos statistics.

DEPENDENT travis.repos.discovery

Preprocessing:

- JAVASCRIPT: The text is too long. Please see the template.

- DISCARD_UNCHANGED_HEARTBEAT: 1h

Items collected

Group Name Description Type Key and additional info
Travis Travis: Get health

Getting home JSON using Travis API.

HTTP_AGENT travis.get_health

Preprocessing:

- CHECK_NOT_SUPPORTED

⛔️ON_FAIL: CUSTOM_VALUE -> 0

- JAVASCRIPT: return JSON.parse(value).config ? 1 : 0

Travis Travis: Jobs passed

Total count of passed jobs in all repos.

DEPENDENT travis.jobs.total

Preprocessing:

- JSONPATH: $.jobs.length()

Travis Travis: Jobs active

Active jobs in all repos.

DEPENDENT travis.jobs.active

Preprocessing:

- JSONPATH: $.jobs[?(@.state == "started")].length()

⛔️ON_FAIL: CUSTOM_VALUE -> 0

Travis Travis: Jobs in queue

Jobs in queue in all repos.

DEPENDENT travis.jobs.queue

Preprocessing:

- JSONPATH: $.jobs[?(@.state == "received")].length()

⛔️ON_FAIL: CUSTOM_VALUE -> 0

Travis Travis: Builds

Total count of builds in all repos.

DEPENDENT travis.builds.total

Preprocessing:

- JSONPATH: $.builds.length()

Travis Travis: Builds duration

Sum of all builds durations in all repos.

DEPENDENT travis.builds.duration

Preprocessing:

- JSONPATH: $..duration.sum()

⛔️ON_FAIL: DISCARD_VALUE ->

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

Count of cache files in {#SLUG} repo.

DEPENDENT travis.repo.caches.files[{#SLUG}]

Preprocessing:

- JSONPATH: $.caches.length()

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

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

DEPENDENT travis.repo.caches.size[{#SLUG}]

Preprocessing:

- JSONPATH: $.caches..size.sum()

⛔️ON_FAIL: CUSTOM_VALUE -> 0

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

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

DEPENDENT travis.repo.builds.passed[{#SLUG}]

Preprocessing:

- JAVASCRIPT: return JSON.parse(value).builds.filter(function (e){return e.state == "passed"}).length

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

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

DEPENDENT travis.repo.builds.failed[{#SLUG}]

Preprocessing:

- JAVASCRIPT: The text is too long. Please see the template.

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

Count of total builds in {#SLUG} repo.

DEPENDENT travis.repo.builds.total[{#SLUG}]

Preprocessing:

- JSONPATH: $.builds.length()

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

Percent of passed builds in {#SLUG} repo.

CALCULATED travis.repo.builds.passed.pct[{#SLUG}]

Expression:

last(//travis.repo.builds.passed[{#SLUG}])/last(//travis.repo.builds.total[{#SLUG}])*100
Travis Travis: Repo [{#SLUG}]: Description

Description of Travis repo (git project description).

DEPENDENT travis.repo.description[{#SLUG}]

Preprocessing:

- JSONPATH: $.repositories[?(@.slug == "{#SLUG}")].description.first()

- DISCARD_UNCHANGED_HEARTBEAT: 1h

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

Last build duration in {#SLUG} repo.

DEPENDENT travis.repo.last_build.duration[{#SLUG}]

Preprocessing:

- JSONPATH: $.builds[0].duration

⛔️ON_FAIL: DISCARD_VALUE ->

- DISCARD_UNCHANGED_HEARTBEAT: 1h

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

Last build state in {#SLUG} repo.

DEPENDENT travis.repo.last_build.state[{#SLUG}]

Preprocessing:

- JSONPATH: $.builds[0].state

- DISCARD_UNCHANGED_HEARTBEAT: 1h

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

Last build number in {#SLUG} repo.

DEPENDENT travis.repo.last_build.number[{#SLUG}]

Preprocessing:

- JSONPATH: $.builds[0].number

- DISCARD_UNCHANGED_HEARTBEAT: 1h

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

Last build id in {#SLUG} repo.

DEPENDENT travis.repo.last_build.id[{#SLUG}]

Preprocessing:

- JSONPATH: $.builds[0].id

- DISCARD_UNCHANGED_HEARTBEAT: 1h

Zabbix_raw_items Travis: Get repos

Getting repos using Travis API.

HTTP_AGENT travis.get_repos
Zabbix_raw_items Travis: Get builds

Getting builds using Travis API.

HTTP_AGENT travis.get_builds
Zabbix_raw_items Travis: Get jobs

Getting jobs using Travis API.

HTTP_AGENT travis.get_jobs
Zabbix_raw_items Travis: Repo [{#SLUG}]: Get builds

Getting builds of {#SLUG} using Travis API.

HTTP_AGENT travis.repo.get_builds[{#SLUG}]
Zabbix_raw_items Travis: Repo [{#SLUG}]: Get caches

Getting caches of {#SLUG} using Travis API.

HTTP_AGENT travis.repo.get_caches[{#SLUG}]

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 (or no data for 30m)

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

nodata(/Travis CI by HTTP/travis.get_health,30m)=1 WARNING

Manual close: YES

Travis: Repo [{#SLUG}]: Percent of successful builds are < {$TRAVIS.BUILDS.SUCCESS.PERCENT}%

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 a feedback, discuss the template or ask for help with it at ZABBIX forums.

Articles and documentation

+ Propose new article

No se encuentra la integración que necesitas?