diff --git a/scripts/cryptoReport.pl b/scripts/cryptoReport.pl index 8d827ef..71ecee6 100755 --- a/scripts/cryptoReport.pl +++ b/scripts/cryptoReport.pl @@ -35,7 +35,7 @@ $v->{GENERATED} = localtime; sub getCurrentPrice { my ($symbol) = @_; my ($start,$step,$name,$data) = RRDs::fetch("${rrdpath}/crypto-${symbol}.rrd","LAST","--start","-10m"); - return($data->[0]->[0]); + return($data->[0]->[0] || 0); } sub getLastWeekValue { diff --git a/scripts/getCryptocurrencies.sh b/scripts/getCryptocurrencies.sh index 4ae7939..427c64c 100755 --- a/scripts/getCryptocurrencies.sh +++ b/scripts/getCryptocurrencies.sh @@ -4,7 +4,7 @@ RRDDIR="/var/www/localhost/rrd" RRDPREFIX="crypto-" TMPLDIR="/var/www/localhost/tmpl" -for c in AAVE ALGO BTC CVC DOGE DNT EOS ETH LRC LTC RAD REN SNX XLM XTZ ZRX; +for c in AAVE ALGO BTC CVC DOGE DNT EOS ETH LRC LTC REN SNX XLM XTZ; do if [[ ! -f "${RRDDIR}/${RRDPREFIX}${c}.rrd" ]]; then diff --git a/scripts/getLXD.sh b/scripts/getLXD.sh new file mode 100755 index 0000000..1b5d493 --- /dev/null +++ b/scripts/getLXD.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +RRDDIR="/var/www/localhost/rrd" +RRDPREFIX="lxc-" +TMPLDIR="/var/www/localhost/tmpl" + +/bin/echo -n > /tmp/lxd.stats + +lxc list 10.5.0.1: -f json | jq -r '.[] | "\(.name) \(.state.cpu.usage) \(.state.memory.usage) \(.state.network.eth0.counters.bytes_received) \(.state.network.eth0.counters.bytes_sent)"' | while read i; +do + echo "$i" | sed 's/null/0/g' >> /tmp/lxd.stats +done + +/usr/bin/lxc_index.sh > /var/www/localhost/htdocs/lxc.html +/usr/bin/lxc_mrtg.sh > /var/www/localhost/config/lxc.cfg +/usr/bin/lxc_rrd-tmpl.sh diff --git a/scripts/lxc-stats.sh b/scripts/lxc-stats.sh deleted file mode 100755 index bcbda52..0000000 --- a/scripts/lxc-stats.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -DIR=/var/www/lxc-api/htdocs -lxc-ls -1 --running > "$DIR/index.html" - -lxc-ls -1 --running | while read c; -do - [ ! -d "$DIR/$c" ] && mkdir "$DIR/$c"; - t="$(lxc-info -H -S -n $c)" - - for i in CPU Memory RX TX - do - echo -e "$t" | grep "$i " | awk -F: '{print $2}' | sed 's/^[ ]*//g' > "$DIR/$c/$i" - done -done diff --git a/scripts/lxc_index.sh b/scripts/lxc_index.sh index 414c44c..b7fc535 100755 --- a/scripts/lxc_index.sh +++ b/scripts/lxc_index.sh @@ -16,7 +16,7 @@ echo 'home lxc crypto power LXC - Monitoring