Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Call for the number of monitors in error #2338

Open
1 task done
ArthurMitchell42 opened this issue Nov 21, 2022 · 2 comments
Open
1 task done

API Call for the number of monitors in error #2338

ArthurMitchell42 opened this issue Nov 21, 2022 · 2 comments
Labels
area:api concearning the api or automation feature-request Request for new features to be added

Comments

@ArthurMitchell42
Copy link

⚠️ 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

@ArthurMitchell42 ArthurMitchell42 added the feature-request Request for new features to be added label Nov 21, 2022
@koen20
Copy link
Contributor

koen20 commented Nov 24, 2022

Duplicate of #118

@ArthurMitchell42
Copy link
Author

ArthurMitchell42 commented 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

@CommanderStorm CommanderStorm added the area:api concearning the api or automation label Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:api concearning the api or automation feature-request Request for new features to be added
Projects
None yet
Development

No branches or pull requests

3 participants