How to Ping
The Ping API is an easy way to integrate your scheduled jobs with Cron Job Watcher monitors.
To integrate your job with a Cron Job Watcher monitor, you need to ping from your cron job every time it runs.
Endpoint | Description |
---|---|
https://app.eventmonitor.dev/ping/<monitor‑uuid> |
Monitor successful scheduled runs. |
https://app.eventmonitor.dev/ping/<monitor‑uuid>?type=start |
Acknowledge start of job. |
https://app.eventmonitor.dev/ping/<monitor‑uuid>?type=finish |
Acknowledge job finished. |
https://app.eventmonitor.dev/ping/<monitor‑uuid>?type=fail |
Acknowledge failure; sets monitor to ALERT. |
Below are examples of how to ping your monitor using different tools and languages:
curl --retry 3 https://app.cronjobwatcher.com/ping/your-monitor-uuid >/dev/null 2>&1
import requests
try:
requests.get("https://app.cronjobwatcher.com/ping/your-monitor-uuid", timeout=10)
except requests.RequestException as e:
print("Ping failed:", e)
const https = require('https');
https.get("https://app.cronjobwatcher.com/ping/your-monitor-uuid", (res) => {
console.log(`Status: ${res.statusCode}`);
}).on('error', (e) => {
console.error(e);
});
<?php
file_get_contents('https://app.cronjobwatcher.com/ping/your-monitor-uuid');
?>
package main
import (
"net/http"
"log"
)
func main() {
resp, err := http.Get("https://app.cronjobwatcher.com/ping/your-monitor-uuid")
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
log.Println("Ping status:", resp.Status)
}
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
public class CronPing {
public static void main(String[] args) {
try {
URL url = new URL("https://app.cronjobwatcher.com/ping/your-monitor-uuid");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
System.out.println("Response code: " + connection.getResponseCode());
} catch (IOException e) {
System.err.println("Ping failed: " + e.getMessage());
}
}
}