updated project 1
This commit is contained in:
@@ -64,9 +64,9 @@ This project documents the setup of a basic home lab environment using VirtualBo
|
||||
### Next Steps
|
||||
Now that networking is configured, we can proceed to:
|
||||
1. Basic Security Setup
|
||||
- [ ] Create non-root user with sudo privileges
|
||||
- [ ] Configure SSH access
|
||||
- [ ] Set up UFW firewall
|
||||
- [x] Create non-root user with sudo privileges
|
||||
- [x] Configure SSH access
|
||||
- [x] Set up UFW firewall
|
||||
|
||||
### 4. Basic Security Setup ✅
|
||||
- [x] User Management ✅
|
||||
@@ -89,39 +89,38 @@ Now that networking is configured, we can proceed to:
|
||||
- Host machine access (169.254.167.242)
|
||||
- Verified connectivity
|
||||
|
||||
### 5. System Monitoring Setup (Next Phase)
|
||||
- [ ] Monitoring Tools
|
||||
- [ ] Install and configure htop
|
||||
- [ ] Set up netdata for system metrics
|
||||
- [ ] Configure log monitoring
|
||||
### 5. System Monitoring and Maintenance ✅
|
||||
- [x] Monitoring Tools
|
||||
- Installed and configured htop
|
||||
- Set up Netdata for system metrics
|
||||
- Configured Logwatch for log monitoring
|
||||
|
||||
- [ ] Maintenance Planning
|
||||
- [ ] Create backup strategy
|
||||
- [ ] Set up automated updates
|
||||
- [ ] Implement log rotation
|
||||
- [ ] Configure system alerts
|
||||
- [x] Maintenance Procedures
|
||||
- Implemented backup strategy with rsync
|
||||
- Configured automated updates
|
||||
- Set up log rotation
|
||||
|
||||
### Current Status
|
||||
- ✅ Basic VM Setup: Complete
|
||||
- ✅ Network Configuration: Complete
|
||||
- ✅ Security Measures: Complete
|
||||
- ⏳ System Monitoring: Not Started
|
||||
- ✅ System Monitoring: Complete
|
||||
|
||||
### Next Steps
|
||||
1. System Monitoring Implementation
|
||||
- Research and select monitoring tools
|
||||
- Plan monitoring strategy
|
||||
- Document monitoring requirements
|
||||
1. Service Deployment
|
||||
- [ ] Web server setup (Apache/Nginx)
|
||||
- [ ] Database server
|
||||
- [ ] Basic web application
|
||||
|
||||
2. Maintenance Procedures
|
||||
- Design backup strategy
|
||||
- Create maintenance schedule
|
||||
- Document procedures
|
||||
2. Automation and Scripting
|
||||
- [ ] Shell scripting basics
|
||||
- [ ] Automated maintenance tasks
|
||||
- [ ] System health checks
|
||||
|
||||
3. Future Enhancements
|
||||
- Service deployment
|
||||
- Automation implementation
|
||||
- Advanced networking features
|
||||
3. Advanced Networking
|
||||
- [ ] DNS configuration
|
||||
- [ ] Network services
|
||||
- [ ] Advanced firewall rules
|
||||
|
||||
## Security Configuration Status
|
||||
- [x] User Management
|
||||
|
||||
@@ -0,0 +1,259 @@
|
||||
# System Monitoring and Maintenance Setup
|
||||
|
||||
## Overview
|
||||
This document tracks the implementation of system monitoring tools and maintenance procedures for our Ubuntu Server VM.
|
||||
|
||||
## Monitoring Tools
|
||||
|
||||
### 1. htop Installation and Configuration ✅
|
||||
```bash
|
||||
# Install htop
|
||||
sudo apt update
|
||||
sudo apt install htop
|
||||
|
||||
# Basic usage
|
||||
htop # Interactive process viewer
|
||||
```
|
||||
|
||||
#### Key htop Features
|
||||
- F1 - Help
|
||||
- F2 - Setup (customize display)
|
||||
- F3 - Search processes
|
||||
- F4 - Filter processes
|
||||
- F5 - Tree view
|
||||
- F6 - Sort by column
|
||||
- F9 - Kill process
|
||||
- F10 - Quit
|
||||
|
||||
#### Default Display Information
|
||||
- CPU usage (per core)
|
||||
- Memory usage
|
||||
- Swap usage
|
||||
- Load average
|
||||
- Running processes
|
||||
- System uptime
|
||||
|
||||
#### Customization Applied
|
||||
```bash
|
||||
# htop configuration is stored in
|
||||
~/.config/htop/htoprc
|
||||
```
|
||||
|
||||
### 2. Netdata Setup ✅
|
||||
```bash
|
||||
# Install required dependencies
|
||||
sudo apt install curl
|
||||
|
||||
# Install Netdata
|
||||
bash <(curl -Ss https://get.netdata.cloud/kickstart.sh)
|
||||
|
||||
# Allow Netdata web interface through firewall
|
||||
sudo ufw allow 19999/tcp
|
||||
```
|
||||
|
||||
#### Web Interface Access
|
||||
- URL: http://169.254.0.2:19999
|
||||
- Port: 19999
|
||||
- Status: Active and accessible
|
||||
|
||||
#### Available Metrics
|
||||
- Real-time CPU usage
|
||||
- Memory utilization
|
||||
- Disk operations
|
||||
- Network traffic
|
||||
- System load
|
||||
- Active processes
|
||||
|
||||
### 3. Log Monitoring ✅
|
||||
```bash
|
||||
# Install logwatch for log analysis
|
||||
sudo apt install logwatch
|
||||
|
||||
# Create and configure logwatch
|
||||
sudo cp /usr/share/logwatch/default.conf/logwatch.conf /etc/logwatch/conf/logwatch.conf
|
||||
sudo nano /etc/logwatch/conf/logwatch.conf
|
||||
|
||||
# Create required cache directory
|
||||
sudo mkdir -p /var/cache/logwatch
|
||||
sudo chown -R root:root /var/cache/logwatch
|
||||
sudo chmod 750 /var/cache/logwatch
|
||||
```
|
||||
|
||||
#### Basic Configuration
|
||||
```conf
|
||||
# /etc/logwatch/conf/logwatch.conf settings
|
||||
Output = stdout
|
||||
Format = text
|
||||
MailTo = root
|
||||
MailFrom = Logwatch
|
||||
Detail = Low
|
||||
Range = yesterday
|
||||
Service = All
|
||||
```
|
||||
|
||||
#### Usage Notes
|
||||
- Empty output is normal for new systems with limited activity
|
||||
- Logs will accumulate as the system is used
|
||||
- Key log locations:
|
||||
```bash
|
||||
/var/log/syslog # General system logs
|
||||
/var/log/auth.log # Authentication logs
|
||||
/var/log/kern.log # Kernel logs
|
||||
/var/log/ufw.log # Firewall logs
|
||||
```
|
||||
|
||||
#### Verification Commands
|
||||
```bash
|
||||
# View recent logs directly
|
||||
sudo tail -f /var/log/syslog
|
||||
sudo tail -f /var/log/auth.log
|
||||
|
||||
# Generate logwatch report
|
||||
sudo logwatch --output stdout --format text --range today --detail high
|
||||
```
|
||||
|
||||
## Maintenance Procedures
|
||||
|
||||
### 1. Backup Strategy ✅
|
||||
- [x] Define backup locations
|
||||
- System files: `/backup/system/`
|
||||
- Home directories: `/backup/home/`
|
||||
- [x] Select backup tools
|
||||
- Using `rsync` for efficient incremental backups
|
||||
- Custom backup script for automation
|
||||
- [x] Create backup schedule
|
||||
- Daily backups
|
||||
- 7-day retention policy
|
||||
|
||||
#### Backup Script
|
||||
```bash
|
||||
# Location: /usr/local/bin/system-backup.sh
|
||||
# See script content above...
|
||||
```
|
||||
|
||||
#### Manual Backup Commands
|
||||
```bash
|
||||
# Run system backup
|
||||
sudo /usr/local/bin/system-backup.sh
|
||||
|
||||
# Verify backup contents
|
||||
ls -l /backup/system/
|
||||
ls -l /backup/home/
|
||||
|
||||
# Check backup logs
|
||||
tail -f /var/log/syslog | grep backup
|
||||
```
|
||||
|
||||
#### Backup Verification
|
||||
- [ ] Test full system backup
|
||||
- [ ] Verify backup contents
|
||||
- [ ] Test file restoration
|
||||
|
||||
#### Automated Scheduling ✅
|
||||
```bash
|
||||
# Set up daily backup at 2 AM
|
||||
sudo crontab -e
|
||||
|
||||
# Add the following line:
|
||||
0 2 * * * /usr/local/bin/system-backup.sh >> /var/log/backup.log 2>&1
|
||||
```
|
||||
|
||||
#### Backup Log
|
||||
- Location: `/var/log/backup.log`
|
||||
- Contains: Backup execution details and any errors
|
||||
- Check status: `sudo tail -f /var/log/backup.log`
|
||||
|
||||
### 2. System Updates ✅
|
||||
- [x] Configure unattended-upgrades
|
||||
```bash
|
||||
# Install and configure
|
||||
sudo apt install unattended-upgrades apt-listchanges
|
||||
sudo dpkg-reconfigure -plow unattended-upgrades
|
||||
```
|
||||
|
||||
#### Update Configuration
|
||||
```conf
|
||||
# /etc/apt/apt.conf.d/50unattended-upgrades
|
||||
Unattended-Upgrade::Allowed-Origins {
|
||||
"${distro_id}:${distro_codename}";
|
||||
"${distro_id}:${distro_codename}-security";
|
||||
"${distro_id}ESMApps:${distro_codename}-apps-security";
|
||||
"${distro_id}ESM:${distro_codename}-infra-security";
|
||||
};
|
||||
|
||||
# Additional settings
|
||||
Unattended-Upgrade::AutoFixInterruptedDpkg "true";
|
||||
Unattended-Upgrade::Mail "root";
|
||||
Unattended-Upgrade::Remove-Unused-Dependencies "true";
|
||||
Unattended-Upgrade::Automatic-Reboot "false";
|
||||
```
|
||||
|
||||
### 3. Log Management ✅
|
||||
- [x] Configure log rotation
|
||||
- [x] Set retention policies
|
||||
- [x] Implement compression
|
||||
|
||||
#### Log Rotation Configuration
|
||||
```conf
|
||||
# /etc/logrotate.d/custom-logs
|
||||
/var/log/backup.log {
|
||||
weekly
|
||||
rotate 4
|
||||
compress
|
||||
delaycompress
|
||||
missingok
|
||||
notifempty
|
||||
create 640 root adm
|
||||
}
|
||||
|
||||
/var/log/unattended-upgrades/unattended-upgrades.log {
|
||||
weekly
|
||||
rotate 4
|
||||
compress
|
||||
delaycompress
|
||||
missingok
|
||||
notifempty
|
||||
create 640 root adm
|
||||
}
|
||||
```
|
||||
|
||||
#### Log Management Verification
|
||||
```bash
|
||||
# Test log rotation configuration
|
||||
sudo logrotate -d /etc/logrotate.d/custom-logs
|
||||
|
||||
# View current log sizes
|
||||
du -sh /var/log/*
|
||||
|
||||
# Monitor system logs
|
||||
tail -f /var/log/syslog
|
||||
```
|
||||
|
||||
## Implementation Status
|
||||
- [x] Basic System Monitoring (htop)
|
||||
- [x] Performance Metrics (Netdata)
|
||||
- [x] Log Analysis (Logwatch)
|
||||
- [x] Backup System (rsync + cron)
|
||||
- [x] Maintenance Automation (unattended-upgrades + logrotate)
|
||||
|
||||
## Commands and Configurations
|
||||
|
||||
### Monitoring Commands
|
||||
```bash
|
||||
# System resource monitoring
|
||||
htop
|
||||
free -h
|
||||
df -h
|
||||
vmstat 1
|
||||
|
||||
# Process monitoring
|
||||
ps aux
|
||||
top
|
||||
|
||||
# Network monitoring
|
||||
netstat -tulpn
|
||||
ss -tulpn
|
||||
```
|
||||
|
||||
## Issues and Solutions
|
||||
Document any issues encountered during setup and their solutions here.
|
||||
@@ -83,7 +83,8 @@ Status: active
|
||||
1. SSH (22/tcp)
|
||||
2. HTTP (80/tcp)
|
||||
3. HTTPS (443/tcp)
|
||||
4. All traffic from host (169.254.167.242)
|
||||
4. Netdata (19999/tcp)
|
||||
5. All traffic from host (169.254.167.242)
|
||||
|
||||
# Default policies:
|
||||
- Incoming: deny (default)
|
||||
|
||||
Reference in New Issue
Block a user