Page 1 of 1

Monitoring with Graphite/Grafana

Posted: Wed Jul 31, 2019 12:55 am
by supremepizza
Has anyone figured out how to get stats out of QES to graphite? It seems the only official way to monitor is via SNMP, but I would much rather have the ability to output stats like QTS can.

Re: Monitoring with Graphite/Grafana

Posted: Thu Aug 01, 2019 5:13 am
by supremepizza
I sort of figured out a hackey way to do this. I'm only sharing this in hopes someone like me that needs recorded stats other than from SNMP finds it useful.

DO THIS AT YOUR OWN RISK, The controller OS is not meant to be messed with by plebs like us and may make your system unreliable!!!.

You need to log into the cli via SSH, type 'xlogin' then enter the support password. If you email qnap support and ask for the password, they will be able to tell you.

I created a share on a pool named util, then downloaded the collectd freebsd port from here: http://pkg.freebsd.org/FreeBSD:11:amd64 ... .9.0_2.txz

https://freebsd.pkgs.org/11/freebsd-por ... 2.txz.html

The rootfs of the qnap controller is read-only, so all my configs and logs and such live on the util share I created. This means every time the controller is rebooted, I'm going to have to kick off the process from the cli.

I'm launching it from the share and specifying the conf file - example: /share/util/usr/local/sbin/collectd -C /share/util/usr/local/etc/collectd.conf
Here's a sample conf

Code: Select all

#
# Config file for collectd(1).
# Please read collectd.conf(5) for a list of options.
# http://collectd.org/
#

##############################################################################
# Global                                                                     #
#----------------------------------------------------------------------------#
# Global settings for the daemon.                                            #
##############################################################################

Hostname    "NAMEOFYOURQNAP"
#FQDNLookup   true
BaseDir     "/share/util/var/db/collectd"
PIDFile     "/share/util/var/run/collectd.pid"
PluginDir   "/share/util/usr/local/lib/collectd"
TypesDB     "/share/util/usr/local/share/collectd/types.db"

#----------------------------------------------------------------------------#
# When enabled, plugins are loaded automatically with the default options    #
# when an appropriate <Plugin ...> block is encountered.                     #
# Disabled by default.                                                       #
#----------------------------------------------------------------------------#
#AutoLoadPlugin false

#----------------------------------------------------------------------------#
# When enabled, internal statistics are collected, using "collectd" as the   #
# plugin name.                                                               #
# Disabled by default.                                                       #
#----------------------------------------------------------------------------#
#CollectInternalStats false

#----------------------------------------------------------------------------#
# Interval at which to query values. This may be overwritten on a per-plugin #
# base by using the 'Interval' option of the LoadPlugin block:               #
#   <LoadPlugin foo>                                                         #
#       Interval 60                                                          #
#   </LoadPlugin>                                                            #
#----------------------------------------------------------------------------#
Interval     30

#MaxReadInterval 86400
#Timeout         2
#ReadThreads     5
#WriteThreads    5

# Limit the size of the write queue. Default is no limit. Setting up a limit is
# recommended for servers handling a high volume of traffic.
#WriteQueueLimitHigh 1000000
#WriteQueueLimitLow   800000

##############################################################################
# Logging                                                                    #
#----------------------------------------------------------------------------#
# Plugins which provide logging functions should be loaded first, so log     #
# messages generated when loading or configuring other plugins can be        #
# accessed.                                                                  #
##############################################################################

#LoadPlugin syslog
LoadPlugin logfile
##LoadPlugin log_logstash

<Plugin logfile>
        LogLevel debug
        File "/share/util/collectd.log"
        Timestamp true
        PrintSeverity true
</Plugin>

##############################################################################
# LoadPlugin section                                                         #
#----------------------------------------------------------------------------#
# Lines beginning with a single `#' belong to plugins which have been built  #
# but are disabled by default.                                               #
#                                                                            #
# Lines beginning with `##' belong to plugins which have not been built due  #
# to missing dependencies or because they have been deactivated explicitly.  #
##############################################################################

LoadPlugin cpu
LoadPlugin df
LoadPlugin disk
LoadPlugin interface
LoadPlugin load
LoadPlugin memcached
LoadPlugin memory
LoadPlugin network
LoadPlugin swap
LoadPlugin write_graphite
LoadPlugin zfs_arc

<Plugin cpu>
  ReportByCpu true
  ReportByState true
  ValuesPercentage false
  ReportNumCpu false
  ReportGuestState false
  SubtractGuestState true
</Plugin>

<Plugin network>
#       # client setup:
        Server "ff18::efc0:4a42" "25826"
        <Server "239.192.74.66" "25826">
#               SecurityLevel Encrypt
#               Username "user"
#               Password "secret"
#               Interface "eth0"
#               ResolveInterval 14400
        </Server>
#       TimeToLive 128
#
#       # server setup:
#       Listen "ff18::efc0:4a42" "25826"
#       <Listen "239.192.74.66" "25826">
#               SecurityLevel Sign
#               AuthFile "/etc/collectd/passwd"
#               Interface "eth0"
#       </Listen>
#       MaxPacketSize 1452
#
#       # proxy setup (client and server as above):
#       Forward true
#
#       # statistics about the network plugin itself
#       ReportStats false
#
#       # "garbage collection"
#       CacheFlush 1800
</Plugin>


<Plugin write_graphite>
  <Node "graphite">
    Host "GRAPHITEHOST.localdomain.com"
    Port "2003"
    Protocol "tcp"
    ReconnectInterval 0
    LogSendErrors true
    Prefix "qnap."
    Postfix ""
    StoreRates true
    AlwaysAppendDS false
    EscapeCharacter "_"
    SeparateInstances false
    PreserveSeparator false
    DropDuplicateFields false
    ReverseHost false
  </Node>
</Plugin>