Grafana dashboards? FreeNAS Graphite -> InfluxDB

Status
Not open for further replies.

ikke

Contributor
Joined
Apr 22, 2012
Messages
124
Hi,

I have recently setup Grafana at home to monitor my different boxes and services around containers. Now I'd like to add FreeNAS to the boards also. Would you have some nice dashboards to share (JSON)?

There seems not to be telegraf service to output data to influxdb. There are instructions how to do it, but it's manual job after each FreeNAS update: https://www.reddit.com/r/homelab/comments/603wur/dashboard_tutorial_grafana_influxdb_and_telegraf/. It works though, and the board also mostly works: https://grafana.com/dashboards/2162

BTW, the hddtemp python there was a bit outdated and doesn't work anymore, I fixed it if someone wants it.

There was also a hint FreeNAS seems to be able to output Graphite data to InfluxDB configured with Graphite interface. It seems to work nice also, I tried. Would anyone have premade dashboards for this? https://www.reddit.com/r/homelab/comments/8c7o2c/telegraf_on_freenas/

I'm not experienced with graphite mode in influx, but it seems FreeNAS nicely writes there, but perhaps it's write only port? I failed to configure grafana to read from influx using graphite data source on influx graphite port 2003.

It seems the Graphite output data is a bit differently formatted compared to telegraf output, so basic influx grafana boards don't show data for FreeNAS graphite output.

I know this is all doable by myself, but I'd really like to try my luck if someone could please share existing board :)

Thanks for sharing!
 

ikke

Contributor
Joined
Apr 22, 2012
Messages
124
BTW, here's the modified python to collect the cpu temps. I modified it to support python3. Also fixed the loop, which in python3 ended up into endless busy loop. Perhaps it could be utilized in FreeNAS too to push hdd temps to graphite? Original here

Code:
# cat hddtemp.py
#!/usr/bin/env python

import os
import re
import subprocess


def diskTemp(hostname):
	serial_found = False
	temp_found = False
	for disk in listDisks():
		if 'ada' in disk:
			sysctl = subprocess.Popen(['/usr/local/sbin/smartctl', '-iA', '-n', 'standby', '/dev/'+disk], stdout=subprocess.PIPE)
			for line in sysctl.stdout:
				if 'Serial Number' in line.decode():
					serial = line.split()[2]
					serial_found = True
				if 'Temperature_Celsius' in line.decode():
					temp = str(float(line.decode().split()[9]))
					temp_found = True
				if serial_found == True and temp_found == True:
					print("system,host=" + hostname + ",name="+disk + " temperature=" + temp)
					break

def listDisks():
	sysctl = subprocess.Popen(['/sbin/sysctl', '-a', 'kern.disks'],stdout=subprocess.PIPE)
	while True:
		line = sysctl.stdout.readline()
		if line != '':
			return line.decode().split()
		else:
			break

def main():
	hostname = os.uname()[1]
	diskTemp(hostname)

if __name__ == "__main__":
	main()

 
D

dlavigne

Guest
If you create a feature request at bugs.freenas.org, post the issue number here.
 

ikke

Contributor
Joined
Apr 22, 2012
Messages
124
Ok, I will if I do. But this is really external to FreeNAS. I don't see it a feature request to Freenas for external grafana boards. However, I started going through influxdb template for freenas graphite output. So that's on influxdb server. Perhaps users here could together do some common known conf for that, external to FreeNAS, along with grafana board, right?


It would be different if FreeNAS would have telegraf plugin to output stats to influxdb, but after learning FreeNAS can output graphite to influxdb server, I'm not sure it would be needed.
 
Status
Not open for further replies.
Top