Skip to content

Instantly share code, notes, and snippets.

@stephen-soltesz
Last active December 9, 2015 18:14
Show Gist options
  • Save stephen-soltesz/28fe82b9436a12473e27 to your computer and use it in GitHub Desktop.
Save stephen-soltesz/28fe82b9436a12473e27 to your computer and use it in GitHub Desktop.
compare nagios services
#!/bin/bash
set -x
set -e
URLBASE='http://nagios.measurementlab.net/baseList?show_state=1&plugin_output=1'
for service in ndt ndt_ssl ; do
curl -s --anyauth --basic --user $USERNAME:$PASSWORD \
"${URLBASE}&service_name=$service" \
| grep "$service 0" \
| tr '/' ' ' \
| sort \
| awk '{print $1}' > good.$service.txt
done
# Lines unique to file1.
comm -2 -3 good.ndt.txt good.ndt_ssl.txt | sort > ndt-only.txt
echo "Nodes who are running ndt but NOT ndt_ssl"
cat ndt-only.txt
echo "Summary of good service counts"
wc good.ndt*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment