Setting the status of the push-monitor status to DOWN/UP/... #910

Closed
opened 2026-02-28 02:03:22 -05:00 by deekerman · 2 comments
Owner

Originally created by @miluecke on GitHub (Mar 18, 2022).

⚠️ Please verify that this feature request has NOT been suggested before.

  • I checked and didn't find similar feature request

🏷️ Feature Request Type

API

🔖 Feature description

It would be useful to set the current status for a push monitor manually via the API endpoint. It may be particularly useful in addition with #1359.

✔️ Solution

The following patch allows to set the status with:

  • ?status=0 for DOWN
  • ?status=1 for UP
  • ?status=2 for PENDING
--- api-router.js.orig	2022-03-18 13:49:35.146412530 +0100
+++ api-router.js	2022-03-18 13:49:51.782064541 +0100
@@ -23,6 +23,7 @@
         let pushToken = request.params.pushToken;
         let msg = request.query.msg || "OK";
         let ping = request.query.ping || null;
+        let status = parseInt(request.query.status || UP,10);
 
         let monitor = await R.findOne("monitor", " push_token = ? AND active = 1 ", [
             pushToken
@@ -34,7 +35,7 @@
 
         const previousHeartbeat = await Monitor.getPreviousHeartbeat(monitor.id);
 
-        let status = UP;
+        //let status = UP;
         if (monitor.isUpsideDown()) {
             status = flipStatus(status);
         }

Alternatives

No response

📝 Additional Context

No response

Originally created by @miluecke on GitHub (Mar 18, 2022). ### ⚠️ Please verify that this feature request has NOT been suggested before. - [x] I checked and didn't find similar feature request ### 🏷️ Feature Request Type API ### 🔖 Feature description It would be useful to set the current status for a push monitor manually via the API endpoint. It may be particularly useful in addition with #1359. ### ✔️ Solution The following patch allows to set the status with: - `?status=0` for `DOWN` - `?status=1` for `UP` - `?status=2` for `PENDING` ```diff --- api-router.js.orig 2022-03-18 13:49:35.146412530 +0100 +++ api-router.js 2022-03-18 13:49:51.782064541 +0100 @@ -23,6 +23,7 @@ let pushToken = request.params.pushToken; let msg = request.query.msg || "OK"; let ping = request.query.ping || null; + let status = parseInt(request.query.status || UP,10); let monitor = await R.findOne("monitor", " push_token = ? AND active = 1 ", [ pushToken @@ -34,7 +35,7 @@ const previousHeartbeat = await Monitor.getPreviousHeartbeat(monitor.id); - let status = UP; + //let status = UP; if (monitor.isUpsideDown()) { status = flipStatus(status); } ``` ### ❓ Alternatives _No response_ ### 📝 Additional Context _No response_
Author
Owner

@koen20 commented on GitHub (Mar 18, 2022):

Duplicate of #118

@koen20 commented on GitHub (Mar 18, 2022): Duplicate of #118
Author
Owner

@CommanderStorm commented on GitHub (Jan 31, 2024):

Closing as implemented.
Setting ?status=down makes the monitor go down.

Relevant code:

github.com/louislam/uptime-kuma@3cea7d4eb2/server/routers/api-router.js (L53-L54)

@CommanderStorm commented on GitHub (Jan 31, 2024): Closing as implemented. Setting `?status=down` makes the monitor go down. Relevant code: https://github.com/louislam/uptime-kuma/blob/3cea7d4eb23eb69140a79f2eb58d1d45a98dc88e/server/routers/api-router.js#L53-L54
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/uptime-kuma#910
No description provided.