← Back to Menu Module 2 of 8

πŸ“‹ Prerequisites & Environment Setup

Preparing Your Lab Infrastructure

πŸ“š Learning Objectives

By the end of this module, you will have:

  • Verified all required systems are accessible and operational
  • Installed necessary Grafana plugins for data source integration
  • Confirmed network connectivity between Grafana and all data sources
  • Gathered all required credentials and connection parameters
  • Completed a pre-lab verification checklist ensuring readiness

🎯 Lab Environment Requirements

Before beginning the integration, you need a working environment with all components deployed and accessible. This module guides you through verificationβ€”ensuring each system is ready for configuration.

Important: This lab assumes you already have LibreNMS, InfluxDB/Telegraf, and VictoriaLogs deployed. If you don't have these systems yet, you'll need to install them before proceeding with this lab.

πŸ–₯️ Required Systems

1

Grafana Server

Version Required: Grafana 10.0 or higher

Installation Options:

Option A: Docker (Recommended for Labs)

# Quick start with Docker docker run -d \ --name=grafana \ -p 3000:3000 \ -e "GF_INSTALL_PLUGINS=mysql" \ grafana/grafana:latest # Access Grafana at: http://localhost:3000 # Default credentials: admin / admin

Option B: Ubuntu/Debian Package

# Add Grafana repository sudo apt-get install -y software-properties-common sudo add-apt-repository "deb https://packages.grafana.com/oss/deb stable main" wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add - # Install Grafana sudo apt-get update sudo apt-get install grafana # Start and enable Grafana sudo systemctl start grafana-server sudo systemctl enable grafana-server sudo systemctl status grafana-server

Option C: Red Hat/CentOS

# Add Grafana repository cat <

βœ“ Verification Test

Access Grafana UI at http://your-grafana-server:3000 and confirm you can login

Resource Requirements:

  • CPU: 2 cores minimum
  • RAM: 4GB minimum (8GB recommended)
  • Disk: 10GB minimum for application and cache
  • Network: Outbound connectivity to all data sources
2

LibreNMS Server

Version Required: LibreNMS 22.x or higher

Database: MySQL/MariaDB 10.5+

⚠️ Prerequisites

  • LibreNMS must be actively polling at least 5-10 network devices
  • MySQL/MariaDB database must be accessible from Grafana server
  • You need database credentials with SELECT permissions

Verify LibreNMS is Collecting Data

# SSH to LibreNMS server # Check poller status cd /opt/librenms ./validate.php # Verify devices are being polled php poller.php -h # Check database for recent data mysql -u librenms -p librenms SELECT COUNT(*) FROM devices WHERE disabled = 0; SELECT hostname, last_polled FROM devices ORDER BY last_polled DESC LIMIT 5;

πŸ’‘ Database Access Details to Collect

You'll need these for Module 3:

Host: librenms-db-server.example.com Port: 3306 Database Name: librenms Username: [grafana user - to be created] Password: [secure password]
3

Telegraf & InfluxDB Stack

InfluxDB Requirements

Supported Versions: InfluxDB 2.x (preferred) or 1.8.x

# Check InfluxDB version influx version # For InfluxDB 1.x influxd version # For InfluxDB 2.x # Test InfluxDB 2.x connectivity curl http://influxdb-server:8086/health # Test InfluxDB 1.x connectivity curl http://influxdb-server:8086/ping

Verify Telegraf is Sending Data

# For InfluxDB 2.x - Check measurements influx query 'from(bucket:"telegraf") |> range(start: -5m) |> limit(n:1)' \ --host http://influxdb-server:8086 \ --org your-org \ --token your-token # For InfluxDB 1.x - Check measurements influx -host influxdb-server -database telegraf > SHOW MEASUREMENTS > SELECT * FROM cpu LIMIT 5

πŸ’‘ Connection Details to Collect

For InfluxDB 2.x:

URL: http://influxdb-server:8086 Organization: your-org-name Bucket: telegraf Token: [API token with read access]

For InfluxDB 1.x:

URL: http://influxdb-server:8086 Database: telegraf Username: grafana_reader Password: [secure password]

Expected Telegraf Measurements:

  • cpu - CPU utilization metrics
  • mem - Memory usage statistics
  • disk - Disk space and usage
  • diskio - Disk I/O performance
  • net - Network interface statistics
  • system - System load and uptime
4

VictoriaLogs Server

Version Required: VictoriaLogs v0.5.0 or higher

Verify VictoriaLogs is Running

# Check VictoriaLogs health curl http://victorialogs-server:9428/health # Test query endpoint curl 'http://victorialogs-server:9428/select/logsql/query' \ -d 'query={}' \ -d 'limit=5' # Check metrics and ingestion status curl http://victorialogs-server:9428/metrics | grep victorialogs_rows # Should show: # victorialogs_rows_ingested - Total rows ingested # victorialogs_rows_per_second - Current ingestion rate

⚠️ Common VictoriaLogs Issues

  • Ensure log shippers (Vector, Promtail) are actively sending logs
  • Verify logs are recent (within last 24 hours)
  • Check storage space - VictoriaLogs requires adequate disk I/O
  • Confirm port 9428 is accessible from Grafana server

πŸ’‘ Connection Details to Collect

URL: http://victorialogs-server:9428/select/logsql Authentication: [if configured] Expected Labels: job, host, level, environment

Verify Log Labels

# List all labels curl -X POST 'http://victorialogs-server:9428/select/logsql/labels' # Get values for specific label curl -X POST 'http://victorialogs-server:9428/select/logsql/label/job/values' curl -X POST 'http://victorialogs-server:9428/select/logsql/label/host/values' curl -X POST 'http://victorialogs-server:9428/select/logsql/label/level/values' # Should return labels like: syslog, app, nginx, container, etc.

πŸ”Œ Grafana Plugin Installation

Grafana requires specific plugins for connecting to MySQL (LibreNMS) and optionally for enhanced VictoriaLogs support.

5

Install Required Plugins

MySQL Plugin (for LibreNMS)

# Install MySQL data source plugin grafana-cli plugins install mysql # For Docker installations docker exec -it grafana grafana-cli plugins install mysql # Restart Grafana to load plugin sudo systemctl restart grafana-server # Or for Docker docker restart grafana

Verify Plugin Installation

# List installed plugins grafana-cli plugins ls # Check Grafana logs for successful plugin loading tail -f /var/log/grafana/grafana.log | grep plugin # Or for Docker docker logs grafana | grep plugin

βœ“ Expected Output

You should see MySQL plugin listed and loaded successfully

Optional: VictoriaMetrics/VictoriaLogs Plugin

# Optional: Install VictoriaLogs native plugin for enhanced features grafana-cli plugins install victoriametrics-logs-datasource # Restart Grafana sudo systemctl restart grafana-server

πŸ’‘ Plugin Notes

InfluxDB plugin is built-in to Grafana (no installation needed)
Loki plugin is built-in to Grafana (we'll use this for VictoriaLogs)
VictoriaLogs native plugin is optional but provides enhanced functionality

πŸ” Network & Security Verification

Required Network Connectivity

Source Destination Port Protocol Purpose
Grafana Server LibreNMS MySQL 3306 TCP Database queries
Grafana Server InfluxDB 8086 TCP Time series queries
Grafana Server VictoriaLogs 9428 TCP Log queries
Admin Workstation Grafana Server 3000 TCP Dashboard access
6

Test Network Connectivity

# From Grafana server, test connectivity to each data source # Test LibreNMS MySQL telnet librenms-db-server 3306 # Or using netcat nc -zv librenms-db-server 3306 # Test InfluxDB curl -I http://influxdb-server:8086/health # Test VictoriaLogs curl http://victorialogs-server:9428/health # Test MySQL authentication mysql -h librenms-db-server -u testuser -p -e "SELECT 1"

⚠️ Firewall Configuration

If connectivity tests fail, check firewall rules on both source and destination:

# Ubuntu/Debian - Allow Grafana to connect sudo ufw allow from grafana-server-ip to any port 3306 sudo ufw allow from grafana-server-ip to any port 8086 sudo ufw allow from grafana-server-ip to any port 9428 # CentOS/RHEL - Firewalld sudo firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="grafana-ip" port protocol="tcp" port="3306" accept' sudo firewall-cmd --reload

βœ… Pre-Lab Verification Checklist

Complete this checklist before proceeding to Module 3. Check each item as you verify it:

System Readiness

Network Connectivity

Credentials & Access

βœ“ Checklist Complete?

Once all items are checked, you're ready to proceed to Module 3 where you'll configure the LibreNMS data source in Grafana.

πŸ” Troubleshooting Common Setup Issues

Issue: Can't Access Grafana UI

# Check if Grafana is running sudo systemctl status grafana-server # Check logs for errors sudo tail -f /var/log/grafana/grafana.log # Verify port 3000 is listening sudo netstat -tulpn | grep 3000 sudo lsof -i :3000 # Check firewall sudo ufw status sudo firewall-cmd --list-all

Issue: LibreNMS Database Not Accessible

# Check MySQL is running sudo systemctl status mysql sudo systemctl status mariadb # Check bind-address in MySQL config grep bind-address /etc/mysql/mysql.conf.d/mysqld.cnf # Should be 0.0.0.0 or specific IP, not 127.0.0.1 # Test from Grafana server mysql -h librenms-db-server -u root -p -e "SHOW DATABASES;"

Issue: InfluxDB Not Responding

# Check InfluxDB service sudo systemctl status influxdb # Check logs sudo journalctl -u influxdb -f # Verify port binding sudo netstat -tulpn | grep 8086 # Test from Grafana server curl -v http://influxdb-server:8086/health