Configure Collectd as a Central Monitoring Server for Clients

This tutorial will focus on how you can enable the networking plugin for Collectd daemon in order to act as a central monitoring server for other Collectd clients installed on various servers over you network.

Configure Collectd as Central Linux Monitoring Server

Configure Collectd as Central Linux Monitoring Server

The requirements for this setup is to configure one Collectd daemon (with Collectd-web interface) on a host over your premises which will be activated to run in server mode providing a central point of monitoring. The rest of the monitored hosts, which run Collectd daemon, should only be configured in client mode in order to send all their collected statistics to the central unit.

Requirements

  1. Install Collectd and Collectd-Web to Monitor Linux Servers

Step 1: Enable Collectd Server Mode

1. Assuming that Collectd daemon and Collectd-web interface are already installed on your machine that will act as a server, the first step that you’ll need to take care of is to assure that the system time is synchronized with a time server in your proximity.

To achieve this goal you can install the the ntp server on your machine, or, a more convenient method would be to synchronize system time regularly by executing the ntpdate command from cron against a local time server or a public time server near your premises by consulting the http://pool.ntp.org website for available ntp servers.

So, install ntpdate command, if is not already present on your system, and do a time syncing with the closest time server by issuing the following commands:

# apt-get install ntpdate		[On Debain based Systems]
# yum install ntpdate			[On RedHat based Systems]
OR
# dnf install ntpdate			
# ntpdate 0.ro.pool.ntp.org

Note: Replace the ntp server URL accordingly in the above command.

Install Ntpdate and Time Synchronize

Install Ntpdate and Time Synchronize

2. Next, add the above time sync command to the crontab daemon root file in order to be scheduled daily at midnight by issuing the below command:

# crontab -e

3. Once the root crontab file is opened for editing, add the following line at the bottom of the file, save it and exit, in order to activate the schedule:

@daily ntpdate 0.ro.pool.ntp.org   
Linux Server Time Synchronization

Linux Server Time Synchronization

Note: Repeat this steps concerning time synchronizing on all the feature Collectd client instances present in your network in order to have all their system time aligned with a central time server.

Step 2: Configure Collectd in Server Mode on the Central Monitoring System

4. In order to run Collectd daemon as a server and gather all the statistics from collectd clients, you need to enable the Network plugin.

The role of the Network plugin is to listen for connections on default 25826/UDP port and receive data from client instances. So, open the main collectd configuration file for editing and uncomment the following statements:

# nano /etc/collectd/collectd.conf
OR
# nano /etc/collectd.conf

Search and uncomment the statements as below:

LoadPlugin logfile
LoadPlugin syslog

<Plugin logfile>
       LogLevel "info"
       File STDOUT
       Timestamp true
       PrintSeverity false
</Plugin>

<Plugin syslog>
        LogLevel info
</Plugin>

LoadPlugin network
Configure Collectd

Configure Collectd

Configure Collectd Network Plugin

Configure Collectd Network Plugin

Now, search deeply on file content, identify the Network plugin block and uncomment the following statements, replacing the Listen address statement as presented on the following excerpt:

<Plugin network>
...
# server setup:
      <Listen "0.0.0.0" "25826">
       </Listen>
....
</Plugin>
Enable Network for Collectd

Enable Network for Collectd

5. After you’re done editing the file, save it and close it and restart Collectd service to reflect changes and become a server listening on all network interfaces. Use the netstat command to get Collectd network socket output.

# service collectd restart
or
# systemctl restart collectd   [For systemd init services]
# netstat –tulpn| grep collectd
Confirm Collectd Network

Confirm Collectd Network

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

Matei Cezar

I'am a computer addicted guy, a fan of open source and linux based system software, have about 4 years experience with Linux distributions desktop, servers and bash scripting.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

3 Responses

  1. Matei Cezar says:

    Thresholds must be configured on client side, because the data can differ from one client to another. Consult collectd docs for more. https://collectd.org/documentation/manpages/collectd-threshold.5.shtml

  2. Matei Cezar says:

    Thresholds must be configured on client side, because the data can differ from one to another. Consult collectd docs for more. https://collectd.org/documentation/manpages/collectd-threshold.5.shtml

  3. Yash Acharya says:

    Hi,

    Just had a small query since i am setting up a client server architecture for collectd, is it possible that for all the clients my thresholds are set on the server side?

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.