API Call for the number of monitors in error #1572

Open
opened 2026-02-28 02:25:52 -05:00 by deekerman · 2 comments
Owner

Originally created by @ArthurMitchell42 on GitHub (Nov 21, 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 great to have an API call which returns a JSON structure containing at least the number of monitors in error and possibly the total number of monitors and/or the number that have been in error in a defined period.
The use I have for this is integrating it with the conky desktop information application which would allow an fast report right on the desktop for failures

✔️ Solution

host:port/api/status/all returning a JSON structure with the information

Alternatives

I've thought of writing a Python script to loop through all possible monitor numbers but that would be bandwidth and resource intensive when polling significant numbers of monitors, also the numbers may not be co-linear?

📝 Additional Context

No response

Originally created by @ArthurMitchell42 on GitHub (Nov 21, 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 great to have an API call which returns a JSON structure containing at least the number of monitors in error and possibly the total number of monitors and/or the number that have been in error in a defined period. The use I have for this is integrating it with the conky desktop information application which would allow an fast report right on the desktop for failures ### ✔️ Solution host:port/api/status/all returning a JSON structure with the information ### ❓ Alternatives I've thought of writing a Python script to loop through all possible monitor numbers but that would be bandwidth and resource intensive when polling significant numbers of monitors, also the numbers may not be co-linear? ### 📝 Additional Context _No response_
Author
Owner

@koen20 commented on GitHub (Nov 24, 2022):

Duplicate of https://github.com/louislam/uptime-kuma/issues/118

@koen20 commented on GitHub (Nov 24, 2022): Duplicate of https://github.com/louislam/uptime-kuma/issues/118
Author
Owner

@ArthurMitchell42 commented on GitHub (Nov 30, 2022):

Hi, I'm not quite sure it's a duplicate, what I'm looking for is a bit more simple than a big change.
My solution was a script to scrape the metrics:

#!/usr/bin/bash

TEMP_FILE=mktemp
PASS_COL='${color green}'
FAIL_COL='${color grey}'

wget --user USERNAME --password 'PASSWORD' -qO $TEMP_FILE http://X.X.X.X:3001/metrics
PASS=$(cat $TEMP_FILE | egrep -c "^monitor_status.*1$")
FAIL=$(cat $TEMP_FILE | egrep -c "^monitor_status.*0$")
END_STRING='${color}Down'

if [ $FAIL -gt 0 ] 
then
    FAIL_COL='${color red}${blink ${lua_parse iconmap 11 3 ${template0}} '
    END_STRING='Down}${color}'
fi

echo $PASS_COL$PASS '${color}Up -' $FAIL_COL$FAIL $END_STRING
rm $TEMP_FILE

Regards,
A

@ArthurMitchell42 commented on GitHub (Nov 30, 2022): Hi, I'm not quite sure it's a duplicate, what I'm looking for is a bit more simple than a big change. My solution was a script to scrape the metrics: ```bash #!/usr/bin/bash TEMP_FILE=mktemp PASS_COL='${color green}' FAIL_COL='${color grey}' wget --user USERNAME --password 'PASSWORD' -qO $TEMP_FILE http://X.X.X.X:3001/metrics PASS=$(cat $TEMP_FILE | egrep -c "^monitor_status.*1$") FAIL=$(cat $TEMP_FILE | egrep -c "^monitor_status.*0$") END_STRING='${color}Down' if [ $FAIL -gt 0 ] then FAIL_COL='${color red}${blink ${lua_parse iconmap 11 3 ${template0}} ' END_STRING='Down}${color}' fi echo $PASS_COL$PASS '${color}Up -' $FAIL_COL$FAIL $END_STRING rm $TEMP_FILE ``` Regards, A
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#1572
No description provided.