Skip to content

Instantly share code, notes, and snippets.

@muhamad-ridwant-tech
Last active January 16, 2024 15:05
Show Gist options
  • Save muhamad-ridwant-tech/cdef36610f7825ffa286504bc0935683 to your computer and use it in GitHub Desktop.
Save muhamad-ridwant-tech/cdef36610f7825ffa286504bc0935683 to your computer and use it in GitHub Desktop.
Check services with pushgateway prometheus
status="$(systemctl is-active Services_Name])"
if [ "$status" = "active" ]; then
echo "Services_Name 1" | curl --data-binary @- http://localhost:9091/metrics/job/Pushgateway/instance/compute-01
else
echo "Service_Name 0" | curl --data-binary @- http://localhost:9091/metrics/job/Pushgateway/instance/compute-01
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment