Updated Bulk Import Services (markdown)

master
Hunter Long 2020-05-05 03:41:44 -07:00
parent 8f015708da
commit 01679d18a0
1 changed files with 39 additions and 15 deletions

@ -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
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
```
## Requirements
- 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)