Monitoring additional servers

Exclusive offer: get 50% off this eBook here
Instant Munin Plugin Starter [Instant]

Instant Munin Plugin Starter [Instant] — Save 50%

Write custom scripts to monitor, analyze, and optimize any device in your network with this booka and ebook

$14.99    $7.50
by Bart ten Brinke | August 2013 | Networking & Telephony Open Source

In this article, by Bart ten Brinke, author of Instant Munin Plugin Starter, we will take a look at the first step in expanding your munin cluster will be monitoring another server. Once you know how to add one server, you will be able to add all of them! We will do this in four simple steps.

(For more resources related to this topic, see here.)

Step 1 – Installing munin-node

First we need to connect to the server we want to monitor and install munin-node. In our examples, we will be using the name muninnode as the name of our additional server. Your server will probably have a different name, so every time you see muninnode in an example, you should replace that with the name of the server you are using. Examples will also use the term username, which you should replace with your username. But first, let's install munin-node.

For Debian or Ubuntu, use the following commands:

ssh username@muninnode
sudo apt-get install munin-node

For Red Hat or Fedora, use:

ssh username@muninnode
sudo yum install munin-node

Next, we will take a look at the generated configuration file. It is located at /etc/munin/ munin-node.conf. Please open it up in your favorite editor.

The first thing we have to take care of is the fact that we want our master to be able to connect to this node. For security reasons, munin-node defaults to allowing only connections from the localhost to query its data. So, let's scroll down to the allow section and add a line beneath it.

If your master has a static IP address, please enter it in the allow section in the following format:

allow 10.0.0.200

This will grant the master at 10.0.0.200 access to the data of this node.

If your server has a dynamic IP or you want to trust your entire network range, you can either add a single line for every possible IP addresses or use a cidr_allow section. Please note that you can only use this if you have the Net::CIDR Perl module installed. Most systems will have this by default, but if you are having problems, you should check that.

cidr_allow 10.0.0.0/24

This will grant anyone connecting from any IP from 10.0.0.0 to 10.0.0.255 to fetch all the information available in this node.

After you have done this, you need to save the file and restart the munin-node daemon.

For older versions of Debian or Ubuntu, use the following command:

sudo invoke-rc.d munin-node restart

For Debian or Ubuntu and Red Hat or Fedora, use:

sudo service munin-node restart

Step 2 – Testing your munin-node installation

Now that we have installed the node, it is a good idea to check if it functions correctly. We will do this by connecting to the node and fetching some information.

ssh username@muninnode
telnet localhost 4949
version
list
quit

You should get the following output:


ssh username@muninnode

Welcome to muninnode

username@muninnode:~$ telnet muninnode 4949
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.

# munin node at muninnode.
version
munins node on muninnode. version: 2.0.9-2

list
cpu df df_inode entropy forks fw_packets http_loadtime if_err_eth0
if_eth0 interrupts iostat iostat_ios irqstats load memory
munin_stats ntp_kernel_err ntp_kernel_pll_freq ntp_kernel_pll_off
ntp_offset open_files open_inodes proc_pri processes sensors swap
threads uptime users vmstat
quit
Connection closed by foreign host.

username@muninnode:~$

Please note that the node might be a bit impatient with you. If you connect to it using Telnet and then give no further instructions for a few seconds, munin-node will automatically disconnect you, thinking you are just wasting it's time. If this happens, just go ahead and try again.

Now that we know that munin-node is running, we want to make sure it is functioning correctly. Munin-node keeps its log file at /var/log/munin/munin-node.log. Let's take a look at that.

ssh username@muninnode
tail /var/log/munin/munin.log

You should be able to see your connection attempt in the log; it should look something like the following:

2013/01/01-12:30:10 CONNECT TCP Peer: "127.0.0.1:44363" Local: \
"127.0.0.1:4949"

If you have a node that is experiencing problems with connections or a plugin, make sure to look at this log file for exceptions or error messages.

Step 3 – Installing additional plugins

When munin-node was installed, it ran its autodetect script to enable plugins from its standard library if they were applicable to your system. If you have installed new software on this machine, you can easily re-run this script to see if Munin can help you monitor the new software. If you, for example, have installed MySQL or PostgreSQL, then this is what you do:

ssh username@muninnode
sudo munin-node-configure --suggest
sudo munin-node-configure --shell

The first command will show you all the plugins your munin-node has out of the box and whether they apply to your system. The second command will display the commands you will have to execute to create the symbolic links in order to enable those suggestions. Please note that not all plugins support this, and therefore, not all applicable plugins will automatically be enabled.

Munin-node has to be restarted after you've added new plugins; otherwise, these changes will not take effect.

Step 4 – Adding the new node to the master

Now that we've completely configured the node and tested to see if it works, we are ready to add the node to our master. To do this, we have to go to our master and test whether we can connect back to our munin-node.

ssh username@muninmaster
telnet 4949 muninnode
version
list
quit

This should display the version and the capabilities of the munin-node running on the muninnode server. If this does not work, make sure you have started the munin-node on the muninnode server and also check whether firewalls allow you to connect to it on port 4949. Also go ahead and recheck the allowed IP addresses in the munin-node configuration as mentioned in step 2.

If this is working correctly, go ahead and open up the file at /etc/munin/munin.conf. Here, we scroll down until we see the following host tree:

# a simple host tree
[localhost.localdomain]
address 127.0.0.1
use_node_name yes

We need to add our new munin-node to this host tree as follows:

# the host tree of our local network
[localhost.localdomain]
address 127.0.0.1
use_node_name yes
[muninnode.localdomain]
address 10.0.0.200
use_node_name yes

Now, we'll have to wait at least 10 minutes before we will be able to see our new node on the Munin master's website. Go ahead and point your browser to your Munin master at http: //localhost/munin or at http://your_munin_master/munin; you should see something like the following screenshot:

After a couple of minutes, you should be able to see graphs for your node and even compare the nodes of your cluster side by side.

Troubleshooting

Now it could very well be possible that it isn't working for you. Here are the few steps you should check first:

  • Check the Munin master log at /var/log/munin/munin.log for errors.

  • Check the Munin node log at /var/log/munin/munin-node.log on the munin server for access calls and errors.

  • Try to connect from your Munin master to your node using Telnet 4949.

  • If you can connect, type nodes and check whether the name of your node is there.

  • Still in Telnet, type list munninnode.localdomain and check whether you get a list of plugins. If not, add your hostname to /etc/munin/munin-node.conf (see the Munin node configuration section).

Summary

We looked at the first step in expanding your munin cluster. Once you know how to add one server, you will be able to add all of them!

Resources for Article :


Further resources on this subject:


Instant Munin Plugin Starter [Instant] Write custom scripts to monitor, analyze, and optimize any device in your network with this booka and ebook
Published: February 2013
eBook Price: $14.99
See more
Select your format and quantity:

About the Author :


Bart ten Brinke

Bart ten Brinke is an experienced product developer; he has been building web applications for over six years, mainly focusing on Ruby on Rails. In 2012, he started his own company called Retrosync. Retrosync focuses on the three major pillars of web application development—security, scalability, and usability.

Prior to Retrosync, Bart worked at Nedap Healthcare as a product developer and security officer. Here he developed a web-based planning solution that is now used by a majority of the Dutch home care sector.

Bart holds a Masters title in Information Technology and a Minor in Biomedical Engineering, both from the University of Twente in the Netherlands. He is also a Certified Information Systems Security Professional (CISSP).

Books From Packt


Instant OpenNMS Starter [Instant]
Instant OpenNMS Starter [Instant]

Zenoss Core Network and System Monitoring
Zenoss Core Network and System Monitoring

 Cacti 0.8 Network Monitoring
Cacti 0.8 Network Monitoring

Zenoss Core 3.x Network and System Monitoring
Zenoss Core 3.x Network and System Monitoring

 Tcl 8.5 Network Programming
Tcl 8.5 Network Programming

 Zabbix 1.8 Network Monitoring
Zabbix 1.8 Network Monitoring

Learning Nagios 3.0
Learning Nagios 3.0

Instant Node.js Starter [Instant]
Instant Nagios Starter [Instant]


Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Resources
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software