# LIBRENMS NETWORK MONITORING LAB

Setup and Task Instructions

## Prerequisites

- Docker Desktop installed and running.
- Docker Compose installed.
- Python 3 installed.
- Extract the supplied ZIP file.
- Open PowerShell inside the project folder containing `docker-compose.yml`.

## 1. SETUP

Step 1: Build and start all services.

```
docker-compose up -d --build
```

Step 2: Verify containers.

```
docker-compose ps
```

Step 3: Open LibreNMS.

`http://localhost:8000`

Log in using the provided credentials.

## 2. TASK 1 — VERIFY / DISCOVER SNMP DEVICE

LibreNMS steps:

1. Navigate to Devices.
2. Check whether `snmp-device` is listed.
3. If not, click Add Device and enter:
   - Hostname: `snmp-device`
   - SNMP Version: `v2c`
   - Community: `public`
   - Port: `161`
4. Add the device.

Verify SNMP communication:

```
docker-compose exec librenms snmpwalk -v2c -c public snmp-device 1.3.6.1.2.1.1
```

Expected output includes system description, hostname, uptime, contact and location.

## 3. TASK 2 — INTERFACE MONITORING

LibreNMS steps:

1. Go to Devices → snmp-device.
2. Device Overview: Check device status and uptime.
3. Open Ports: View discovered interfaces and operational status.
4. Select an interface to view traffic graphs and details.

PowerShell commands:

Interface names:

```
docker-compose exec librenms snmpwalk -v2c -c public snmp-device 1.3.6.1.2.1.2.2.1.2
```

Interface operational status (1 = up, 2 = down):

```
docker-compose exec librenms snmpwalk -v2c -c public snmp-device 1.3.6.1.2.1.2.2.1.8
```

Interface speed:

```
docker-compose exec librenms snmpwalk -v2c -c public snmp-device 1.3.6.1.2.1.2.2.1.5
```

Device uptime:

```
docker-compose exec librenms snmpwalk -v2c -c public snmp-device 1.3.6.1.2.1.1.3
```

Incoming traffic counters:

```
docker-compose exec librenms snmpwalk -v2c -c public snmp-device 1.3.6.1.2.1.2.2.1.10
```

Outgoing traffic counters:

```
docker-compose exec librenms snmpwalk -v2c -c public snmp-device 1.3.6.1.2.1.2.2.1.16
```

## 4. TASK 3 — ANALYSE TRAFFIC AND ERROR COUNTERS

The project already contains `analyze.py` and `interface_traffic.csv`.

Run:

```
python analyze.py
```

Review the output for:

- Peak interface utilization and its timestamp.
- Incoming and outgoing errors.
- Error rate.
- Abnormal or high-utilization periods.

Note: The included CSV is demonstration data. Replace it with the instructor-provided dataset if one is supplied.

## 5. TASK 4 — CONFIGURE ALERT RULES

LibreNMS navigation:

`Alerts → Alert Rules → Create Rule`

Create the following rules.

Rule 1 — Interface Down Alert

| Setting   | Value                        |
| --------- | ---------------------------- |
| Name      | Interface Down Alert         |
| Severity  | Critical                     |
| Condition | `ports.ifOperStatus != 'up'` |

Rule 2 — High Interface Utilization

| Setting   | Value                          |
| --------- | ------------------------------ |
| Name      | High Interface Utilization     |
| Severity  | Warning                        |
| Condition | `macros.port_usage_perc >= 80` |

Save and enable both rules.

View alerts:

`Alerts → Faults`

Optional interface failure test:

Bring `lab0` down:

```
docker-compose exec snmp-device ip link set lab0 down
```

Verify status:

```
docker-compose exec librenms snmpwalk -v2c -c public snmp-device 1.3.6.1.2.1.2.2.1.8
```

Wait for the next LibreNMS polling/alerting cycle and check Alerts → Faults.

Restore interface:

```
docker-compose exec snmp-device ip link set lab0 up
```

Verify restoration:

```
docker-compose exec librenms snmpwalk -v2c -c public snmp-device 1.3.6.1.2.1.2.2.1.8
```

## 6. TROUBLESHOOTING

| Problem                   | Solution                                                                             |
| ------------------------- | ------------------------------------------------------------------------------------ |
| Docker daemon unavailable | Start Docker Desktop and wait until the engine is running.                           |
| Container not running     | Run `docker-compose ps` and inspect logs.                                            |
| SNMP timeout              | Verify hostname, community, SNMP version and port.                                   |
| LibreNMS page unavailable | Check container status and port 8000.                                                |
| `exec format error`       | Change `snmp-device/start.sh` line endings from CRLF to LF in VS Code, then rebuild. |
| Python cannot find files  | Run commands from the project folder and verify both Python and CSV files exist.     |
| Alert not appearing       | Wait for polling cycle; verify the rule is enabled and the device is being polled.   |

Useful diagnostic commands:

```
docker-compose ps
docker-compose logs --tail=50
docker-compose logs -f librenms
docker-compose logs --tail=50 snmp-device
docker-compose restart
```

## 7. SHUTDOWN

Stop containers while preserving saved data:

```
docker-compose down
```



Important

&#x20;Do not use `docker-compose down -v`. It deletes the database volume and saved LibreNMS configuration/data.
