Hello, and welcome to this Pluralsight presentation.
My name is Andrew Mallett,
and I'm going to be your instructor as we help guide you through the module
where we take a look at troubleshooting memory and CPU issues.
Now, of course, as we go through this module,
we're going to be looking at those components of our Linux systems,
so CPU and memory, and we're going to be working on our Ubuntu 2004 system.
As we go through, we can be taking a look at monitoring our processes,
and we can include things like runaway processes where perhaps
a service starts up and many sub processes are being created
that are consuming our resources.
We'll also go through and take a look at zombies.
Now zombies are always going to be fun.
Don't we love a zombie movie,
but we'll understand that actually zombies are quite normal,
but we shouldn't be seeing them, but they are a normal process,
and we'll see how and why they are created.
We'll also then take a look at how we can manage our process
utilization looking at our high load average,
looking at our run queues,
and taking a look at some of the utilities that we can
use to monitor this information.
We can then move on to monitoring our memory and that
includes managing our swap space,
and we're going to be able to find that we are able to go
through and set up our virtual memory, maybe on multiple devices,
but configure a priority.
So we've got faster devices like solid state drives,
they can be used as a priority over our spinning disk,
which of course, are going to be slower.
We'll also see how we can manage our memory exhaustion
or where we get out of memory events.
To begin with though, we're going to add in an extra utility.
Sysstat, once we've installed it,
is going to give us historical monitoring so we can go back and look at
our performance information over a period of time.
Without it, we are able to see things like our load averages for our CPU,
but only over the last few minutes.
We won't be able to see what's been happening over
a period of hours or even days.
So by installing sysstat, we collect performance information every 10 minutes,
and that's then managed on Ubuntu 2004 through cron and the
sysstat file that is added to our cron.d directory.
Now it seems to me that it's about time that we
looked at some of this in action, and by installing sysstat early,
we're able to collect our historical data and refer to it as we
go through looking at our individual modules.
So to begin with, we're going to install sysstat,
and we'll be able to see then that once we have got it installed,
we'll start collecting information on that 10‑minute interval.
Now when we say it's a demonstration,
what we really mean is this is really your learning opportunity,
so I do encourage you to join me at the command line.
And would you take a look at this,
the glorious command line environment of our Ubuntu 2004 system.
Now we want to be able to install sysstat so we can
start collecting our performance data.
So we're going to go through and run our sudo apt install
‑y and remember then our package name,
but don't forget the double s in the middle,
it's easy to overlook that.
Let's go through then and install this.
It won't take long, but once we have got this installed,
we do need to go through and start our services.
Very often on an Ubuntu‑based system, we don't need to start our services,
with sysstat, we do.
So we can go through and use our sudo systemctl
enable ‑‑now and then sysstat again,
that double s can catch you out in the middle so be good on that.
Now with that up and running,
we should be able to go through and look at our systemctl and status of sysstat.
So we can see now that that is up and running and enabled,
but we also need to make sure that it is scheduled to run.
So we can go ahead and cat out our etc and cron.d directory and there will be
a file called sysstat that is being placed inside of that,
and when we dig inside of that file,
we can see then that our activity reports our every 10 minutes of
every day of every week of every month of every year.
We can see this every 10 minutes when we look at the cron
entry and it starts at 5 past the hour and continues until
55 minutes after the hour.
So that collects our main activity report,
which is the performance information that we're really going to be looking at,
but additionally, we can see just before midnight,
23:59, we're rotating our statistics file.
So we're going to have a new file for every day of the month
so we're able to go back and see the last 30 days of
information if we like for the last month.
Now the very final part of our configuration,
and it's important not to forget this,
is to make sure that data collection is enabled. By default,
even with all of this that we see before us,
the collectors are looking for a variable,
and we can go through and edit so sudo and vim or nano if you prefer,
/etc/default and then our sysstat file.
We can drop down to the bottom and we can see that we need to go
through and enable and have this set up for true.
With this done, then everything is configured, and we will be collecting data.
Now we don't have to worry about collecting our data just at the moment.
The idea is that we're installing it at this early stage so
when we start monitoring each of our elements,
we're going to be able to monitor it in real time,
as well as then looking at historical data so we can see data
that's been collected over the period of time that we've had
our sysstat collection running.
So we're not going to look at any details of this at the moment.
The details are going to come when we start monitoring each of
our elements and that's both in this module, as well as subsequent modules.