2
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00
contrib-munin/plugins/other/earthquakes-stronger-than-m4-and-m5-plus-solar-act
2011-12-18 15:10:46 +01:00

53 lines
1.5 KiB
Bash
Executable file

#!/bin/sh
#
# Plugin for Munin 1.4.5 for counting and graph all the earthquakes above 4 and 5 magnitude.
# Plus a Wolf Number ( index of the solar activity ) to see if any correlations.
# Vik Banev, 2011
# http://www.ulitka.com
#
#
# data channels provided by USGS abd NOAA
M25EQ="http://earthquake.usgs.gov/earthquakes/catalogs/eqs7day-M2.5.txt"
CWN="ftp://ftp.swpc.noaa.gov/pub/latest/SRS.txt"
#
# counting all the earthquakes with magnitude 4 and up
M4PLUS=`curl -s $M25EQ | grep -v Datetime | awk -F"," {'print $9'} | awk '$1 > 3.9 { n++ }; END { print n+0 } '`
#
# counting all the earthquakes with magnitude 5 and up
M5PLUS=`curl -s $M25EQ | grep -v Datetime | awk -F"," {'print $9'} | awk '$1 > 4.9 { n++ }; END { print n+0 } '`
#
# counting all the sun spots
SSPOTS=`curl -s $CWN | sed -n '/Mag/,/IA/p' | grep "^[0-9].**" | awk '{sum += $7;} END {print sum;}'`
#
# counting all the nonempty groups
SSGROUPS=`curl -s $CWN | sed -n '/Mag/,/IA/p' | grep "^[0-9].**" | wc -l`
#
# the Wolf Number math
WN=`echo "$SSPOTS+$SSGROUPS*10" | bc`
#
# tests and actual graphing
#
case $1 in
config)
cat <<'EOM'
graph_title M4+, M5+ earthquakes and WN in past 7 days
graph_vlabel M4+ / week, M5+ / week, WN
eq5.label M5+ earthquakes
eq5.warning 50
eq5.critical 70
eq4.label M4+ earthquakes
eq4.warning 100
eq4.critical 120
wn.label Solar activity (Wolf Number)
wn.warning 110
wn.critical 130
EOM
exit 0;;
esac
#
echo -n "eq5.value "
echo $M5PLUS
echo -n "eq4.value "
echo $M4PLUS
echo -n "wn.value "
echo "$WN"