Network

how to setup the Smokeping in Ubuntu 22.04

Network Management & Monitoring - Smokeping

Network Management & Monitoring - Smokeping - Part I

In this exercise you will install Smokeping and get it to monitor various devices in the class network.

Since most of the tasks in this exercise require you to be "root", the first thing you should do is to connect to your PC and start a root shell.

$ sudo -s
#

Install Smokeping (Example)

Smokeping is already installed on your host. If you wanted to install it here are the steps you would take:

# apt install smokeping
# chmod u+s /usr/bin/fping
# a2enmod cgi
# systemctl reload apache2

Initial Configuration

Let's make sure that your web server is running:

# systemctl start apache2

Let's make sure that Smokeping is running and will restart when your host is rebooted:

# systemctl enable smokeping
# systemctl start smokeping

Then point your web browser at

http://oob.hostX.campusY.ws.nsrc.org/smokeping/smokeping.cgi

(replace "hostX" and "campusY" with your own host) to check that it is running.

Now review the Smokeping configuration files:

# cd /etc/smokeping/config.d
# ls -l

-rwxr-xr-x 1 root root  578 2010-02-26 01:55 Alerts
-rwxr-xr-x 1 root root  237 2010-02-26 01:55 Database
-rwxr-xr-x 1 root root  413 2010-02-26 05:40 General
-rwxr-xr-x 1 root root  271 2010-02-26 01:55 pathnames
-rwxr-xr-x 1 root root  859 2010-02-26 01:55 Presentation
-rwxr-xr-x 1 root root  116 2010-02-26 01:55 Probes
-rwxr-xr-x 1 root root  155 2010-02-26 01:55 Slaves
-rwxr-xr-x 1 root root 8990 2010-02-26 06:30 Targets

The files that you'll need to change, at a minimum, are:

  • Alerts
  • General
  • Probes (to be done later)
  • Targets

Now open the General file (note the first capital letter)

# editor General

(you can replace "editor" with "nano" or "vi" if you like)

Change the following lines:

owner    = NOC
contact  = sysadm@localhost
mailhost = localhost
cgiurl   = http://localhost/smokeping/smokeping.cgi
# specify this to get syslog logging
syslogfacility = local5

Save the file and exit. Now let's restart the Smokeping service to verify that no mistakes have been made before going any further:

# systemctl restart smokeping

Now open the Alerts file (note the first capital letter)

# cd /etc/smokeping/config.d
# editor Alerts

Change the lines with "to" and "from" to the following:

to = sysadm@localhost
from = smokeping-alert@localhost

Save the file and exit. Restart Smokeping:

# systemctl restart smokeping

Configure monitoring of devices

The majority of your time and work configuring Smokeping will be done in the file /etc/smokeping/config.d/Targets.

For this class please do the following:

Use the default FPing probe to check:

  • Hosts in your campus
  • classroom NOC
  • switches
  • routers

You can use the classroom Network Diagram on the classroom wiki to figure out addresses for each item, etc.

Create some hierarchy to the Smokeping menu for your checks.

For example, the Targets file is already partially pre configured. To start we are going to add some entries to the Targets file.

Start with:

# cd /etc/smokeping/config.d
# editor Targets

You can take the section from *** Targets *** to the end of the LocalMachine and make it look something like this. Feel free to use your own "remark", "menu" text and titles.

Note that we remove the commented lines #parents = owner:/Test/James location:/, and the "Alerts" line.

NOTE: We strongly recommend that you COPY and PASTE text from these exercises directly in to the Targets file. Typing all this by hand will take too long.

*** Targets ***

probe = FPing

menu = Top
title = Network Latency Grapher
remark = Smokeping Latency Grapher for Network Monitoring \
         and Management Workshop.

+Local

menu = Local Network Monitoring and Management
title = Local Network

++LocalMachine

menu = Local Machine
title = This host
host = localhost

Now, below the "localhost" we start with the configuration of items for our class.

We will add in an entry for our classroom noc server (noc.ws.nsrc.org) and for all the hosts on your campus.

NOTE: Be sure that you replace "Y" with your campus number.

#
# ********* Classroom Servers **********
#

+NOCServers

menu = NOCServers
title = Network Management Servers

++noc

menu = noc
title = Workshop NOC
host = noc.ws.nsrc.org

#
# ******** Campus Y Hosts ***********
#

+CampusY

menu = Campus Y Hosts
title = Hosts in Campus Y

++srv1

menu = srv1
title = Campus Y Shared Server 1
host = srv1.campusY.ws.nsrc.org

++host1

menu = host1
title = Campus Y Server 1
host = host1.campusY.ws.nsrc.org

++host2

menu = host2
title = Campus Y Server 2
host = host2.campusY.ws.nsrc.org

++host3

menu = host3
title = Campus Y Server 3
host = host3.campusY.ws.nsrc.org

++host4

menu = host4
title = Campus Y Server 4
host = host4.campusY.ws.nsrc.org

++host5

menu = host5
title = Campus Y Server 5
host = host5.campusY.ws.nsrc.org

++host6

menu = host6
title = Campus Y Server 6
host = host6.campusY.ws.nsrc.org

(Note: the target hostnames are using DNS here. You could instead use IP addresses like 100.68.Y.X)

OK. Let's see if we can get Smokeping to stop and start with the changes we have made, so far. Save and exit from the Targets file. Now try doing:

# systemctl restart smokeping

If you see error messages, then read them closely and try to correct the problem in the Targets file. In addition, Smokeping is now sending log message to the file /var/log/syslog. You can view what Smokeping is saying by typing:

# tail -F /var/log/syslog

If you want to see all smokeping related messages in the file /var/log/syslog you can do this:

# grep smokeping /var/log/syslog

If there are no errors you can view the results of your changes by going to:

http://oob.hostX.campusY.ws.nsrc.org/smokeping/smokeping.cgi

Configure monitoring of routers and switches

Once you have configured the hosts on your campus, then it's time to add the entries for the routers and switches in your campus network.

# cd /etc/smokeping/config.d        (just to be sure :-))
# editor Targets

Go to the bottom of the file and add in entries for your campus routers and switches:

#
#******** Campus Y Network Devices ********
#

+campusYNetwork

menu = Campus Y Network Devices
title = Network Devices Campus Y

#
# ********** Campus Y Border Router *********
#

++border
menu = Border
title = Border Router

+++campusY
menu = campusY
title = Border Router Campus Y
host = bdr1.campusY.ws.nsrc.org


#
# ********** Campus Y Core Router *********
#

++core
menu = Core
title = Core Router

+++campusY
menu = campusY
title = Core Router Campus Y
host = core1.campusY.ws.nsrc.org

#
# ********** Campus Y switches *********
#

++switches
menu = Switches
title = Distribution Switches

+++building1
menu = campusY
title = Campus Y Building 1 Distribution Switch
host = dist1-b1.campusY.ws.nsrc.org

+++building2
menu = Campus Y
title = Campus Y Building 2 Distribution Switch
host = dist1-b2.campusY.ws.nsrc.org

Like we did above, let's see if the changes we have made are done correctly. Save your work and do:

# systemctl restart smokeping

If you see error messages, then read them closely and try to correct the problem in the Targets file. In addition, Smokeping is now sending log message to the file /var/log/syslog. You can view what Smokeping is saying by typing:

# tail -F /var/log/syslog

If you want to see all smokeping related messages in the file /var/log/syslog you can do this:

# grep smokeping /var/log/syslog

If there are no errors you can view the results of your changes by going to:

http://oob.hostX.campusY.ws.nsrc.org/smokeping/smokeping.cgi

You can now start the second set of exercises.