Skip to content

Bulk Import Services

Hunter Long edited this page May 11, 2020 · 14 revisions

You can import multiple services when Statping first loads by creating a file named services.yml in the working directory for Statping. It will insert the new service into the database, and will not be re-added on reboot. All services must be an array under the services: field.

Dynamic Yaml

With Yaml, you can insert "anchors" to make receptive fields simple! Checkout the example below. The &tcpservice anchor will return all the fields belonging to x-tcpservice:. To reuse these fields for each service, you can insert <<: *tcpservice and thats it!

x-tcpservice: &tcpservice
  type: tcp
  check_interval: 60
  timeout: 15
  allow_notifications: true
  notify_after: 0
  notify_all_changes: true
  public: true
  redirect: true

x-httpservice: &httpservice
  type: http
  method: GET
  check_interval: 45
  timeout: 10
  expected_status: 200
  allow_notifications: true
  notify_after: 2
  notify_all_changes: true
  public: true
  redirect: true

services:

  - name: Statping Demo
    domain: https://demo.statping.com
    <<: *httpservice

  - name: Portainer
    domain: portainer
    port: 9000
    <<: *tcpservice

  - name: Statping Github
    domain: https://github.com/statping/statping
    <<: *httpservice

Duplicates

Services that have already been added into the database will not be added again. This is done by creating a SHA256 hash of the following fields...

sha256(name:EXAMPLEdomain:HTTP://DOMAIN.COMport:8080type:HTTPmethod:GET)
Clone this wiki locally