Repository
Munin (contrib)
Last change
2011-10-03
Keywords
Language
Shell
License
curl

earthquakes-stronger-than-m4-and-m5-plus-solar-act

Sadly there is no documentation for this plugin.

#!/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"