Further work towards multi-platform graphing - Issue #293

pull/295/head
Romeo-Golf 2017-01-08 02:16:35 +00:00
rodzic 47d109a6b2
commit d3f61aedd6
1 zmienionych plików z 21 dodań i 6 usunięć

Wyświetl plik

@ -40,6 +40,17 @@ PORTALBUILDDIRECTORY="${BUILDDIRECTORY}/portal"
COLLECTD_CONFIG="/etc/collectd/collectd.conf"
COLLECTD_CRON_FILE="/etc/cron.d/adsb-feeder-performance-graphs"
## CONFIRM INSTALLED PACKAGES
if [[ $(dpkg-query -W -f='${STATUS}' dump1090-mutability 2>/dev/null | grep -c "ok installed") -eq 1 ]] ; then
DUMP1090_FORK="mutability"
DUMP1090_INSTALLED="true"
fi
if [[ $(dpkg-query -W -f='${STATUS}' dump1090-fa 2>/dev/null | grep -c "ok installed") -eq 1 ]] ; then
DUMP1090_FORK="fa"
DUMP1090_INSTALLED="true"
fi
## CHECK FOR PREREQUISITE PACKAGES
echo ""
@ -48,7 +59,7 @@ echo ""
## MODIFY THE DUMP1090-MUTABILITY INIT SCRIPT TO MEASURE AND RETAIN NOISE DATA
if [[ $(dpkg-query -W -f='${STATUS}' dump1090-mutability 2>/dev/null | grep -c "ok installed") -eq 1 ]] ; then
if [[ ${DUMP1090_INSTALLED} = "true" ]] && [[ ${DUMP1090_FORK} = "mutability" ]] ; then
echo -e "\e[94m Modifying the dump1090-mutability init script to add noise measurements...\e[97m"
sudo sed -i 's/ARGS=""/ARGS="--measure-noise "/g' /etc/init.d/dump1090-mutability
echo -e "\e[94m Reloading the systemd manager configuration...\e[97m"
@ -69,7 +80,6 @@ fi
# Generate new collectd config.
echo -e "\e[94m Replacing the current collectd.conf file...\e[97m"
sudo tee ${COLLECTD_CONFIG} > /dev/null <<EOF
# Config file for collectd(1).
@ -93,6 +103,7 @@ WriteThreads 1
EOF
# Dump1090 specific values.
if [[ ${DUMP1090_INSTALLED} = "true" ]] ; then
sudo tee -a ${COLLECTD_CONFIG} > /dev/null <<EOF
#----------------------------------------------------------------------------#
# Added types for dump1090. #
@ -101,7 +112,9 @@ EOF
TypesDB "${PORTALBUILDDIRECTORY}/graphs/dump1090.db" "/usr/share/collectd/types.db"
EOF
fi
# Config for all installations.
sudo tee -a ${COLLECTD_CONFIG} > /dev/null <<EOF
##############################################################################
# Logging #
@ -163,6 +176,7 @@ LoadPlugin disk
EOF
# Dump1090 specific values.
if [[ ${DUMP1090_INSTALLED} = "true" ]] ; then
sudo tee -a ${COLLECTD_CONFIG} > /dev/null <<EOF
#----------------------------------------------------------------------------#
# Configure the dump1090 python module. #
@ -183,6 +197,7 @@ EOF
</Plugin>
EOF
fi
# Raspberry Pi specific values.
sudo tee -a ${COLLECTD_CONFIG} > /dev/null <<EOF
@ -205,6 +220,7 @@ EOF
EOF
# Remaining config for all installations.
sudo tee -a ${COLLECTD_CONFIG} > /dev/null <<EOF
<Chain "PostCache">
<Rule>
@ -231,22 +247,21 @@ echo ""
## EDIT CRONTAB
echo -e "\e[94m Making the make-collectd-graphs.sh script executable...\e[97m"
chmod +x ${PORTALBUILDDIRECTORY}/graphs/make-collectd-graphs.sh
chmod +x ${PORTALBUILDDIRECTORY}/graphs/make-collectd-graphs.sh 2>&1
# The next block is temporary in order to insure this file is
# deleted on older installation before the project renaming.
if [ -f /etc/cron.d/adsb-feeder-performance-graphs ]; then
echo -e "\e[94m Removing outdated performance graphs cron file...\e[97m"
sudo rm -f /etc/cron.d/adsb-feeder-performance-graphs
sudo rm -f /etc/cron.d/adsb-feeder-performance-graphs 2>&1
fi
if [ -f ${COLLECTD_CRON_FILE} ]; then
echo -e "\e[94m Removing previously installed performance graphs cron file...\e[97m"
sudo rm -f ${COLLECTD_CRON_FILE}
sudo rm -f ${COLLECTD_CRON_FILE} 2>&1
fi
echo -e "\e[94m Adding performance graphs cron file...\e[97m"
sudo tee ${COLLECTD_CRON_FILE} > /dev/null <<EOF
# Updates the portal's performance graphs.
#