1
0
mirror of https://github.com/pavel-odintsov/fastnetmon synced 2024-09-28 19:51:48 +02:00
fastnetmon-rewritten/docs/GRAPHITE_INTEGRATION.md

111 lines
3.2 KiB
Markdown
Raw Normal View History

2015-05-10 20:50:41 +02:00
### Graphite integration
2015-05-10 20:51:28 +02:00
Example screen: ![Graphite](images/fastnetmon_graphite.png)
2015-05-10 20:50:41 +02:00
We could store pps/bps/flow number for top 7 (could be configured) host in incoming and outgoung directions. In addition to this we export total pps/bps/flow number which flow over FastNetMon.
Configuration from FastNetMon side is very simple, please put following fields to /etc/fastnetmon.conf:
```bash
2015-06-12 13:02:34 +02:00
graphite = on
2015-05-10 20:50:41 +02:00
graphite_host = 127.0.0.1
graphite_port = 2003
2015-06-12 14:06:26 +02:00
graphite_prefix = fastnetmon
2015-05-10 20:50:41 +02:00
```
### Install Graphite Debian 8 Jessie
First of all, please install all packages:
2015-05-10 20:52:49 +02:00
```bash
2015-08-04 10:21:02 +02:00
apt-get install -y python-whisper graphite-carbon
2015-05-10 20:52:49 +02:00
```
2015-05-10 20:50:41 +02:00
Whisper - it's database for data. Graphite - service for storing and retrieving data from database.
2015-06-12 13:50:43 +02:00
Install web frontend:
```bash
2015-06-12 13:54:19 +02:00
apt-get install -y graphite-web
2015-05-10 20:52:49 +02:00
```
2015-05-10 20:50:41 +02:00
2015-05-10 20:52:49 +02:00
Create database, specify login/password and email here:
```bash
graphite-manage syncdb
```
2015-05-10 20:50:41 +02:00
Specify your timezone in file /etc/graphite/local_settings.py on line TIME_ZONE.
2015-05-10 20:50:41 +02:00
Change owner:
2015-05-10 20:52:49 +02:00
```bash
chown _graphite:_graphite /var/lib/graphite/graphite.db
```
2015-05-10 20:50:41 +02:00
Run it with apache:
```bash
2015-08-04 11:32:38 +02:00
apt-get install -y libapache2-mod-wsgi apache2-mpm-prefork
2015-05-10 20:50:41 +02:00
cp /usr/share/graphite-web/apache2-graphite.conf /etc/apache2/sites-available/graphite-web.conf
a2dissite 000-default.conf
a2ensite graphite-web
2015-08-04 11:32:38 +02:00
a2enmod wsgi
2015-05-10 20:50:41 +02:00
```
Enable load on startup:
```bash
systemctl enable apache2.service
systemctl restart apache2.service
```
Open site:
2015-06-12 13:54:19 +02:00
http://ip.ad.dr.es
2015-05-10 20:50:41 +02:00
Put test data to Graphite:
2015-08-05 10:22:06 +02:00
```echo "test.bash.stats 42 `date +%s`" | nc -q0 127.0.0.1 2003```
2015-06-15 10:05:51 +02:00
If you have issues with Carbon like this:
```bash
/etc/init.d/carbon-cache start
* Starting Graphite backend daemon carbon-cache Traceback (most recent call last):
File "/usr/bin/carbon-cache", line 32, in <module>
run_twistd_plugin(__file__)
File "/usr/lib/python2.7/dist-packages/carbon/util.py", line 90, in run_twistd_plugin
config.parseOptions(twistd_options)
File "/usr/local/lib/python2.7/dist-packages/twisted/application/app.py", line 619, in parseOptions
usage.Options.parseOptions(self, options)
File "/usr/local/lib/python2.7/dist-packages/twisted/python/usage.py", line 270, in parseOptions
raise UsageError("Unknown command: %s" % sub)
twisted.python.usage.UsageError: Unknown command: carbon-cache
```
Please check this [link](http://stackoverflow.com/questions/27951317/install-graphite-statsd-getting-error-unknown-carbon-cache)
2015-08-05 10:56:48 +02:00
Some useful graphics for Graphite.
Total load:
```bash
fastnetmon.incoming.pps
fastnetmon.outgoing.pps
fastnetmon.incoming.mbps
fastnetmon.outgoing.mbps
```
Top talkers:
```bash
highestMax(fastnetmon.*.outgoing.average.pps, 10)
highestMax(fastnetmon.*.outgoing.average.mbps, 10)
highestMax(fastnetmon.*.incoming.average.pps, 10)
highestMax(fastnetmon.*.incoming.average.mbps, 10)
```
Also I recommend to configure Graphite this way.
For big networks please enlarge number of created file in /etc/carbon/carbon.conf:
```bash
MAX_CREATES_PER_MINUTE = 5000
```
And if you want to store data every 5 seconds for 1 months please do following _before_ starting collection to Graphite in file /etc/carbon/storage-schemas.conf:
```bash
[default_5sec_for_1month]
pattern = .*
retentions = 5s:31d
```