Révision ec351f99
Initial version
| plugins/other/earthquakes-stronger-than-m4-and-m5-plus-solar-act | ||
|---|---|---|
| 1 |
#!/bin/sh |
|
| 2 |
# |
|
| 3 |
# Plugin for Munin 1.4.5 for counting and graph all the earthquakes above 4 and 5 magnitude. |
|
| 4 |
# Plus a Wolf Number ( index of the solar activity ) to see if any correlations. |
|
| 5 |
# Vik Banev, 2011 |
|
| 6 |
# http://www.ulitka.com |
|
| 7 |
# |
|
| 8 |
# |
|
| 9 |
# data channels provided by USGS abd NOAA |
|
| 10 |
M25EQ="http://earthquake.usgs.gov/earthquakes/catalogs/eqs7day-M2.5.txt" |
|
| 11 |
CWN="ftp://ftp.swpc.noaa.gov/pub/latest/SRS.txt" |
|
| 12 |
# |
|
| 13 |
# counting all the earthquakes with magnitude 4 and up |
|
| 14 |
M4PLUS=`curl -s $M25EQ | grep -v Datetime | awk -F"," {'print $9'} | awk '$1 > 3.9 { n++ }; END { print n+0 } '`
|
|
| 15 |
# |
|
| 16 |
# counting all the earthquakes with magnitude 5 and up |
|
| 17 |
M5PLUS=`curl -s $M25EQ | grep -v Datetime | awk -F"," {'print $9'} | awk '$1 > 4.9 { n++ }; END { print n+0 } '`
|
|
| 18 |
# |
|
| 19 |
# counting all the sun spots |
|
| 20 |
SSPOTS=`curl -s $CWN | sed -n '/Mag/,/IA/p' | grep "^[0-9].**" | awk '{sum += $7;} END {print sum;}'`
|
|
| 21 |
# |
|
| 22 |
# counting all the nonempty groups |
|
| 23 |
SSGROUPS=`curl -s $CWN | sed -n '/Mag/,/IA/p' | grep "^[0-9].**" | wc -l` |
|
| 24 |
# |
|
| 25 |
# the Wolf Number math |
|
| 26 |
WN=`echo "$SSPOTS+$SSGROUPS*10" | bc` |
|
| 27 |
# |
|
| 28 |
# tests and actual graphing |
|
| 29 |
# |
|
| 30 |
case $1 in |
|
| 31 |
config) |
|
| 32 |
cat <<'EOM' |
|
| 33 |
graph_title M4+, M5+ earthquakes and WN in past 7 days |
|
| 34 |
graph_vlabel M4+ / week, M5+ / week, WN |
|
| 35 |
eq5.label M5+ earthquakes |
|
| 36 |
eq5.warning 50 |
|
| 37 |
eq5.critical 70 |
|
| 38 |
eq4.label M4+ earthquakes |
|
| 39 |
eq4.warning 100 |
|
| 40 |
eq4.critical 120 |
|
| 41 |
wn.label Solar activity (Wolf Number) |
|
| 42 |
wn.warning 110 |
|
| 43 |
wn.critical 130 |
|
| 44 |
EOM |
|
| 45 |
exit 0;; |
|
| 46 |
esac |
|
| 47 |
# |
|
| 48 |
echo -n "eq5.value " |
|
| 49 |
echo $M5PLUS |
|
| 50 |
echo -n "eq4.value " |
|
| 51 |
echo $M4PLUS |
|
| 52 |
echo -n "wn.value " |
|
| 53 |
echo "$WN" |
|
Formats disponibles : Unified diff