No description
Find a file
2025-10-10 18:00:22 +02:00
.gitignore init 2025-10-10 18:00:22 +02:00
app.py init 2025-10-10 18:00:22 +02:00
LICENSE init 2025-10-10 18:00:22 +02:00
monitors.csv.example init 2025-10-10 18:00:22 +02:00
README.md init 2025-10-10 18:00:22 +02:00

Phare.io Monitor Bulk Import

Python script to bulk-import uptime monitors into Phare.io from a CSV file.

Quick Start

  1. Install dependencies:

    pip install requests
    
  2. Configure your API token in app.py:

    TOKEN = "phare_YOUR_API_TOKEN_HERE"
    
  3. Prepare your monitors:

    cp monitors.csv.example monitors.csv
    # Edit monitors.csv with your monitors
    
  4. Run the import:

    python3 app.py
    

CSV Format

The CSV file uses the same field names as the Phare.io API.

Basic Structure

name,protocol,url,method,interval,timeout,incident_confirmations,recovery_confirmations,regions
My Website,http,https://example.com,GET,300,5000,3,3,eu-deu-fra

Important Notes

  • Protocol: Only http and tcp are supported
  • HTTP monitors require: url, method
  • TCP monitors require: host, port, connection (plain/tls)
  • Regions: Semicolon-separated list (e.g., eu-deu-fra;na-usa-iad)
  • JSON fields (headers, success_assertions): Must be valid JSON strings escaped for CSV

See monitors.csv.example for complete examples of all monitor types.

API Parameters

For all available parameters, valid values, and detailed descriptions, see the official API documentation:

Phare.io API - Create a Monitor

The CSV columns map directly to API parameters. For example:

  • CSV column interval → API parameter interval
  • CSV column success_assertions → API parameter success_assertions
  • CSV column regions → API parameter regions (as semicolon-separated string)

Troubleshooting

Authentication Error (401):
Check your API token in app.py

Invalid Parameter Errors:
Verify your values against the API documentation

JSON Parsing Errors:
Ensure proper CSV escaping for JSON fields: "{""name"":""value""}"

License

MIT