diff --git a/README.md b/README.md index 60a9d4c9a0701dda4f5bb3b7266f82453a30c5a0..9159945284d22a0815a554c0356632ac59d655dd 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,17 @@ # ar-prometheus-exporter + ArvanCloud CDN Analytics Prometheus Exporter A very simple Prometheus exporter that exposes metrics from ArvanCloud colocations API as described in the [API documentation](https://www.arvancloud.com/docs/api/cdn/4.0). # Brief + A Prometheus exporter that exposes metrics from ArvanCloud's API as described in the API documentation. ### Try it + Running the container: + ``` git clone git@github.com:arvancloud/ar-prometheus-exporter.git && cd ar-prometheus-exporter docker build -t ar-prometheus-exporter . @@ -19,34 +23,35 @@ docker run -d \ ``` ### Metrics -The exporter exposes the following metrics, all returned per PoP: -| Name | Description | Type | -|:-------------------------------------|:----------------------------------------------------------|:-----:| -| `arvancloud_cdn_update_metrics_error` | number of exporter errors | counter | -| `arvancloud_cdn_requests` | number of requests | gauge | -| `arvancloud_cdn_traffic` | traffic served by ArvanCloud | gauge | -| `arvancloud_cdn_visitors` | number of unique visitors | gauge | -| `arvancloud_cdn_high_request_ips` | high request ips | gauge | -| `arvancloud_cdn_requests_by_country` | number of request by country | gauge | -| `arvancloud_cdn_traffic_by_country` | traffic by country | gauge | -| `arvancloud_cdn_response_time` | response time | gauge | -| `arvancloud_cdn_requests_by_status` | number of request by HTTP status code | gauge | +The exporter exposes the following metrics, all returned per PoP: +| Name | Description | Type | +| :------------------------------------ | :------------------------------------ | :-----: | +| `arvancloud_cdn_update_metrics_error` | number of exporter errors | counter | +| `arvancloud_cdn_requests` | number of requests | gauge | +| `arvancloud_cdn_traffic` | traffic served by ArvanCloud | gauge | +| `arvancloud_cdn_visitors` | number of unique visitors | gauge | +| `arvancloud_cdn_high_request_ips` | high request ips | gauge | +| `arvancloud_cdn_requests_by_country` | number of request by country | gauge | +| `arvancloud_cdn_traffic_by_country` | traffic by country | gauge | +| `arvancloud_cdn_response_time` | response time | gauge | +| `arvancloud_cdn_requests_by_status` | number of request by HTTP status code | gauge | ### Config -| Name | Description | Type | Default -|:-------------------------------------|:----------------------------------------------------------|:-----:|:--------:| -| `MODE` | metrics collector mode | enum(ACTIVE, PASSIVE) | PASSIVE -| `PORT` | listening port | number | 9786 -| `API_KEY` | your Arvan API-Key | string | - -| `DOMAINS` | list of domain wants to scrape metrics | string or comma separate list | - -| `UPDATE_INTERVAL` | update metrics interval (only valid in passive mode) | number(milliseconds) | 30000 -| `BASE_URL` | Arvan base URL | string | https://napi.arvancloud.com/cdn/4.0 -| `METRICS_PERIOD` | Arvan report period | enum(1h, 3h, 6h, 12h, 24h, 7d, 30d) | 3h -| `METRICS_PREFIX` | exported metrics prefix | string | `arvancloud_cdn_` +| Name | Description | Type | Default | +| :---------------- | :--------------------------------------------------- | :---------------------------------: | :--------------------------------: | +| `MODE` | metrics collector mode | enum(ACTIVE, PASSIVE) | PASSIVE | +| `PORT` | listening port | number | 9786 | +| `API_KEY` | your Arvan API-Key | string | - | +| `DOMAINS` | list of domain wants to scrape metrics | string or comma separate list | - | +| `UPDATE_INTERVAL` | update metrics interval (only valid in passive mode) | number(milliseconds) | 30000 | +| `BASE_URL` | Arvan base URL | string | https://napi.arvancloud.ir/cdn/4.0 | +| `METRICS_PERIOD` | Arvan report period | enum(1h, 3h, 6h, 12h, 24h, 7d, 30d) | 3h | +| `METRICS_PREFIX` | exported metrics prefix | string | `arvancloud_cdn_` | ### š‘Øš¸»ā€¨š’» Contributors: + - SadeghHayeri [](https://github.com/sadeghhayeri) -- Yazdan [](https://github.com/yzdann) \ No newline at end of file +- Yazdan [](https://github.com/yzdann) diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..f94dc8a983b116c1ed81c9de8ac7a7064bf08194 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,14 @@ +version: '3.2' +service: + ar-exporter: + build: + context: . + dockerfile: ./dockerfile + targer: app + container_name: ar-exporter + ports: + - 9786:9786 + environment: + DOMAINS: example.com + API_KEY: arvan-api-key + network_mode: "bridge" \ No newline at end of file diff --git a/src/config.js b/src/config.js index 4e04d1ac021b0308c17b078d412b6b95cfb22202..884e0258716c17b9195269ff6d4b3c65e32b8310 100644 --- a/src/config.js +++ b/src/config.js @@ -9,7 +9,7 @@ const CONFIG = { API_KEY: env.API_KEY, DOMAINS: (typeof(env.DOMAINS) === 'string') ? [env.DOMAINS] : env.DOMAINS, UPDATE_INTERVAL: env.UPDATE_INTERVAL || 30000, - BASE_URL: env.BASE_URL || 'https://napi.arvancloud.com/cdn/4.0/', + BASE_URL: env.BASE_URL || 'https://napi.arvancloud.ir/cdn/4.0/', METRICS_PERIOD: env.METRICS_PERIOD || '3h', METRICS_PREFIX: env.METRICS_PREFIX || 'arvancloud_cdn_', }