# 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](https://www.zabbix.com/documentation/7.0/manual/config/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**

| |Travis: Jobs passed|

Total count of passed jobs in all repos.

|Dependent item|travis.jobs.total

**Preprocessing**

| |Travis: Jobs active|

Active jobs in all repos.

|Dependent item|travis.jobs.active

**Preprocessing**

| |Travis: Jobs in queue|

Jobs in queue in all repos.

|Dependent item|travis.jobs.queue

**Preprocessing**

| |Travis: Builds|

Total count of builds in all repos.

|Dependent item|travis.builds.total

**Preprocessing**

| |Travis: Builds duration|

Sum of all builds durations in all repos.

|Dependent item|travis.builds.duration

**Preprocessing**

| ### 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**

| ### 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**

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

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

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

**Preprocessing**

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

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

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

**Preprocessing**

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

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

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

**Preprocessing**

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

Count of total builds in {#SLUG} repo.

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

**Preprocessing**

| |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**

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

Last build duration in {#SLUG} repo.

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

**Preprocessing**

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

Last build state in {#SLUG} repo.

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

**Preprocessing**

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

Last build number in {#SLUG} repo.

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

**Preprocessing**

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

Last build id in {#SLUG} repo.

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

**Preprocessing**

| ### 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`](https://support.zabbix.com) You can also provide feedback, discuss the template, or ask for help at [`ZABBIX forums`](https://www.zabbix.com/forum/zabbix-suggestions-and-feedback)