graphite_on_debian
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| graphite_on_debian [2014/04/08 12:32] – morten | graphite_on_debian [2019/01/28 11:02] (current) – morten | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Installing Graphite for use with NAV on Debian ====== | + | ~~REDIRECT> |
| - | + | ||
| - | This is a short guide to installing and configuring a Graphite installation dedicated to NAV on a Debian Wheezy-based server. | + | |
| - | + | ||
| - | ===== Getting Graphite ===== | + | |
| - | + | ||
| - | A full Graphite setup consists of the Carbon backend server, which receives metrics over TCP or UDP, and a Graphite web frontend, which enables browsing and retrievial/ | + | |
| - | + | ||
| - | The Debian package '' | + | |
| - | + | ||
| - | $ apt-cache policy graphite-web | + | |
| - | graphite-web: | + | |
| - | Installed: (none) | + | |
| - | Candidate: 0.9.12-0uninett1~bpo70+1 | + | |
| - | Version table: | + | |
| - | | + | |
| - | 500 https:// | + | |
| - | + | ||
| - | Assuming you will be running Graphite on the same Debian server as you are running NAV, all you need to do to install Graphite is: | + | |
| - | + | ||
| - | <code bash> | + | |
| - | apt-get install graphite-carbon graphite-web | + | |
| - | </ | + | |
| - | + | ||
| - | ===== Configuring Carbon ===== | + | |
| - | + | ||
| - | Carbon, the metric-receiving backend of Graphite, must be configured before it can be used with NAV. We will only be covering the simple case of using the // | + | |
| - | + | ||
| - | Edit ''/ | + | |
| - | + | ||
| - | <code ini> | + | |
| - | MAX_CREATES_PER_MINUTE = inf | + | |
| - | ENABLE_UDP_LISTENER = True | + | |
| - | </ | + | |
| - | + | ||
| - | The first line ensures that Carbon will not delay creating Whisper backend files for the metrics NAV sends it. The default setting is a maximum of 50 creates per minute (the setting exists to limit I/O strain on huyge setups), which means that when bootstrapping a NAV installation, | + | |
| - | + | ||
| - | The second line ensures that Carbon accepts metrics on a UDP socket, which is required by NAV. | + | |
| - | + | ||
| - | Carbon also needs to know the resolution at which to store your time-series data, for how long to store it, and how to roll up data from high resolution data archives to lower resolution archives. These are the storage schemas and aggregation methods. NAV provides its own config examples for this; on a Graphite backend dedicated to NAV, you can simply symlink these config files from NAV: | + | |
| - | + | ||
| - | <code bash> | + | |
| - | ln -s / | + | |
| - | </ | + | |
| - | + | ||
| - | Make sure the Carbon backend willbe automatically started at boot time, by editing ''/ | + | |
| - | + | ||
| - | <code bash> | + | |
| - | CARBON_CACHE_ENABLED=true | + | |
| - | </ | + | |
| - | + | ||
| - | Finally, start the // | + | |
| - | + | ||
| - | <code bash> | + | |
| - | service carbon-cache start | + | |
| - | </ | + | |
| - | + | ||
| - | ===== Configuring the Graphite web interface ===== | + | |
| - | + | ||
| - | To enable the web interface, you need to do two things: | + | |
| - | + | ||
| - | - Configure and create the database it will use for storing graph definitions. | + | |
| - | - Configure Apache to serve the web interface. | + | |
| - | + | ||
| - | ==== Creating the graphite database ==== | + | |
| - | + | ||
| - | Graphite will by default use a SQLite database, but this is not recommended in a production setting, as it will cause issues with multiple simultaneous users. You already have a PostgreSQL installation because of NAV, so we recommend using this. | + | |
| - | + | ||
| - | Make a '' | + | |
| - | + | ||
| - | <code bash> | + | |
| - | createuser --login graphite | + | |
| - | createdb --owner=graphite graphite | + | |
| - | </ | + | |
| - | + | ||
| - | The Graphite web app's configuration file is located in ''/ | + | |
| - | + | ||
| - | $ makepasswd --chars 51 | + | |
| - | iLNScMiUpNy5hditWAp9e2dyHGTFoX44UKsbhj91f9xL4fdJSDY | + | |
| - | + | ||
| - | Then edit ''/ | + | |
| - | + | ||
| - | <code python> | + | |
| - | SECRET_KEY = ' | + | |
| - | TIME_ZONE = ' | + | |
| - | DATABASES = { | + | |
| - | ' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ' | + | |
| - | } | + | |
| - | } | + | |
| - | </ | + | |
| - | + | ||
| - | Now make // | + | |
| - | + | ||
| - | <code bash> | + | |
| - | graphite-manage syncdb --noinput | + | |
| - | </ | + | |
| - | + | ||
| - | ==== Configure Apache to serve the Graphite web app ==== | + | |
| - | + | ||
| - | In principle, you can use any web server that supports the WSGI interface, but you already have Apache because of NAV, so lets use that. Graphite-web will need its own virtualhost, | + | |
| - | + | ||
| - | <code apache> | + | |
| - | Listen 8000 | + | |
| - | < | + | |
| - | + | ||
| - | WSGIDaemonProcess _graphite processes=1 threads=1 display-name=' | + | |
| - | WSGIProcessGroup _graphite | + | |
| - | WSGIImportScript / | + | |
| - | WSGIScriptAlias / / | + | |
| - | + | ||
| - | Alias /content/ / | + | |
| - | < | + | |
| - | SetHandler None | + | |
| - | </ | + | |
| - | + | ||
| - | ErrorLog ${APACHE_LOG_DIR}/ | + | |
| - | + | ||
| - | # Possible values include: debug, info, notice, warn, error, crit, | + | |
| - | # alert, emerg. | + | |
| - | LogLevel warn | + | |
| - | + | ||
| - | CustomLog ${APACHE_LOG_DIR}/ | + | |
| - | + | ||
| - | </ | + | |
| - | </ | + | |
| - | + | ||
| - | This defines a virtual host that will serve the Graphite web app on port **8000**. Some caveats: | + | |
| - | + | ||
| - | * All graphite statistics will become browseable for anyone who can access your server on port 8000. You may wish to restrict access to this port, either using iptables or ACLs in your routers. Or, if you do not care about browsing the web app yourself, change the '' | + | |
| - | * Adding SSL encryption is left as an excercise for the reader. | + | |
| - | + | ||
| - | Now, enable the new site on port 8000: | + | |
| - | + | ||
| - | <code bash> | + | |
| - | a2ensite graphite-web | + | |
| - | service apache2 restart | + | |
| - | </ | + | |
| - | + | ||
| - | + | ||
| - | Congratulations, | + | |
graphite_on_debian.1396960360.txt.gz · Last modified: by morten
