Fork me on GitHub
Monitorix logo
Celebrating 15 years :: 2005-2020
Welcome to the Monitorix project
Take control over your small server

Installing Monitorix 3.4.0 on a FreeBSD 10-STABLE/amd64 with built-in HTTP server

Many thanks to Darryl Yeoh Gim Hong for sending me the following HOWTO:

#
# Installing Monitorix 3.4.0 on FreeBSD 10-STABLE/amd64 with built-in HTTP server.
#
# Main Webpage: https://www.monitorix.org/
# Documentation: https://www.monitorix.org/documentation.html
#
# Guide written by Darryl Yeoh <drl@bsd.my>
#
# NOTE: This howto is in no way perfect. It was written as I installed the latest release of Monitorix on a freshly
# updated FreeBSD 10-STABLE system. If you get into trouble while following this guide, feel free to drop me a mail
# and I will update this guide again.
#
# $LOG_FILE = '/var/log/monitorix, /var/log/monitorix-httpd' <- This would be the 1st place to look at if you run into trouble.


# NOTES

A cool new feature in Monitorix 3.0.0 and above is it's own built-in HTTP server. This makes the setup much easier.
You only need to install the Monitorix port and that's it.

I'm installing this on a mail server running Postfix. My setup will only be monitoring the following:-

 - Users
 - Network
 - Postfix

If you are monitoring other services, just enable/disable what you want to monitor in the configuration file.


# PREPERATION

Prepare a subdomain dedicated to Monitorix. I will be using http://monitorix.example.com/ in this guide.


# PORTS TREE

On FreeBSD 10, the ports system has changed quite abit. It is recommended to use Subversion to update your ports tree.
Do that first before anything else. A custom version of Subversion is already in the FreeBSD base system called 'svnlite'.
It's usage is similar to the normal Subversion you install from ports.

When installing the ports, choose the default options for each port as it prompts you.(The window with the blue screen)
I've choosen to deselect the options EXAMPLES and DOCS for the port(s) that have it.


NOTE: The steps below needs to be run as the user root. Either 'su -' or 'sudo -s' to switch to root.


# BEGIN

1. Install axel
  cd /usr/ports/ftp/axel
  make install clean

2. Configure /etc/make.conf
  
  SVN=/usr/bin/svnlite
  SVN_UPDATE=yes
  #
  # Replace fetch(1) with axel(1) <- Optional
  FETCH_CMD=axel
  FETCH_BEFORE_ARGS= -n 3 -a
  DISABLE_SIZE=yes

3. Update ports tree
  cd /usr/ports
  svnlite up

4. Install Monitorix
  cd /usr/ports/sysutils/monitorix
  make install clean

5. Install pflogsumm (For Postfix MTA)
  cd /usr/ports/mail/pflogsumm
  make install clean


6. Edit /usr/local/etc/monitorix.conf
  These are the only things that I changed:-

    title = Monitorix - monitorix.example.com
    hostname = monitorix.example.com
    show_gaps = y
    
    <httpd_builtin>
	enabled = y
	host = 10.0.0.100
	port = 8181
	user = www
	group = www
	log_file = /var/log/monitorix-httpd.log
	hosts_deny = all
	hosts_allow = 192.168.1.0/24,10.0.0.0/8,202.1.2.3
    </httpd_builtin>

    <...>

    # This is where you enable or disable the services you want to monitor. The boolean is y/n.
    <graph_enable>
	system          = n                                                                                                                                                     
	kern            = n                                                                                                                                                     
	proc            = n                                                                                                                                                     
	hptemp          = n                                                                                                                                                     
	lmsens          = n                                                                                                                                                     
	nvidia          = n                                                                                                                                                     
	disk            = n                                                                                                                                                     
	fs              = n                                                                                                                                                     
	net             = y                                                                                                                                                     
	serv            = n                                                                                                                                                     
	mail            = y                                                                                                                                                     
	port            = n                                                                                                                                                     
	user            = y                                                                                                                                                     
	ftp             = n                                                                                                                                                     
	apache          = n                                                                                                                                                     
	nginx           = n                                                                                                                                                     
	lighttpd        = n                                                                                                                                                     
	mysql           = n                                                                                                                                                     
	squid           = n                                                                                                                                                     
	nfss            = n                                                                                                                                                     
	nfsc            = n                                                                                                                                                     
	bind            = n                                                                                                                                                     
	ntp             = n                                                                                                                                                     
	fail2ban        = n                                                                                                                                                     
	icecast         = n                                                                                                                                                     
	raspberrypi     = n                                                                                                                                                     
	phpapc          = n                                                                                                                                                     
	memcached       = n                                                                                                                                                     
	wowza           = n                                                                                                                                                     
	int             = n                                                                                                                                                     
    </graph_enable>

    <...>

    # Email Reports - Daily reports only. Rest disabled.
    # --------------------------------------------------
    <emailreports>
    enabled = y
    url_prefix = http://monitorix.example.com:8181
    smtp_hostname = localhost
    from_address = root@localhost
    <daily>
      enabled = y
      graphs = mail, user
      to = user1@email.com,user2@email.com,group@email.com
    </daily>
    <...>
    </emailreports>
    

7. Edit /etc/rc.conf
  monitorix_enable="YES"

8. Start Monitorix
  /usr/local/etc/rc.d/monitorix start

9. Check that Monitorix is running
  ps aux | egrep monitorix

10. Open your browser and goto > http://monitorix.example.com:8181

Click on the 'OK' button and you should start seeing your graphs. Page will auto refresh every 150s by default.


# ERRORS

While looking at the logfile (/var/log/monitorix), I came across an error saying permission denied about pangorc. This is how I fixed it:

  # mkdir -p /root/.config/pango
  # chmod 0755 /root/.config
  # cat << _EOF > /root/.config/pango/pangorc
    [Pango]
    ModulesFiles = /usr/local/etc/pango/pango.modules
    _EOF
  # /usr/local/etc/rc.d/monitorix restart

Look at the logfile again while refreshing the page. You should not see pango related errors again.


# END