Free your NAS and dock your Graphite

When FreeNAS Corral came out it gave us a wonderful new system for our NAS servers. Personally the new interface feels a bit cramped, I felt I had more of an overview in the old interface. But that’s personal preferences for you.

A new feature I absolutely love is the built-in full virtual machine and Docker container management. Way to go bhyve!

There are still a few kinks to work out to make it as rock solid as 9.10, but it’s getting there with each update.

The thing I absolutely do not love about the FreeNAS Corral is the lack of graphs. There are a few widgets available for the Dashboard which give you a quick overview what is happening to your system. If you want something like the graphs you had on the good ol’ 9.10 you have to create up two Docker containers. The images are called graphite-statsd and grafana. I will not get into the setup process here, there are plenty of really great instruction videos on YouTube.

What I will go into is how to get the Graphite container working properly since it does not work out of the box.

I created a Graphite container, called it graphite-statsd and used the bridged network setup. There were no warnings or errors during creation and it started up OK too. But the webUI was not accessible and telnet to port 80 failed.

Well, I rolled up my proverbial sleeves and got cracking. I found bits of configs online and puzzled together a seemingly working configuration. Not ideal, but it works so far.

My configs for Docker containers are located in /mnt/nPool/Docker.

I started tailing the nginx error log file /mnt/nPool/Docker/graphite-FreeNAS/var/log/nginx/error.log
The first error I saw was:

2017/04/12 14:48:23 [emerg] 32332#0: open() "/etc/nginx/nginx.conf" failed (2: No such file or directory)

I downloaded the config file:

# cd /mnt/nPool/Docker/graphite-FreeNAS/etc/nginx
# wget https://raw.githubusercontent.com/hopsoft/docker-graphite-statsd/master/conf/etc/nginx/nginx.conf

nginx.conf also includes a config for Graphite. I created the missing directory and downloaded the config file:

# cd /mnt/nPool/Docker/graphite-FreeNAS/etc/nginx
# mkdir sites-enabled
# wget https://raw.githubusercontent.com/hopsoft/docker-graphite-statsd/master/conf/etc/nginx/sites-enabled/graphite-statsd.conf

Missing MIME types came next:

2017/04/12 14:52:53 [emerg] 390#0: open() "/etc/nginx/mime.types" failed (2: No such file or directory) in /etc/nginx/nginx.conf:27

Found them here:

# cd /mnt/nPool/Docker/graphite-FreeNAS/etc/nginx
# wget https://gist.githubusercontent.com/0x9090/ee977ce79ff67ce0208a1b6d68a5a190/raw/2b8d0d5ad50114ebe4c6441f96a5b296ce3d219c/mime.types

Then came fastcgi settings:

2017/04/12 14:55:21 [emerg] 678#0: open() "/etc/nginx/fastcgi_params" failed (2: No such file or directory) in /etc/nginx/sites-enabled/graphite-statsd.conf:25

I pasted in settings I found here: https://www.digitalocean.com/community/questions/getting-nginx-fpm-sock-error

# nano /mnt/nPool/Docker/graphite-FreeNAS/etc/nginx/fastcgi_params

CTRL+v and save.

Great. No more errors in the error log. The the web interface finally woke up spewing out a stack trace ending in this error:

IOError: [Errno 2] No such file or directory: '/var/log/graphite/info.log'

I created the directory:

# mkdir /mnt/nPool/Docker/graphite-FreeNAS/var/log/graphite

Finally, the Graphite web interface loaded. I fired up the Grafana container, pointed it at my Graphite and created the graphs I needed. Great success!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s