Closed saicrazyfire closed 5 years ago
I thought this would be an interesting candidate for using cmdrunner, and thought I would give it a try.
By using jq, on OSX, I can create the following shell script:
#!/bin/sh
curl -s https://status.slack.com/api/v2.0.0/current | jq -r '"Status: " + (if (.status == "active") then "Active Incident" else "Ok" end),"Last Updated: " + .date_updated,if (.active_incidents[] | length) > 0 then "Active Incidents\n" + .active_incidents[] .title else "" end'
Then,adding the following to the config:
slack_status:
cmd: "slack_status_check.sh"
enabled: true
type: "cmdrunner"
position:
top: 5
left: 0
height: 3
width: 4
refreshInterval: 30
I get the following widget:
Wow, jq
is really powerful; did not know you could do all that. Very handy, thanks! And it came at the right time, Slack is currently experiencing a major outage 😱
Do you know if the cmdrunner type has an optional title field? I'd like to not have the filename as the title
We do not, but I agree with your observation. I'll work on making this possible, for friendlier titles.
You should now be able to set title
for cmdrunner @saicrazyfire
@Seanstoppable's example has been merged into the documentation here: https://wtfutil.com/modules/cmdrunner/statuspages/
What problem does this solve?
Find the status of certain websites like Slack. I can
curl
the status by doing this:curl -s https://status.slack.com/api/v2.0.0/current
How do envision it working?
The module should have a title field and pretty print certain JSON attributes
For Slack, the JSON response of above is:
I would like the module to print the status, last checked (date_updated) and any incidents, if any