How to install Cacti with Nginx

Cacti

Cacti provides an exceptionally easy to use system monitoring solution.  Essential graphs are included by default, such as load average and memory usage.  For additional graphs, download templates from Cacti’s website/forum or create your own.

 

This tutorial assumes MySQL and Nginx have been installed.

Step 1 – Install SNMPD

Step 2 – Configure SNMPD

Edit  /etc/default/snmpd, find the following line:

Replace it with:

Then add the following line to the ACCESS CONTROL area of  /etc/snmp/snmpd.conf:

Step 3 – Download non-free MIB files

Step 4 – Install Cacti and Spine (Cacti poller)

During the installation of Cacti, you will be asked if you’d like dbconfig-common to setup MySQL for Cacti automatically.  This creates a user and database for Cacti, and then imports the necessary data.  If dbconfig-common is unable to configure the database, or you decline to use it, visit this guide for help setting up MySQL on your own.

Step 5 – Add a symbolic link to Cacti’s web interface

Choose a location to access Cacti from, such as  /cacti or  /stats and create a symbolic link with that name.

  • Line 1: Change directory to the root of our site
  • Line 2: Create a symbolic link to Cacti’s web interface named cacti
  • Line 3: Optional Change owner and group of Cacti’s web interface to www-data

Step 6 – Finish configuration via Cacti’s web interface

Visit your Cacti installation with your browser of choice.  Log in to the default administrator account:

  • Username: admin
  • Password: admin

Click Settings in the menu on the left.  Verify each page of settings are correct, then visit this guide for more information on creating your first graphs.

How to install a mail server (postfix) supporting IMAP and POP3 (Ubuntu)

Step 1 – Create mail.yourdomain.com

Add an MX record to your DNS using the following parameters:

  • Hostnamemail
  • Priority10

 

Step 2 – Install and configure postfix

Don’t enter anything during the installation.  In the next step we will be configuring postfix more precisely, and any configuration set now will be overwritten.

 

Reference my configuration if you aren’t sure what to enter:

  • General type of mail configurationInternet site
  • System mail namemail.notblog.org
  • Root and postmaster recipient: notblog  (Your sudo-privileged account, not root)
  • Other destinations to accept mail forlocalhost, mail.notblog.org, notblog.org
  • Force synchronous updates on mail queue?No
  • Local networks:  127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
  • Mailbox size limit
  • Local address extension character+
  • Internet protocols to useall

 

Step 3 – Change spool format to Maildir

 

Step 4 – Install IMAP and POP3 support

Answer No when asked about setting up a web interface.  There are much better alternatives to using courier for web mail.  I recommend roundcube.  Check back soon for a guide on using web mail.

 

Step 5 – Add aliases for multiple domains and mail accounts

This step is optional.  Following it will allow you to:

  • Handle mail for multiple domains with a single mail server.
  • Forward multiple mailboxes (webmaster, sysadmin, etc.) to a single mailbox.

 

  •  Line 1: Enter the domain name this mail server will be used for as well as any other domains hosted on this machine.  This will allow you to configure all of the domains to send mail to a single account.  Separate the domains with spaces.  If you aren’t using any other domains, enter the main domain only.
  • Line 2: This points postfix to the alias map at  /etc/postfix/virtual which we will be creating in the next step.  This file will describe where to forward mail sent to certain domains and/or mailboxes.

 

Write the following to /etc/postfix/virtual, adding domains and mailboxes you’d like to be forwarded:

 

Then run  postmap to optimize the alias map.  Postfix will read the file much more quickly if this step is taken.

 

Step 6 – Install dovecot

 

Step 7 – Restart postfix

How to monitor bandwidth usage with web-based (HTML) status reports

Example report

BandwidthD renders great bandwidth usage reports and is a breeze to install.

Step 1 – Install bandwidthd to monitor bandwidth usage

You most likely won’t need to enter any custom configuration values during installation.  Just make sure the interface to monitor is properly set, usually eth0.

Step 2 – Set up reverse DNS

By following this step your machine’s hostname will be displayed in the reports.  Without this step, only an IP address will be displayed.  Add a line to  /etc/hosts, consisting of your machine’s public IP address and its hostname.

 

Step 3 – Create symbolic link to status report directory

Bandwidthd writes its reports to  /var/lib/bandwidthd/htdocs/ by default.  We can easily serve these reports from a website by creating a symbolic link.

In this example, reports would be served at  http://notblog.org/bwstats/