From 6908abed8a5519bb245c0e343040031584b8f2c6 Mon Sep 17 00:00:00 2001 From: deniszh Date: Mon, 17 Feb 2020 18:15:18 +0100 Subject: [PATCH 1/7] Python 3 / Ubuntu 18.04 support --- .gitignore | 2 + README.md | 6 +- Vagrantfile | 4 +- app.yml | 2 +- install | 125 ++++++++++++------------ templates/apache/graphite.conf | 6 +- templates/graphite/conf/carbon.conf | 2 + templates/init.d/carbon-cache | 81 --------------- templates/init/statsite.conf | 17 ---- templates/systemd/carbon-cache@.service | 16 +++ templates/systemd/statsite.service | 13 +++ uninstall | 20 ++-- upgrade | 25 ++--- 13 files changed, 133 insertions(+), 186 deletions(-) delete mode 100644 templates/init.d/carbon-cache delete mode 100644 templates/init/statsite.conf create mode 100644 templates/systemd/carbon-cache@.service create mode 100644 templates/systemd/statsite.service diff --git a/.gitignore b/.gitignore index 8000dd9..a4e5abb 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ .vagrant +.idea +*.log \ No newline at end of file diff --git a/README.md b/README.md index aae7395..ec7aa98 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Synthesize Installing Graphite doesn't have to be difficult. The `install` script in synthesize is designed to make it brain-dead easy to install Graphite and related services onto a modern Linux distribution. -Synthesize is built to run on Ubuntu 14.04 LTS. It will __not__ run on other Ubuntu releases or Linux distributions. The goal of this project is not to become an automation alternative to modern configuration management utilities (e.g. Chef or Puppet), but rather, to make it as easy as possible for the beginner Graphite user to get started and familiar with the project without having to learn a suite of other automation and/or infrastructure-related projects. +Synthesize is built to run on Ubuntu 18.04 LTS. It will __not__ run on other Ubuntu releases or Linux distributions. The goal of this project is not to become an automation alternative to modern configuration management utilities (e.g. Chef or Puppet), but rather, to make it as easy as possible for the beginner Graphite user to get started and familiar with the project without having to learn a suite of other automation and/or infrastructure-related projects. The resulting Graphite web interface __listens only on https port 443__ and has been configured to collect metrics specifically for helping profile the performance of your Graphite and Carbon services. It uses memcached for improved query performance, and Statsite for a fast, C-based implementation of the StatsD collector/aggregator. @@ -15,14 +15,14 @@ Beginning with version 3.0.0 we've also incorporated the Grafana dashboard proje ## Provides -* Graphite 1.0.0 ([graphite-web](https://github.com/graphite-project/graphite-web), [carbon](https://github.com/graphite-project/carbon), [whisper](https://github.com/graphite-project/whisper)) +* Graphite 1.1.x ([graphite-web](https://github.com/graphite-project/graphite-web), [carbon](https://github.com/graphite-project/carbon), [whisper](https://github.com/graphite-project/whisper)) * StatsD ([statsite](https://github.com/armon/statsite)) * [Collectd](http://collectd.org/) * [Grafana](https://grafana.org/) ## Dependencies -* Vagrant, an Ubuntu 14.04 VM or a non-production server +* Vagrant, an Ubuntu 18.04 VM or a non-production server * Some mechanism for downloading Synthesize ## Installation diff --git a/Vagrantfile b/Vagrantfile index 9e23964..b86ed82 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -5,13 +5,13 @@ VAGRANTFILE_API_VERSION = "2" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| - config.vm.box = "mayflower/trusty64-puppet3" + config.vm.box = "ubuntu/bionic64" config.vm.network :forwarded_port, guest: 443, host: 8443 config.vm.network :forwarded_port, guest: 8125, host: 8125, protocol: 'tcp' config.vm.network :forwarded_port, guest: 8125, host: 8125, protocol: 'udp' config.vm.network :forwarded_port, guest: 2003, host: 22003 config.vm.network :forwarded_port, guest: 2004, host: 22004 config.vm.network :forwarded_port, guest: 3000, host: 3030 - graphite_version = ENV['GRAPHITE_RELEASE'].nil? ? '1.0.2' : ENV['GRAPHITE_RELEASE'] + graphite_version = ENV['GRAPHITE_RELEASE'].nil? ? '1.1.6' : ENV['GRAPHITE_RELEASE'] config.vm.provision "shell", inline: "cd /vagrant; GRAPHITE_RELEASE=#{graphite_version} ./install" end diff --git a/app.yml b/app.yml index c7a2ba0..74942ef 100644 --- a/app.yml +++ b/app.yml @@ -1,5 +1,5 @@ name: synthesize -image: ubuntu-14-04-x64 +image: ubuntu-18-04-x64 min_size: 512mb config: #cloud-config diff --git a/install b/install index 6c49316..fc1ff93 100755 --- a/install +++ b/install @@ -1,5 +1,5 @@ #!/bin/bash -ex -# Graphite installation script for Ubuntu 14.04 +# Graphite installation script for Ubuntu 18.04 # Jason Dixon SYNTHESIZE_HOME=$( cd "$( dirname "$0" )" && pwd ) @@ -9,45 +9,16 @@ GRAPHITE_HOME='/opt/graphite' GRAPHITE_CONF="${GRAPHITE_HOME}/conf" GRAPHITE_STORAGE="${GRAPHITE_HOME}/storage" -# Check to see if python-openssl is installed first -set +e -PYTHON_OPENSSL_INSTALLED=`dpkg -s python-openssl 2>/dev/null | grep '^Status'` -set -e - -# This can break Carbon's python-twisted, exit with explanation -if [[ ! $PYTHON_OPENSSL_INSTALLED == '' ]]; then - set +x - clear - echo - echo - echo - echo "##########################################################" - echo - echo "It appears that you have python-openssl installed." - echo "There are known issues with this package that can cause" - echo "the Carbon service to fail to start. If you don't need" - echo "the python-openssl library, it's recommended that you" - echo "uninstall this package before continuing." - echo - echo " $ sudo apt-get remove python-openssl" - echo - echo "More information is provided at the link below." - echo - echo "https://github.com/graphite-project/graphite-web/issues/1721#issuecomment-253279181" - echo - echo "##########################################################" - echo - echo - echo - exit 1 +if [ -z $GRAPHITE_RELEASE ]; then + GRAPHITE_RELEASE='master' fi -if [ -z $GRAPHITE_RELEASE ]; then - GRAPHITE_RELEASE='1.0.2' +if [ -z $STATSITE_RELEASE ]; then + STATSITE_RELEASE='master' fi -if [[ ! $UBUNTU_RELEASE =~ 'Ubuntu 14.04' ]]; then - echo "Sorry, this is only supported for Ubuntu Linux 14.04." +if [[ ! $UBUNTU_RELEASE =~ 'Ubuntu 18.04' ]]; then + echo "Sorry, this is only supported for Ubuntu Linux 18.04." exit 1 fi if [[ -d $GRAPHITE_HOME ]]; then @@ -59,7 +30,9 @@ fi apt-get update -y # Install package dependencies from apt -RUNLEVEL=1 apt-get install -y libcairo2-dev libffi-dev pkg-config python-dev python-pip fontconfig apache2 libapache2-mod-wsgi git-core collectd memcached gcc g++ make libtool automake +RUNLEVEL=1 apt-get install -y git wget curl netbase collectd memcached \ + build-essential automake libtool libffi-dev libcairo2-dev libcairo2 libffi6 \ + python3-dev python3-pip fontconfig apache2 libapache2-mod-wsgi-py3 # Download source repositories for Graphite/Carbon/Whisper and Statsite cd /usr/local/src @@ -69,23 +42,45 @@ git clone https://github.com/graphite-project/whisper.git git clone https://github.com/armon/statsite.git # Build and install Graphite/Carbon/Whisper and Statsite -cd whisper; git checkout ${GRAPHITE_RELEASE}; python setup.py install -cd ../carbon; git checkout ${GRAPHITE_RELEASE}; pip install -r requirements.txt; python setup.py install -cd ../graphite-web; git checkout ${GRAPHITE_RELEASE}; pip install -r requirements.txt; python check-dependencies.py; python setup.py install -cd ../statsite; ./autogen.sh; ./configure; make; cp statsite /usr/local/sbin/; cp sinks/graphite.py /usr/local/sbin/statsite-sink-graphite.py +mkdir -p /opt/graphite + +cd whisper; \ + git checkout ${GRAPHITE_RELEASE}; \ + python3 setup.py install + +cd ../carbon; \ + git checkout ${GRAPHITE_RELEASE}; \ + pip3 install -r requirements.txt; \ + python3 setup.py install + +cd ../graphite-web; \ + pip3 install django==2.2.9; \ + git checkout ${GRAPHITE_RELEASE}; \ + pip3 install -r requirements.txt; \ + python3 check-dependencies.py; \ + python3 setup.py install + +cd ../statsite; \ + git checkout ${STATSITE_RELEASE}; \ + ./autogen.sh; \ + ./configure; make; \ + cp statsite /usr/local/sbin/; \ + cp sinks/graphite.py /usr/local/sbin/statsite-sink-graphite.py # Update txamqp to support RabbitMQ 2.4+ -pip install txamqp==0.6.2 --upgrade +# also install service_identity to remove TLS error +pip3 install txamqp service_identity --upgrade # Install configuration files for Graphite/Carbon and Apache cp ${SYNTHESIZE_HOME}/templates/statsite/statsite.conf /etc/statsite.conf mkdir ${GRAPHITE_CONF}/examples mv ${GRAPHITE_CONF}/*.example ${GRAPHITE_CONF}/examples/ cp ${SYNTHESIZE_HOME}/templates/graphite/conf/* ${GRAPHITE_CONF}/ +mkdir -p /etc/collectd cp ${SYNTHESIZE_HOME}/templates/collectd/collectd.conf /etc/collectd/ cp ${SYNTHESIZE_HOME}/templates/apache/graphite.conf /etc/apache2/sites-available/ -cp ${SYNTHESIZE_HOME}/templates/init/* /etc/init/ -cp ${SYNTHESIZE_HOME}/templates/init.d/* /etc/init.d/ +# using systemd unins instead of init and upstart files +cp ${SYNTHESIZE_HOME}/templates/systemd/* /etc/systemd/system/ # Setup the correct Apache site and modules a2dissite 000-default @@ -101,7 +96,7 @@ sed -i -e "s/UNSAFE_DEFAULT/`date | md5sum | cut -d ' ' -f 1`/" local_settings.p # Setup the Django database PYTHONPATH=${GRAPHITE_HOME}/webapp django-admin.py migrate --noinput --settings=graphite.settings --run-syncdb -PYTHONPATH=${GRAPHITE_HOME}/webapp django-admin.py loaddata --settings=graphite.settings initial_data.json +PYTHONPATH=${GRAPHITE_HOME}/webapp django-admin.py collectstatic --noinput --settings=graphite.settings # Add carbon system user and set permissions groupadd -g 998 carbon @@ -110,9 +105,10 @@ chmod 775 ${GRAPHITE_STORAGE} chown www-data:carbon ${GRAPHITE_STORAGE} chown www-data:www-data ${GRAPHITE_STORAGE}/graphite.db chown -R carbon ${GRAPHITE_STORAGE}/whisper +mkdir -p ${GRAPHITE_STORAGE}/log/carbon-cache/ +chown -R carbon ${GRAPHITE_STORAGE}/log mkdir ${GRAPHITE_STORAGE}/log/apache2 chown -R www-data ${GRAPHITE_STORAGE}/log/webapp -chmod +x /etc/init.d/carbon-cache # Setup hourly cron to rebuild Graphite index cp ${SYNTHESIZE_HOME}/templates/graphite/cron/build-index /etc/cron.hourly/graphite-build-index @@ -120,12 +116,30 @@ chmod 755 /etc/cron.hourly/graphite-build-index sudo -u www-data /opt/graphite/bin/build-index.sh # Install Grafana -echo 'deb https://packagecloud.io/grafana/stable/debian/ wheezy main' > /etc/apt/sources.list.d/grafana.list -curl https://packagecloud.io/gpg.key | apt-key add - -apt-get update -y -DEBIAN_FRONTEND=noninteractive apt-get install -y grafana +apt-get install -y apt-transport-https +apt-get install -y software-properties-common wget +wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add - +add-apt-repository "deb https://packages.grafana.com/oss/deb stable main" +apt-get update +apt-get install grafana + +# Enabling processes start +systemctl daemon-reload +systemctl enable 'carbon-cache@1' # TODO: INSTANCES loop needs to be implemented +systemctl enable statsite +systemctl enable grafana-server + +# Start our processes +systemctl start 'carbon-cache@1' # TODO: INSTANCES loop needs to be implemented +service memcached start +service collectd start +service apache2 start +service statsite start service grafana-server start -sleep 5 + +# Bootstrap Grafana datasources and dashboards +# TODO: Not resilient, should be migrated to provisioning api +sleep 15 curl -X POST -H 'Content-Type: application/json' -u 'admin:admin' \ -d '{ "name": "graphite", "type": "graphite", "url": "https://127.0.0.1:443", "access": "proxy", "basicAuth": false }' \ "http://127.0.0.1:3000/api/datasources" @@ -133,12 +147,3 @@ curl -X POST -H 'Content-Type: application/json' -u 'admin:admin' \ -d '{ "inputs": [{"name": "*", "pluginId": "graphite", "type": "datasource", "value": "graphite"}], "overwrite": true, "path": "dashboards/carbon_metrics.json", "pluginId": "graphite" }' \ "http://127.0.0.1:3000/api/dashboards/import" -# Start our processes -update-rc.d carbon-cache defaults -service carbon-cache start -service memcached start -service collectd start -service apache2 start -service statsite start -service apache2 restart - diff --git a/templates/apache/graphite.conf b/templates/apache/graphite.conf index b053d42..3ea7481 100644 --- a/templates/apache/graphite.conf +++ b/templates/apache/graphite.conf @@ -6,20 +6,20 @@ CustomLog /opt/graphite/storage/log/apache2/access.log combined ErrorLog /opt/graphite/storage/log/apache2/error.log - WSGIDaemonProcess graphiteweb python-path=/opt/graphite:/opt/graphite/lib/python2.7/site-packages processes=5 threads=5 display-name='%{GROUP}' inactivity-timeout=120 + WSGIDaemonProcess graphiteweb python-path=/opt/graphite:/usr/local/lib/python3.6/dist-packages processes=5 threads=5 display-name='%{GROUP}' inactivity-timeout=120 WSGIProcessGroup graphiteweb WSGIApplicationGroup %{GLOBAL} WSGIImportScript /opt/graphite/conf/graphite.wsgi process-group=graphiteweb application-group=%{GLOBAL} WSGIScriptAlias / /opt/graphite/conf/graphite.wsgi RedirectMatch ^/admin(.*)admin/([^/]+)/([^/]+)$ /media/$2/$3 - Alias /media/ "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/static/admin/" + Alias /media/ "/opt/graphite/static/admin/" Require all granted - + Require all granted diff --git a/templates/graphite/conf/carbon.conf b/templates/graphite/conf/carbon.conf index 9713c7c..649b143 100644 --- a/templates/graphite/conf/carbon.conf +++ b/templates/graphite/conf/carbon.conf @@ -16,6 +16,8 @@ LOG_LISTENER_CONNECTIONS = True LOG_UPDATES = False ENABLE_LOGROTATION = True WHISPER_AUTOFLUSH = False +# disabling Tags (it's not working will snakeoil SSL) +ENABLE_TAGS = False [cache:1] LINE_RECEIVER_PORT = 2003 diff --git a/templates/init.d/carbon-cache b/templates/init.d/carbon-cache deleted file mode 100644 index 9d3c2d9..0000000 --- a/templates/init.d/carbon-cache +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/sh - -# Initscript for carbon-cache processes -# Jason Dixon -# -# You must set the variables below. The -# INSTANCES variable should be set to the -# number of carbon-cache instances you have -# configured in your carbon.conf. Note that -# they must be numerically indexed from 1. -# (e.g. [cache:1], [cache:2], [cache:3] - -PID_DIR=/opt/graphite/storage -DAEMON=/opt/graphite/bin/carbon-cache.py -NAME=carbon-cache -INSTANCES=1 - -set -e - -test -x $DAEMON || exit 0 - -case "$1" in - - start) - for INSTANCE in $(seq 1 $INSTANCES); do - echo -n "Starting ${NAME}-${INSTANCE}: " - if start-stop-daemon --start --quiet --pidfile "${NAME}-${INSTANCE}.pid" --exec $DAEMON start 1>/dev/null -- --instance=${INSTANCE} - then - echo "succeeded" - else - echo "failed" - fi - done - ${0} status - ;; - - stop) - for INSTANCE in $(seq 1 $INSTANCES); do - echo -n "Stopping ${NAME}-${INSTANCE}: " - $DAEMON stop --instance=${INSTANCE} 1>/dev/null - echo "stopped" - done - exit 0 - ;; - - restart) - ${0} stop - ${0} start - ;; - - status) - for INSTANCE in $(seq 1 $INSTANCES); do - if [ -f "${PID_DIR}/${NAME}-${INSTANCE}.pid" ]; then - PID=`cat "${PID_DIR}/${NAME}-${INSTANCE}.pid"` - - echo -n "${NAME}-${INSTANCE} (pid: $PID): " - if ps -p $PID >/dev/null; then - echo "running" - else - echo "failed" - fi - else - echo "${NAME}-${INSTANCE} not running" - fi - done - for INSTANCE in $(seq 1 $INSTANCES); do - if [ ! -f "${PID_DIR}/${NAME}-${INSTANCE}.pid" ]; then - exit 1 - fi - done - exit 0 - ;; - - *) - echo "Usage: /etc/init.d/${NAME} {start|stop|restart|status}" >%2 - exit 1 - ;; - -esac - -exit 0 diff --git a/templates/init/statsite.conf b/templates/init/statsite.conf deleted file mode 100644 index 3fa3642..0000000 --- a/templates/init/statsite.conf +++ /dev/null @@ -1,17 +0,0 @@ -# statsite -# - -description "statsite StatsD service" - -start on virtual-filesystems -stop on runlevel [06] - -respawn -respawn limit 5 30 -limit nofile 65550 65550 - -console log - -script - exec /usr/local/sbin/statsite -f /etc/statsite.conf -end script diff --git a/templates/systemd/carbon-cache@.service b/templates/systemd/carbon-cache@.service new file mode 100644 index 0000000..989cd3c --- /dev/null +++ b/templates/systemd/carbon-cache@.service @@ -0,0 +1,16 @@ +[Unit] +Description=Graphite Carbon Cache Instance %I +After=network.target + +[Service] +User=carbon +Group=carbon +ExecStartPre=/bin/rm -f /opt/graphite/storage/carbon-cache-%i.pid +ExecStart=/usr/bin/python3 /opt/graphite/bin/carbon-cache.py --instance=%i start +Type=forking +PIDFile=/opt/graphite/storage/carbon-cache-%i.pid +LimitNOFILE=128000 + +[Install] +WantedBy=multi-user.target +DefaultInstance=1 \ No newline at end of file diff --git a/templates/systemd/statsite.service b/templates/systemd/statsite.service new file mode 100644 index 0000000..589c091 --- /dev/null +++ b/templates/systemd/statsite.service @@ -0,0 +1,13 @@ +[Unit] +Description=statsite StatsD service +Wants=carbon-cache.service +After=carbon-cache.service + +[Service] +#User=statsd +Type=simple +ExecStart=/usr/local/sbin/statsite -f /etc/statsite.conf +Restart=on-failure + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/uninstall b/uninstall index 36d4573..eb22f9a 100755 --- a/uninstall +++ b/uninstall @@ -2,7 +2,7 @@ # Graphite uninstall script for Ubuntu 14.04 x64 # Jason Dixon -service carbon-cache stop +systemctl stop 'carbon-cache@1' # TODO: more instances need to be stopped service memcached stop service collectd stop service apache2 stop @@ -11,9 +11,8 @@ service statsite stop # Remove various binaries, configuration files, and source directories rm /usr/local/sbin/statsite* rm /etc/statsite.conf -pip uninstall -y -r /usr/local/src/graphite-web/requirements.txt -pip uninstall -y -r /usr/local/src/carbon/requirements.txt -pip uninstall --egg SCons +pip3 uninstall -y -r /usr/local/src/graphite-web/requirements.txt +pip3 uninstall -y -r /usr/local/src/carbon/requirements.txt rm -r /opt/graphite rm -r /usr/local/src/graphite-web rm -r /usr/local/src/carbon @@ -22,12 +21,19 @@ rm -r /usr/local/src/statsite rm /usr/local/bin/*whisper*.py rm /usr/local/lib/python2.7/dist-packages/whisper* rm /etc/apache2/sites-*/graphite.conf -rm /etc/init/graphite.conf -rm /etc/init/statsite.conf +rm /etc/apache2/vhosts.d/graphite.conf +systemctl disable 'carbon-cache@1' # TODO: INSTANCES loop needs to be implemented +systemctl disable statsite +systemctl disable grafana-server +rm -rf /etc/systemd/system/carbon* +rm -rf /etc/systemd/system/statsite* +systemctl daemon-reload rm /etc/cron.hourly/graphite-build-index # Uninstall our package dependencies and purge configurations -apt-get purge -y python-cairo python-django python-django-tagging python-twisted python-zope.interface fontconfig apache2 libapache2-mod-wsgi python-pysqlite2 python-simplejson python-memcache git-core collectd memcached gcc g++ make libtool automake +apt-get purge -y git wget curl netbase collectd memcached \ + build-essential automake libtool libffi-dev libcairo2-dev libcairo2 libffi6 \ + python3-dev python3-pip fontconfig apache2 libapache2-mod-wsgi-py3 apt-get autoremove -y # Brute force cleanup on the collectd configuration directory diff --git a/upgrade b/upgrade index e173abf..ecc6087 100755 --- a/upgrade +++ b/upgrade @@ -1,5 +1,5 @@ #!/bin/bash -# Synthesize upgrade script for Graphite 1.0.0 +# Synthesize upgrade script for Graphite 1.1.0 # Jason Dixon SYNTHESIZE_HOME=$( cd "$( dirname "$0" )" && pwd ) @@ -19,11 +19,11 @@ if [[ ! $DANGER_ZONE =~ 'TRUE' ]]; then fi if [ -z $GRAPHITE_RELEASE ]; then - GRAPHITE_RELEASE='1.0.0' + GRAPHITE_RELEASE='1.1.6' fi -if [[ ! $UBUNTU_RELEASE =~ 'Ubuntu 14.04' ]]; then - echo "Sorry, this is only supported for Ubuntu Linux 14.04." +if [[ ! $UBUNTU_RELEASE =~ 'Ubuntu 18.04' ]]; then + echo "Sorry, this is only supported for Ubuntu Linux 18.04." exit 1 fi if [[ ! -d $GRAPHITE_HOME ]]; then @@ -35,16 +35,16 @@ fi cd /usr/local/src cd whisper; git fetch origin; \ git checkout ${GRAPHITE_RELEASE}; \ - python setup.py install + python3 setup.py install cd ../carbon; git fetch origin; \ git checkout ${GRAPHITE_RELEASE}; \ - pip install -r requirements.txt; \ - python setup.py install + pip3 install -r requirements.txt; \ + python3 setup.py install cd ../graphite-web; git fetch origin; \ git checkout ${GRAPHITE_RELEASE}; \ - pip install -r requirements.txt; \ - python check-dependencies.py; \ - python setup.py install + pip3 install -r requirements.txt; \ + python3 check-dependencies.py; \ + python3 setup.py install # Install configuration files for Graphite/Carbon and Apache cp -b ${GRAPHITE_CONF}/*.example ${GRAPHITE_CONF}/examples/ @@ -60,12 +60,13 @@ sed -i -e "s/UNSAFE_DEFAULT/`date | md5sum | cut -d ' ' -f 1`/" local_settings.p # Upgrade Django and migrate the webapp database service apache2 stop BACKUP=`date +%Y%m%d_%H%M%S` -mv ${GRAPHITE_STORAGE}/graphite.db ${GRAPHITE_STORAGE}/graphite.db.backup-${BACKUP} +cp -fv ${GRAPHITE_STORAGE}/graphite.db ${GRAPHITE_STORAGE}/graphite.db.backup-${BACKUP} PYTHONPATH=${GRAPHITE_HOME}/webapp django-admin.py dumpdata --indent 4 --settings=graphite.settings > dump_${BACKUP}_data.json +PYTHONPATH=${GRAPHITE_HOME}/webapp django-admin.py makemigrations --noinput --settings=graphite.settings PYTHONPATH=${GRAPHITE_HOME}/webapp django-admin.py migrate --noinput --settings=graphite.settings --run-syncdb PYTHONPATH=${GRAPHITE_HOME}/webapp django-admin.py loaddata --settings=graphite.settings dump_${BACKUP}_data.json # Restart our processes -service carbon-cache restart +systemctl restart 'carbon-cache@1' # TODO: INSTANCES loop needs to be implemented service memcached restart service apache2 start From 60c646ec6fdf859a56d359749d98ecff012caa5d Mon Sep 17 00:00:00 2001 From: deniszh Date: Mon, 17 Feb 2020 18:31:25 +0100 Subject: [PATCH 2/7] oops, leftovers --- uninstall | 1 - 1 file changed, 1 deletion(-) diff --git a/uninstall b/uninstall index eb22f9a..31b2c88 100755 --- a/uninstall +++ b/uninstall @@ -21,7 +21,6 @@ rm -r /usr/local/src/statsite rm /usr/local/bin/*whisper*.py rm /usr/local/lib/python2.7/dist-packages/whisper* rm /etc/apache2/sites-*/graphite.conf -rm /etc/apache2/vhosts.d/graphite.conf systemctl disable 'carbon-cache@1' # TODO: INSTANCES loop needs to be implemented systemctl disable statsite systemctl disable grafana-server From 9f84a51aaf74e75cd333cd272f5c335c68b5d850 Mon Sep 17 00:00:00 2001 From: deniszh Date: Sat, 22 Feb 2020 23:21:10 +0100 Subject: [PATCH 3/7] Fixing todos --- app.yml | 2 +- install | 34 +- templates/collectd/collectd.conf | 4 +- .../GraphiteCarbonMetrics_obfuscurity.json | 1482 +++++++++++++++++ .../provisioning/dashboards/local.yaml | 24 + .../provisioning/datasources/datasources.yaml | 26 + templates/scripts/carbon-cache | 77 + uninstall | 3 +- upgrade | 4 +- 9 files changed, 1632 insertions(+), 24 deletions(-) create mode 100644 templates/grafana/provisioning/dashboards/GraphiteCarbonMetrics_obfuscurity.json create mode 100644 templates/grafana/provisioning/dashboards/local.yaml create mode 100644 templates/grafana/provisioning/datasources/datasources.yaml create mode 100755 templates/scripts/carbon-cache diff --git a/app.yml b/app.yml index 74942ef..a4eba21 100644 --- a/app.yml +++ b/app.yml @@ -11,4 +11,4 @@ config: packages: - git runcmd: - - cd /home/install && apt-get -y remove python-openssl && git clone https://github.com/obfuscurity/synthesize.git && cd synthesize && bash install + - cd /home/install && git clone https://github.com/obfuscurity/synthesize.git && cd synthesize && bash install diff --git a/install b/install index fc1ff93..3fa3aaf 100755 --- a/install +++ b/install @@ -79,8 +79,11 @@ cp ${SYNTHESIZE_HOME}/templates/graphite/conf/* ${GRAPHITE_CONF}/ mkdir -p /etc/collectd cp ${SYNTHESIZE_HOME}/templates/collectd/collectd.conf /etc/collectd/ cp ${SYNTHESIZE_HOME}/templates/apache/graphite.conf /etc/apache2/sites-available/ -# using systemd unins instead of init and upstart files + +# using systemd units instead of init and upstart files cp ${SYNTHESIZE_HOME}/templates/systemd/* /etc/systemd/system/ +# installing scripts for cacron-cache instances control +cp ${SYNTHESIZE_HOME}/templates/scripts/* /usr/local/bin/ # Setup the correct Apache site and modules a2dissite 000-default @@ -120,30 +123,25 @@ apt-get install -y apt-transport-https apt-get install -y software-properties-common wget wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add - add-apt-repository "deb https://packages.grafana.com/oss/deb stable main" -apt-get update apt-get install grafana +# Bootstrap Grafana datasources and dashboards +mkdir -p /etc/grafana/provisioning/datasources/ +mkdir -p /etc/grafana/provisioning/dashboards/ +cp ${SYNTHESIZE_HOME}/templates/grafana/provisioning/datasources/* /etc/grafana/provisioning/datasources/ +cp ${SYNTHESIZE_HOME}/templates/grafana/provisioning/dashboards/* /etc/grafana/provisioning/dashboards/ +systemctl restart grafana-server # Enabling processes start systemctl daemon-reload -systemctl enable 'carbon-cache@1' # TODO: INSTANCES loop needs to be implemented +/usr/local/bin/carbon-cache enable systemctl enable statsite systemctl enable grafana-server # Start our processes -systemctl start 'carbon-cache@1' # TODO: INSTANCES loop needs to be implemented -service memcached start -service collectd start -service apache2 start -service statsite start -service grafana-server start +/usr/local/bin/carbon-cache start +service memcached restart +service collectd restart +service apache2 restart +service statsite restart -# Bootstrap Grafana datasources and dashboards -# TODO: Not resilient, should be migrated to provisioning api -sleep 15 -curl -X POST -H 'Content-Type: application/json' -u 'admin:admin' \ - -d '{ "name": "graphite", "type": "graphite", "url": "https://127.0.0.1:443", "access": "proxy", "basicAuth": false }' \ - "http://127.0.0.1:3000/api/datasources" -curl -X POST -H 'Content-Type: application/json' -u 'admin:admin' \ - -d '{ "inputs": [{"name": "*", "pluginId": "graphite", "type": "datasource", "value": "graphite"}], "overwrite": true, "path": "dashboards/carbon_metrics.json", "pluginId": "graphite" }' \ - "http://127.0.0.1:3000/api/dashboards/import" diff --git a/templates/collectd/collectd.conf b/templates/collectd/collectd.conf index c41c736..8225d20 100644 --- a/templates/collectd/collectd.conf +++ b/templates/collectd/collectd.conf @@ -976,13 +976,13 @@ LoadPlugin write_graphite # data retrieval time - Regex "Retrieval of [^ ]+ took ([0-9\.]+)" + Regex "Total request processing time ([0-9\.]+)" DSType "CounterInc" Type "counter" Instance "retrieval_count" - Regex "Retrieval of [^ ]+ took ([0-9\.]+)" + Regex "Total request processing time ([0-9\.]+)" DSType "GaugeMin" Type "response_time" Instance "retrieval_time_min" diff --git a/templates/grafana/provisioning/dashboards/GraphiteCarbonMetrics_obfuscurity.json b/templates/grafana/provisioning/dashboards/GraphiteCarbonMetrics_obfuscurity.json new file mode 100644 index 0000000..a4c67ff --- /dev/null +++ b/templates/grafana/provisioning/dashboards/GraphiteCarbonMetrics_obfuscurity.json @@ -0,0 +1,1482 @@ +{ + "annotations": { + "enable": false, + "list": [ + { + "builtIn": 1, + "datasource": "-- Grafana --", + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + }, + { + "datasource": "Graphite", + "enable": true, + "iconColor": "rgba(255, 96, 96, 1)", + "name": "events" + } + ] + }, + "description": "Obfuscurity's \"extended remix\" of the Graphite Carbon Metrics dashboard", + "editable": true, + "gnetId": 311, + "graphTooltip": 1, + "id": 2, + "links": [], + "panels": [ + { + "aliasColors": {}, + "annotate": { + "enable": false + }, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Graphite", + "editable": true, + "fill": 0, + "fillGradient": 0, + "grid": { + "max": null, + "min": 0 + }, + "gridPos": { + "h": 7, + "w": 12, + "x": 0, + "y": 0 + }, + "hiddenSeries": false, + "id": 1, + "legend": { + "avg": false, + "current": false, + "max": true, + "min": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "loadingEditor": false, + "nullPointMode": "null as zero", + "options": { + "dataLinks": [] + }, + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "resolution": 100, + "scale": 1, + "seriesOverrides": [ + { + "alias": "Points Per Update", + "yaxis": 2 + }, + { + "alias": "CPU", + "yaxis": 2 + } + ], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "hide": false, + "refId": "A", + "target": "alias(scaleToSeconds(sumSeries(carbon.agents.*.updateOperations), 1), 'Updates')" + }, + { + "hide": false, + "refId": "B", + "target": "alias(scaleToSeconds(sumSeries(carbon.agents.*.metricsReceived), 1), 'Metrics Received')" + }, + { + "hide": false, + "refId": "C", + "target": "alias(scaleToSeconds(sumSeries(carbon.agents.*.committedPoints), 1), 'Committed Points')" + }, + { + "hide": false, + "refId": "D", + "target": "alias(averageSeries(carbon.agents.*.pointsPerUpdate), 'Points Per Update')" + }, + { + "hide": false, + "refId": "E", + "target": "alias(averageSeries(carbon.agents.*.cpuUsage),'CPU')" + }, + { + "hide": false, + "refId": "F", + "target": "alias(scaleToSeconds(sumSeries(carbon.agents.*.creates), 1), 'Creates')" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Carbon Cache Metrics", + "tooltip": { + "msResolution": false, + "query_as_alias": true, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + }, + "zerofill": true + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Graphite", + "editable": true, + "error": false, + "fill": 1, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 7, + "w": 12, + "x": 12, + "y": 0 + }, + "hiddenSeries": false, + "id": 2, + "isNew": true, + "legend": { + "alignAsTable": false, + "avg": false, + "current": false, + "max": false, + "min": false, + "rightSide": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "options": { + "dataLinks": [] + }, + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "alias": "averageSeries(carbon.agents.*.cpuUsage)", + "yaxis": 2 + }, + { + "alias": "CPU", + "yaxis": 2 + }, + { + "alias": "relay cpu", + "yaxis": 2 + }, + { + "alias": "cache cpu", + "yaxis": 2 + } + ], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "refId": "A", + "target": "alias(sumSeries(carbon.agents.*.memUsage), 'cache memory')" + }, + { + "refId": "C", + "target": "alias(sumSeries(carbon.relays.*.memUsage), 'relay memory')" + }, + { + "hide": false, + "refId": "B", + "target": "alias(averageSeries(carbon.agents.*.cpuUsage), 'cache cpu')" + }, + { + "hide": false, + "refId": "D", + "target": "alias(averageSeries(carbon.relays.*.cpuUsage), 'relay cpu')" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Carbon Memory & CPU", + "tooltip": { + "msResolution": true, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "bytes", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "percent", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Graphite", + "editable": true, + "error": false, + "fill": 1, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 7, + "w": 8, + "x": 0, + "y": 7 + }, + "hiddenSeries": false, + "id": 3, + "isNew": true, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "null as zero", + "options": { + "dataLinks": [] + }, + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": true, + "steppedLine": false, + "targets": [ + { + "refId": "A", + "target": "aliasByNode(carbon.agents.*.cache.queues, 2)" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Number of Metric keys (names) in Cache", + "tooltip": { + "msResolution": true, + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Graphite", + "editable": true, + "error": false, + "fill": 1, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 7, + "w": 8, + "x": 8, + "y": 7 + }, + "hiddenSeries": false, + "id": 4, + "isNew": true, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "null as zero", + "options": { + "dataLinks": [] + }, + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": true, + "steppedLine": false, + "targets": [ + { + "refId": "A", + "target": "aliasByNode(carbon.agents.*.cache.size, 2)" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Total Datapoints in Cache", + "tooltip": { + "msResolution": true, + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Graphite", + "editable": true, + "error": false, + "fill": 1, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 7, + "w": 8, + "x": 16, + "y": 7 + }, + "hiddenSeries": false, + "id": 13, + "isNew": true, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "options": { + "dataLinks": [] + }, + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": true, + "steppedLine": false, + "targets": [ + { + "refId": "A", + "target": "groupByNode(carbon.relays.*.destinations.*.relayMaxQueueLength, 4, 'sum')" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Relay Destination Queue Length", + "tooltip": { + "msResolution": true, + "shared": true, + "sort": 2, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Graphite", + "editable": true, + "error": false, + "fill": 1, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 7, + "w": 8, + "x": 0, + "y": 14 + }, + "hiddenSeries": false, + "id": 5, + "isNew": true, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "null as zero", + "options": { + "dataLinks": [] + }, + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "refId": "B", + "target": "alias(divideSeries(averageSeries(carbon.agents.*.cache.size), averageSeries(carbon.agents.*.cache.queues)),\"avg datapoints\")", + "textEditor": true + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Average datapoints per key in cache", + "tooltip": { + "msResolution": true, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Graphite", + "editable": true, + "error": false, + "fill": 1, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 7, + "w": 8, + "x": 8, + "y": 14 + }, + "hiddenSeries": false, + "id": 6, + "isNew": true, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "options": { + "dataLinks": [] + }, + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": true, + "steppedLine": false, + "targets": [ + { + "refId": "A", + "target": "aliasByNode(carbon.agents.*.cache.overflow, 2)" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Datapoints received during full cache", + "tooltip": { + "msResolution": true, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Graphite", + "editable": true, + "error": false, + "fill": 1, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 7, + "w": 8, + "x": 16, + "y": 14 + }, + "hiddenSeries": false, + "id": 14, + "isNew": true, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "options": { + "dataLinks": [] + }, + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "hide": true, + "refId": "A", + "target": "averageSeries(carbon.relays.*.destinations.*.sent)" + }, + { + "hide": true, + "refId": "B", + "target": "averageSeries(carbon.relays.*.destinations.*.batchesSent)" + }, + { + "hide": false, + "refId": "C", + "target": "alias(divideSeries(#A,#B),\"Relay Batch Size\")", + "textEditor": true + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Average Relay Batch Size", + "tooltip": { + "msResolution": true, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Graphite", + "editable": true, + "error": false, + "fill": 1, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 7, + "w": 8, + "x": 0, + "y": 21 + }, + "hiddenSeries": false, + "id": 7, + "isNew": true, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "options": { + "dataLinks": [] + }, + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "refId": "A", + "target": "aliasByNode(aliasSub(collectd.graphite.disk-*.disk_ops.write, 'disk-(\\w+)', '\\1'), 2)" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Disk write ops", + "tooltip": { + "msResolution": true, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Graphite", + "editable": true, + "error": false, + "fill": 1, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 7, + "w": 8, + "x": 8, + "y": 21 + }, + "hiddenSeries": false, + "id": 9, + "isNew": true, + "legend": { + "alignAsTable": false, + "avg": false, + "current": false, + "max": false, + "min": false, + "rightSide": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "options": { + "dataLinks": [] + }, + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "refId": "A", + "target": "aliasByNode(aliasSub(collectd.graphite.disk-*.disk_time.write, 'disk-(\\w+)', '\\1'), 2)" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Disk write time", + "tooltip": { + "msResolution": true, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "ms", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": { + "collectd.graphite.tail-graphite_web.response_time-retrieval_time_max": "#890F02" + }, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Graphite", + "editable": true, + "error": false, + "fill": 1, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 7, + "w": 8, + "x": 16, + "y": 21 + }, + "hiddenSeries": false, + "id": 12, + "isNew": true, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "options": { + "dataLinks": [] + }, + "percentage": false, + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "hide": false, + "refCount": 0, + "refId": "A", + "target": "aliasByNode(scale(collectd.graphite.tail-graphite_web.response_time-retrieval_time_avg, 100), 3)" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Metric retrieval time", + "tooltip": { + "msResolution": true, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "ms", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Graphite", + "editable": true, + "error": false, + "fill": 1, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 7, + "w": 8, + "x": 0, + "y": 28 + }, + "hiddenSeries": false, + "id": 8, + "isNew": true, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "options": { + "dataLinks": [] + }, + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "refCount": 0, + "refId": "A", + "target": "aliasByNode(scaleToSeconds(collectd.graphite.interface-enp0s3.if_octets.*, 1), 4)" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Network traffic", + "tooltip": { + "msResolution": true, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "Bps", + "label": null, + "logBase": 1, + "max": 500000, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Graphite", + "editable": true, + "error": false, + "fill": 1, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 7, + "w": 8, + "x": 8, + "y": 28 + }, + "hiddenSeries": false, + "id": 10, + "isNew": true, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "options": { + "dataLinks": [] + }, + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "refId": "A", + "target": "aliasByNode(collectd.graphite.load.load.*, 4)" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Load", + "tooltip": { + "msResolution": true, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Graphite", + "editable": true, + "error": false, + "fill": 1, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 7, + "w": 8, + "x": 16, + "y": 28 + }, + "hiddenSeries": false, + "id": 11, + "isNew": true, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "options": { + "dataLinks": [] + }, + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "refId": "A", + "target": "aliasByNode(aliasSub(averageSeries(collectd.graphite.cpu-*.cpu-interrupt), 'cpu-(\\w+)', '\\1'), 3)" + }, + { + "refId": "B", + "target": "aliasByNode(aliasSub(averageSeries(collectd.graphite.cpu-*.cpu-softirq), 'cpu-(\\w+)', '\\1'), 3)" + }, + { + "refId": "C", + "target": "aliasByNode(aliasSub(averageSeries(collectd.graphite.cpu-*.cpu-steal), 'cpu-(\\w+)', '\\1'), 3)" + }, + { + "refId": "D", + "target": "aliasByNode(aliasSub(averageSeries(collectd.graphite.cpu-*.cpu-system), 'cpu-(\\w+)', '\\1'), 3)" + }, + { + "refId": "E", + "target": "aliasByNode(aliasSub(averageSeries(collectd.graphite.cpu-*.cpu-user), 'cpu-(\\w+)', '\\1'), 3)" + }, + { + "refId": "F", + "target": "aliasByNode(aliasSub(averageSeries(collectd.graphite.cpu-*.cpu-wait), 'cpu-(\\w+)', '\\1'), 3)" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "CPU", + "tooltip": { + "msResolution": true, + "shared": true, + "sort": 2, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + } + ], + "refresh": "10s", + "schemaVersion": 22, + "style": "dark", + "tags": [ + "graphite", + "carbon" + ], + "templating": { + "list": [] + }, + "time": { + "from": "now-3h", + "to": "now" + }, + "timepicker": { + "collapse": false, + "enable": true, + "notice": false, + "now": true, + "refresh_intervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ], + "status": "Stable", + "time_options": [ + "5m", + "15m", + "1h", + "6h", + "12h", + "24h", + "2d", + "7d", + "30d" + ], + "type": "timepicker" + }, + "timezone": "utc", + "title": "Graphite Carbon Metrics (obfuscurity)", + "uid": "FcEzIlwWz", + "version": 2 +} \ No newline at end of file diff --git a/templates/grafana/provisioning/dashboards/local.yaml b/templates/grafana/provisioning/dashboards/local.yaml new file mode 100644 index 0000000..a4ca3df --- /dev/null +++ b/templates/grafana/provisioning/dashboards/local.yaml @@ -0,0 +1,24 @@ +apiVersion: 1 + +providers: + # an unique provider name + - name: 'local' + # org id. will default to orgId 1 if not specified + orgId: 1 + # name of the dashboard folder. Required + folder: '' + # folder UID. will be automatically generated if not specified + folderUid: '' + # provider type. Required + type: file + # disable dashboard deletion + disableDeletion: false + # enable dashboard editing + editable: true + # how often Grafana will scan for changed dashboards + updateIntervalSeconds: 10 + # allow updating provisioned dashboards from the UI + allowUiUpdates: false + options: + # path to dashboard files on disk. Required + path: /etc/grafana/provisioning/dashboards \ No newline at end of file diff --git a/templates/grafana/provisioning/datasources/datasources.yaml b/templates/grafana/provisioning/datasources/datasources.yaml new file mode 100644 index 0000000..3944d57 --- /dev/null +++ b/templates/grafana/provisioning/datasources/datasources.yaml @@ -0,0 +1,26 @@ +# config file version +apiVersion: 1 + +# list of datasources to insert/update depending +# what's available in the database +datasources: + # name of the datasource. Required + - name: Graphite + # datasource type. Required + type: graphite + # access mode. proxy or direct (Server or Browser in the UI). Required + access: proxy + # org id. will default to orgId 1 if not specified + orgId: 1 + # url + url: https://127.0.0.1:443 + # default datasource + isDefault: true + # basic auth + basicAuth: false + # fields that will be converted to json and stored in jsonData + jsonData: + graphiteVersion: "1.1" + tlsAuth: false + tlsAuthWithCACert: false + tlsSkipVerify: true \ No newline at end of file diff --git a/templates/scripts/carbon-cache b/templates/scripts/carbon-cache new file mode 100755 index 0000000..7b47b71 --- /dev/null +++ b/templates/scripts/carbon-cache @@ -0,0 +1,77 @@ +#!/bin/sh + +# Former initscript for carbon-cache processes +# Jason Dixon +# Modified for operating systemd instances +# +# You must set the variables below. The +# INSTANCES variable should be set to the +# number of carbon-cache instances you have +# configured in your carbon.conf. Note that +# they must be numerically indexed from 1. +# (e.g. [cache:1], [cache:2], [cache:3] + +NAME=carbon-cache +INSTANCES=1 + +set -e + +test -x $DAEMON || exit 0 + +case "$1" in + enable) + for INSTANCE in $(seq 1 $INSTANCES); do + echo -n "Starting ${NAME}-${INSTANCE}: " + systemctl enable "${NAME}@${INSTANCE}" + done + ${0} status + ;; + + disable) + for INSTANCE in $(seq 1 $INSTANCES); do + echo -n "Starting ${NAME}-${INSTANCE}: " + systemctl disable "${NAME}@${INSTANCE}" + done + ${0} status + ;; + + start) + for INSTANCE in $(seq 1 $INSTANCES); do + echo -n "Starting ${NAME}-${INSTANCE}: " + systemctl start "${NAME}@${INSTANCE}" + done + exit 0 + ;; + + stop) + for INSTANCE in $(seq 1 $INSTANCES); do + echo -n "Stopping ${NAME}-${INSTANCE}: " + systemctl stop "${NAME}@${INSTANCE}" + done + exit 0 + ;; + + restart) + for INSTANCE in $(seq 1 $INSTANCES); do + echo -n "Stopping ${NAME}-${INSTANCE}: " + systemctl restart "${NAME}@${INSTANCE}" + done + exit 0 + ;; + + status) + for INSTANCE in $(seq 1 $INSTANCES); do + echo -n "Stopping ${NAME}-${INSTANCE}: " + systemctl restart "${NAME}@${INSTANCE}" + done + exit 0 + ;; + + *) + echo "Usage: /usr/local/bin/${NAME} {enable|disable|start|stop|restart|status}" >%2 + exit 1 + ;; + +esac + +exit 0 diff --git a/uninstall b/uninstall index 31b2c88..8afc7d5 100755 --- a/uninstall +++ b/uninstall @@ -21,7 +21,7 @@ rm -r /usr/local/src/statsite rm /usr/local/bin/*whisper*.py rm /usr/local/lib/python2.7/dist-packages/whisper* rm /etc/apache2/sites-*/graphite.conf -systemctl disable 'carbon-cache@1' # TODO: INSTANCES loop needs to be implemented +/usr/local/bin/carbon-cache disable systemctl disable statsite systemctl disable grafana-server rm -rf /etc/systemd/system/carbon* @@ -41,3 +41,4 @@ rm -r /etc/collectd # Remove our system user for Carbon pkill -9 -f carbon-cache userdel carbon +rm /usr/local/bin/carbon-cache \ No newline at end of file diff --git a/upgrade b/upgrade index ecc6087..a04ba59 100755 --- a/upgrade +++ b/upgrade @@ -67,6 +67,6 @@ PYTHONPATH=${GRAPHITE_HOME}/webapp django-admin.py migrate --noinput --settings= PYTHONPATH=${GRAPHITE_HOME}/webapp django-admin.py loaddata --settings=graphite.settings dump_${BACKUP}_data.json # Restart our processes -systemctl restart 'carbon-cache@1' # TODO: INSTANCES loop needs to be implemented +/usr/local/bin/carbon-cache restart service memcached restart -service apache2 start +service apache2 restart From 39957db580b01dc2b82010b4246fe671c0cb0d0e Mon Sep 17 00:00:00 2001 From: deniszh Date: Sat, 22 Feb 2020 23:26:19 +0100 Subject: [PATCH 4/7] missing stop --- uninstall | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uninstall b/uninstall index 8afc7d5..b45a51d 100755 --- a/uninstall +++ b/uninstall @@ -2,7 +2,7 @@ # Graphite uninstall script for Ubuntu 14.04 x64 # Jason Dixon -systemctl stop 'carbon-cache@1' # TODO: more instances need to be stopped +/usr/local/bin/carbon-cache stop service memcached stop service collectd stop service apache2 stop From cc921fcadb5525f65ce0e901ef3878a69de15b10 Mon Sep 17 00:00:00 2001 From: deniszh Date: Sun, 23 Feb 2020 14:18:45 +0100 Subject: [PATCH 5/7] Systemd timers instead of cron, other fixes --- install | 19 +++++++++---------- .../GraphiteCarbonMetrics_obfuscurity.json | 4 ++-- templates/scripts/carbon-cache | 8 ++++---- .../graphite-build-index} | 0 templates/systemd/carbon-cache@.service | 2 +- .../systemd/graphite-build-index.service | 11 +++++++++++ templates/systemd/graphite-build-index.timer | 9 +++++++++ templates/systemd/statsite.service | 2 +- uninstall | 12 +++++++----- upgrade | 2 +- 10 files changed, 45 insertions(+), 24 deletions(-) rename templates/{graphite/cron/build-index => scripts/graphite-build-index} (100%) mode change 100644 => 100755 create mode 100644 templates/systemd/graphite-build-index.service create mode 100644 templates/systemd/graphite-build-index.timer diff --git a/install b/install index 3fa3aaf..a9391fd 100755 --- a/install +++ b/install @@ -10,7 +10,7 @@ GRAPHITE_CONF="${GRAPHITE_HOME}/conf" GRAPHITE_STORAGE="${GRAPHITE_HOME}/storage" if [ -z $GRAPHITE_RELEASE ]; then - GRAPHITE_RELEASE='master' + GRAPHITE_RELEASE='1.1.6' fi if [ -z $STATSITE_RELEASE ]; then @@ -76,13 +76,12 @@ cp ${SYNTHESIZE_HOME}/templates/statsite/statsite.conf /etc/statsite.conf mkdir ${GRAPHITE_CONF}/examples mv ${GRAPHITE_CONF}/*.example ${GRAPHITE_CONF}/examples/ cp ${SYNTHESIZE_HOME}/templates/graphite/conf/* ${GRAPHITE_CONF}/ -mkdir -p /etc/collectd cp ${SYNTHESIZE_HOME}/templates/collectd/collectd.conf /etc/collectd/ cp ${SYNTHESIZE_HOME}/templates/apache/graphite.conf /etc/apache2/sites-available/ # using systemd units instead of init and upstart files cp ${SYNTHESIZE_HOME}/templates/systemd/* /etc/systemd/system/ -# installing scripts for cacron-cache instances control +# installing scripts for carbon-cache instances control script cp ${SYNTHESIZE_HOME}/templates/scripts/* /usr/local/bin/ # Setup the correct Apache site and modules @@ -113,10 +112,12 @@ chown -R carbon ${GRAPHITE_STORAGE}/log mkdir ${GRAPHITE_STORAGE}/log/apache2 chown -R www-data ${GRAPHITE_STORAGE}/log/webapp -# Setup hourly cron to rebuild Graphite index -cp ${SYNTHESIZE_HOME}/templates/graphite/cron/build-index /etc/cron.hourly/graphite-build-index -chmod 755 /etc/cron.hourly/graphite-build-index -sudo -u www-data /opt/graphite/bin/build-index.sh +# Setup hourly systemd timer to rebuild Graphite index +cp ${SYNTHESIZE_HOME}/templates/scripts/graphite-build-index /usr/local/bin/graphite-build-index +systemctl daemon-reload +systemctl enable graphite-build-index.timer +systemctl start graphite-build-index.timer +systemctl start graphite-build-index # Install Grafana apt-get install -y apt-transport-https @@ -124,6 +125,7 @@ apt-get install -y software-properties-common wget wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add - add-apt-repository "deb https://packages.grafana.com/oss/deb stable main" apt-get install grafana + # Bootstrap Grafana datasources and dashboards mkdir -p /etc/grafana/provisioning/datasources/ mkdir -p /etc/grafana/provisioning/dashboards/ @@ -132,7 +134,6 @@ cp ${SYNTHESIZE_HOME}/templates/grafana/provisioning/dashboards/* /etc/grafana/p systemctl restart grafana-server # Enabling processes start -systemctl daemon-reload /usr/local/bin/carbon-cache enable systemctl enable statsite systemctl enable grafana-server @@ -143,5 +144,3 @@ service memcached restart service collectd restart service apache2 restart service statsite restart - - diff --git a/templates/grafana/provisioning/dashboards/GraphiteCarbonMetrics_obfuscurity.json b/templates/grafana/provisioning/dashboards/GraphiteCarbonMetrics_obfuscurity.json index a4c67ff..d04205d 100644 --- a/templates/grafana/provisioning/dashboards/GraphiteCarbonMetrics_obfuscurity.json +++ b/templates/grafana/provisioning/dashboards/GraphiteCarbonMetrics_obfuscurity.json @@ -1087,7 +1087,7 @@ "hide": false, "refCount": 0, "refId": "A", - "target": "aliasByNode(scale(collectd.graphite.tail-graphite_web.response_time-retrieval_time_avg, 100), 3)" + "target": "aliasByNode(scale(collectd.graphite.tail-graphite_web.response_time-retrieval_time_min, 100), 3)" } ], "thresholds": [], @@ -1180,7 +1180,7 @@ { "refCount": 0, "refId": "A", - "target": "aliasByNode(scaleToSeconds(collectd.graphite.interface-enp0s3.if_octets.*, 1), 4)" + "target": "aliasByNode(scaleToSeconds(collectd.graphite.interface-*.if_octets.*, 1), 4)" } ], "thresholds": [], diff --git a/templates/scripts/carbon-cache b/templates/scripts/carbon-cache index 7b47b71..f564e47 100755 --- a/templates/scripts/carbon-cache +++ b/templates/scripts/carbon-cache @@ -21,7 +21,7 @@ test -x $DAEMON || exit 0 case "$1" in enable) for INSTANCE in $(seq 1 $INSTANCES); do - echo -n "Starting ${NAME}-${INSTANCE}: " + echo -n "Enabling ${NAME}-${INSTANCE}: " systemctl enable "${NAME}@${INSTANCE}" done ${0} status @@ -29,7 +29,7 @@ case "$1" in disable) for INSTANCE in $(seq 1 $INSTANCES); do - echo -n "Starting ${NAME}-${INSTANCE}: " + echo -n "Disabling ${NAME}-${INSTANCE}: " systemctl disable "${NAME}@${INSTANCE}" done ${0} status @@ -53,7 +53,7 @@ case "$1" in restart) for INSTANCE in $(seq 1 $INSTANCES); do - echo -n "Stopping ${NAME}-${INSTANCE}: " + echo -n "Restarting ${NAME}-${INSTANCE}: " systemctl restart "${NAME}@${INSTANCE}" done exit 0 @@ -61,7 +61,7 @@ case "$1" in status) for INSTANCE in $(seq 1 $INSTANCES); do - echo -n "Stopping ${NAME}-${INSTANCE}: " + echo -n "Status ${NAME}-${INSTANCE}: " systemctl restart "${NAME}@${INSTANCE}" done exit 0 diff --git a/templates/graphite/cron/build-index b/templates/scripts/graphite-build-index old mode 100644 new mode 100755 similarity index 100% rename from templates/graphite/cron/build-index rename to templates/scripts/graphite-build-index diff --git a/templates/systemd/carbon-cache@.service b/templates/systemd/carbon-cache@.service index 989cd3c..2ae6e10 100644 --- a/templates/systemd/carbon-cache@.service +++ b/templates/systemd/carbon-cache@.service @@ -13,4 +13,4 @@ LimitNOFILE=128000 [Install] WantedBy=multi-user.target -DefaultInstance=1 \ No newline at end of file +DefaultInstance=1 diff --git a/templates/systemd/graphite-build-index.service b/templates/systemd/graphite-build-index.service new file mode 100644 index 0000000..ffb471e --- /dev/null +++ b/templates/systemd/graphite-build-index.service @@ -0,0 +1,11 @@ +[Unit] +Description=Run graphite-build-index + +[Service] +Type=simple +ExecStart=/usr/local/bin/carbon-build-index + +[Install] +WantedBy=multi-user.target + + diff --git a/templates/systemd/graphite-build-index.timer b/templates/systemd/graphite-build-index.timer new file mode 100644 index 0000000..5ec077e --- /dev/null +++ b/templates/systemd/graphite-build-index.timer @@ -0,0 +1,9 @@ +[Unit] +Description=Run graphite-build-index hourly + +[Timer] +OnCalendar=hourly +Persistent=true + +[Install] +WantedBy=timers.target diff --git a/templates/systemd/statsite.service b/templates/systemd/statsite.service index 589c091..318d9c0 100644 --- a/templates/systemd/statsite.service +++ b/templates/systemd/statsite.service @@ -10,4 +10,4 @@ ExecStart=/usr/local/sbin/statsite -f /etc/statsite.conf Restart=on-failure [Install] -WantedBy=multi-user.target \ No newline at end of file +WantedBy=multi-user.target diff --git a/uninstall b/uninstall index b45a51d..f634d0a 100755 --- a/uninstall +++ b/uninstall @@ -7,6 +7,8 @@ service memcached stop service collectd stop service apache2 stop service statsite stop +systemctl stop grafana-server +systemctl disable grafana-server # Remove various binaries, configuration files, and source directories rm /usr/local/sbin/statsite* @@ -30,10 +32,10 @@ systemctl daemon-reload rm /etc/cron.hourly/graphite-build-index # Uninstall our package dependencies and purge configurations -apt-get purge -y git wget curl netbase collectd memcached \ - build-essential automake libtool libffi-dev libcairo2-dev libcairo2 libffi6 \ - python3-dev python3-pip fontconfig apache2 libapache2-mod-wsgi-py3 -apt-get autoremove -y +apt-get purge -y python3-cairo python3-django python3-django-tagging python3-twisted python3-zope.interface \ + fontconfig apache2 libapache2-mod-wsgi-py3 python3-pysqlite2 python3-simplejson python3-memcache \ + git-core collectd memcached gcc g++ make libtool automake grafana +apt autoremove -y # Brute force cleanup on the collectd configuration directory rm -r /etc/collectd @@ -41,4 +43,4 @@ rm -r /etc/collectd # Remove our system user for Carbon pkill -9 -f carbon-cache userdel carbon -rm /usr/local/bin/carbon-cache \ No newline at end of file +rm /usr/local/bin/carbon-cache diff --git a/upgrade b/upgrade index a04ba59..608a0cc 100755 --- a/upgrade +++ b/upgrade @@ -1,5 +1,5 @@ #!/bin/bash -# Synthesize upgrade script for Graphite 1.1.0 +# Synthesize upgrade script for Graphite 1.1.6 # Jason Dixon SYNTHESIZE_HOME=$( cd "$( dirname "$0" )" && pwd ) From 0fda0fccf732e2f37d7cbfa6e7bcdf7c454cd4f4 Mon Sep 17 00:00:00 2001 From: deniszh Date: Sun, 23 Feb 2020 14:21:23 +0100 Subject: [PATCH 6/7] no extra newlines --- templates/systemd/graphite-build-index.service | 2 -- 1 file changed, 2 deletions(-) diff --git a/templates/systemd/graphite-build-index.service b/templates/systemd/graphite-build-index.service index ffb471e..e5660c4 100644 --- a/templates/systemd/graphite-build-index.service +++ b/templates/systemd/graphite-build-index.service @@ -7,5 +7,3 @@ ExecStart=/usr/local/bin/carbon-build-index [Install] WantedBy=multi-user.target - - From 80254f4b10be809a58e44ede38185bf188ad3732 Mon Sep 17 00:00:00 2001 From: deniszh Date: Sun, 29 Mar 2020 17:00:26 +0200 Subject: [PATCH 7/7] Version 1.1.7 --- Vagrantfile | 2 +- install | 2 +- upgrade | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index b86ed82..9058bd5 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -12,6 +12,6 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.network :forwarded_port, guest: 2003, host: 22003 config.vm.network :forwarded_port, guest: 2004, host: 22004 config.vm.network :forwarded_port, guest: 3000, host: 3030 - graphite_version = ENV['GRAPHITE_RELEASE'].nil? ? '1.1.6' : ENV['GRAPHITE_RELEASE'] + graphite_version = ENV['GRAPHITE_RELEASE'].nil? ? '1.1.7' : ENV['GRAPHITE_RELEASE'] config.vm.provision "shell", inline: "cd /vagrant; GRAPHITE_RELEASE=#{graphite_version} ./install" end diff --git a/install b/install index a9391fd..764f393 100755 --- a/install +++ b/install @@ -10,7 +10,7 @@ GRAPHITE_CONF="${GRAPHITE_HOME}/conf" GRAPHITE_STORAGE="${GRAPHITE_HOME}/storage" if [ -z $GRAPHITE_RELEASE ]; then - GRAPHITE_RELEASE='1.1.6' + GRAPHITE_RELEASE='1.1.7' fi if [ -z $STATSITE_RELEASE ]; then diff --git a/upgrade b/upgrade index 608a0cc..426a54c 100755 --- a/upgrade +++ b/upgrade @@ -1,5 +1,5 @@ #!/bin/bash -# Synthesize upgrade script for Graphite 1.1.6 +# Synthesize upgrade script for Graphite 1.1.7 # Jason Dixon SYNTHESIZE_HOME=$( cd "$( dirname "$0" )" && pwd ) @@ -19,7 +19,7 @@ if [[ ! $DANGER_ZONE =~ 'TRUE' ]]; then fi if [ -z $GRAPHITE_RELEASE ]; then - GRAPHITE_RELEASE='1.1.6' + GRAPHITE_RELEASE='1.1.7' fi if [[ ! $UBUNTU_RELEASE =~ 'Ubuntu 18.04' ]]; then