TEC-DATA82-07 · Lesson 6 · 14 clock hours · lab
Service Management, Logging, and System Monitoring
Objective. Students will start, stop, restart, enable, and disable system services with systemctl, interpret service status output, query the system journal with journalctl, and locate relevant entries in /var/log to diagnose a simulated service failure.
⚠ Pending professional review
This lesson, its worked examples and its practice questions has not yet been verified by an industry-certified professional or by a certification or approval body. It is a study draft and may contain errors. Do not use it as instructions for work on a job site or on live equipment. Always follow your instructor, your supervising professional, and current official references and regulations.
VoTechWorks program approval and accreditation are still in progress. Credentials are issued only by the certifying bodies named in each program, after their own exams.
Service Management, Logging, and System Monitoring
In a data center, Linux servers run critical services around the clock. Knowing how to start, stop, and diagnose those services — and how to read the logs that explain what went wrong — is a core daily skill for every data center technician.
systemd and systemctl
Most modern Linux distributions (RHEL, CentOS, Debian, Ubuntu) use systemd as their init system. systemd is the first process started by the kernel (PID 1) and is responsible for bringing up all other services in a defined order.
You interact with systemd through the systemctl command. The table below covers the essential subcommands:
| Command | What it does |
|---|---|
| `systemctl status sshd` | Shows current state of the SSH daemon |
| `systemctl start sshd` | Starts the service immediately |
| `systemctl stop sshd` | Stops the service immediately |
| `systemctl restart sshd` | Stops then starts the service |
| `systemctl enable sshd` | Marks the service to start at boot |
| `systemctl disable sshd` | Prevents the service from starting at boot |
When you run `systemctl status sshd`, the output contains three fields you must be able to read:
- Loaded — whether the unit file was found and parsed, and whether it is enabled or disabled for boot.
- Active — the live runtime state: `active (running)`, `inactive (dead)`, `failed`, or `activating`.
- Main PID — the process ID of the service's primary process. If the service is stopped, no PID is shown.
A service can be enabled (starts at boot) but currently inactive, or active (running right now) but disabled (will not survive a reboot). These are independent states — keep that distinction clear.
The System Journal and journalctl
systemd records every service's standard output, standard error, and kernel messages in a structured binary database called the journal. You query it with journalctl.
Useful journalctl options:
- `journalctl -u sshd` — show all journal entries for the sshd unit.
- `journalctl -u sshd -n 50` — show the last 50 lines for sshd.
- `journalctl -u sshd --since "10 minutes ago"` — time-bounded query.
- `journalctl -xe` — show the most recent entries with context; especially useful right after a failure.
The journal is your first stop when a service shows `failed` status. Look for lines containing `error`, `failed`, `permission denied`, or specific port/address conflicts.
Traditional Log Files in /var/log
Before systemd, services wrote logs directly to text files under /var/log. Many services still do both. Key files for a data center technician:
- /var/log/auth.log (Debian/Ubuntu) or /var/log/secure (RHEL/CentOS) — authentication events, SSH login attempts, sudo usage.
- /var/log/syslog (Debian/Ubuntu) or /var/log/messages (RHEL/CentOS) — general system messages.
- /var/log/kern.log — kernel messages.
Use `grep`, `tail -f`, or `less` to search and follow these files. For example: `grep sshd /var/log/auth.log | tail -20` narrows results quickly during an incident.
Diagnosing a Simulated Service Failure
A common real-world scenario: someone edits `/etc/ssh/sshd_config` and enters an invalid port number or a syntax error. sshd then refuses to start. Your diagnostic workflow:
1. Run `systemctl status sshd` — note `failed` or `inactive (dead)`.
2. Run `journalctl -u sshd -n 30` — look for the specific error message (e.g., `Invalid port` or `error: Bind to port`).
3. Check `/var/log/auth.log` or `/var/log/secure` for corroborating entries.
4. Open the configuration file with a text editor (as root or with sudo), correct the error, and save.
5. Run `systemctl restart sshd` and verify with `systemctl status sshd` that it returns `active (running)`.
6. Document every step in your incident note: time, symptom, root cause, corrective action, verification.
Basic System Monitoring Tools
Before escalating a ticket or opening a change request, a technician takes a snapshot of server health using standard command-line tools:
- top — real-time view of CPU usage, memory, load average, and the top processes consuming resources. Press `q` to quit.
- htop — an enhanced, color-coded version of top; easier to read at a glance (may need to be installed).
- df -h — disk filesystem usage in human-readable form. Flag any filesystem above 80% used as a warning threshold in most data center operations policies.
- free -m — RAM and swap usage in megabytes. High swap usage alongside low free RAM indicates memory pressure.
- uptime — shows how long the server has been running and the load averages for the past 1, 5, and 15 minutes. A load average consistently above the number of CPU cores is a performance concern.
Safety Notes
While this lesson is software-focused, physical safety still applies in the data center:
- Never open a server chassis to reseat hardware without following your site's lockout/tagout (LOTO) procedure and wearing appropriate PPE — even a software service call can turn into a hardware swap.
- Maintain proper cable management when working at a rack; a trip hazard from a loose cable is an OSHA recordable incident.
- Always confirm with your supervisor before restarting a production service — a restart that takes a service offline for even seconds can affect business operations.
Key terms8
systemdThe init system and service manager used by most modern Linux distributions; it starts as PID 1 and manages all other system services and their dependencies.
systemctlThe command-line tool used to start, stop, restart, enable, disable, and inspect the status of systemd-managed services.
unit fileA configuration file read by systemd that defines how a service should be started, stopped, and supervised; stored in directories such as /lib/systemd/system/.
journalctlThe command used to query the systemd journal, a structured binary log of all service output and kernel messages collected since the journal was initialized.
Active stateThe live runtime state of a systemd service shown in systemctl status output; common values are active (running), inactive (dead), and failed.
load averageA measure of the average number of processes waiting for CPU time over the past 1, 5, and 15 minutes; a sustained average above the number of CPU cores signals a performance issue.
/var/log/auth.logA text log file on Debian/Ubuntu systems that records authentication events including SSH logins, failed password attempts, and sudo usage; called /var/log/secure on RHEL/CentOS.
enable / disable (systemctl)systemctl subcommands that control whether a service is configured to start automatically at boot, independent of whether the service is currently running.
In class: systemd deep-dive lab: students run systemctl status, start, stop, restart, enable, and disable on the sshd and cron services; they capture the before-and-after output in their lab log and annotate what each state field (Active, Loaded, Main PID) means. · Simulated service-failure diagnosis: instructor intentionally breaks the sshd configuration (incorrect port entry in sshd_config) on a lab server; students must detect the failure with systemctl status sshd, trace the error in journalctl -u sshd and /var/log/auth.log or /var/log/secure, identify the misconfiguration, correct it, and restore the service — all documented in a structured incident note. · Monitoring tools introduction: students run top, htop, df -h, free -m, and uptime to capture a snapshot of server resource utilization, then record the results in a table and flag any metric that would trigger an alert in a real data center environment (e.g., disk above 80% full, load average above CPU count).
Materials: Lab servers; systemctl and journalctl man pages; CompTIA Server+ Study Guide (server monitoring and troubleshooting chapter); CNet CDCTP learner handbook (operational procedures section); incident-note template; lab log notebooks.
Check: Instructor reviews incident note for correct root-cause identification, corrective action, and restored service; resource-utilization table is checked for correct values and threshold annotations. Pass mark: service restored with correct configuration, incident note complete with root cause and fix, and resource table with at least one correctly flagged threshold (all three elements required to pass).
Practice check8
Answer each question, then check it. Nothing is recorded; this is your own practice.
Record this lesson on my transcript. Sign in with your key and enrollment email to record lessons (enroll free if you have no key). This page stays open to read and practise.