From 01679d18a085de9eda6958b5891e2ec1a69a31f0 Mon Sep 17 00:00:00 2001 From: Hunter Long Date: Tue, 5 May 2020 03:41:44 -0700 Subject: [PATCH] Updated Bulk Import Services (markdown) --- Bulk-Import-Services.md | 54 +++++++++++++++++++++++++++++------------ 1 file changed, 39 insertions(+), 15 deletions(-) diff --git a/Bulk-Import-Services.md b/Bulk-Import-Services.md index 94e6ba5..2060465 100644 --- a/Bulk-Import-Services.md +++ b/Bulk-Import-Services.md @@ -1,19 +1,43 @@ -You can import multiple services based on a CSV file with the format below. You can view an example CSV file at [source/tmpl/bulk_import.csv](https://github.com/statping/statping/blob/master/source/tmpl/bulk_import.csv). Visit the Statping Settings page and scroll to the bottom to upload your CSV file and import multiple services with ease! +You can import multiple services when the Statping service first loads by creating a file named [service.yml](https://github.com/statping/statping/wiki/services.yml). It will insert the new service into the database, and will not be re-added on reboot. -You can also download the example CSV file with the [Statping - Bulk Import Services](https://docs.google.com/spreadsheets/d/1vcWM1ecyVFyCrQ-cmNAs5I52B9vq8wzWOw5jvpmUcJI/edit?usp=sharing) link. +## Custom 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! -###### `bulk_import.csv` -```csv -name,domain,expected,expected_status,interval,type,method,post_data,port,timeout,order,allow_notifications,public,group_id,headers,permalink -Bulk Upload,http://google.com,,200,60s,http,get,,,60s,1,TRUE,TRUE,,Authorization=example,bulk_example -JSON Post,https://jsonplaceholder.typicode.com/posts,,200,1m,http,post,"{""id"": 1, ""title"": 'foo', ""body"": 'bar', ""userId"": 1}",,15s,2,TRUE,TRUE,,Content-Type=application/json,json_post_example -Google DNS,8.8.8.8,,,,tcp,,,53,10s,3,TRUE,TRUE,,,google_dns_example -Google DNS UDP,8.8.8.8,,,,udp,,,53,10s,4,TRUE,TRUE,,,google_dns_udp_example -``` +```yaml +x-tcpservice: &tcpservice + type: tcp + check_interval: 60 + timeout: 15 + allow_notifications: true + notify_after: 0 + notify_all_changes: true + public: true + redirect: true -## Requirements +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 -- First row must include the CSV column names (name,domain,expected, ...) -- Each row must have 16 columns based on the first row column names. -- `interval` must be in Duration format. (`60s` is 60 seconds, `2m` is 2 minutes, `1h` is 1 hour) -- `timeout` must be in Duration format. (`60s` is 60 seconds, `2m` is 2 minutes, `1h` is 1 hour) +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 +``` \ No newline at end of file