rConfig - SNMP Trap Handler Supervisor Management
The SNMP Trap Handler allows rConfig to receive and process SNMP traps from your network devices. This guide covers how to manage the SNMP Trap Handler service using Supervisor for reliable, production deployment.
Prerequisites
Section titled “Prerequisites”Ensure Supervisor is installed and running on your system. If rConfig was installed correctly, Supervisor should already be set up. If not contact support.
Initial Testing (Recommended)
Section titled “Initial Testing (Recommended)”Before deploying with Supervisor, test the SNMP trap handler manually:
# Test with default settingsphp artisan rconfig:snmp-trap-handler --host=0.0.0.0 --port=162 --daemon
# Test with custom settingsphp artisan rconfig:snmp-trap-handler --host=192.168.1.100 --port=1162 --daemon
Managing the Service
Section titled “Managing the Service”Interactive Setup (Recommended for First-Time Users)
Section titled “Interactive Setup (Recommended for First-Time Users)”Launch the interactive management interface:
php artisan rconfig:snmp-trap-supervisor
This will present you with a menu to:
- 📦 Install service (add to supervisor)
- 🗑️ Uninstall service (remove from supervisor)
- 📊 Check service status
- 🔄 Restart service
- ❌ Exit
Basic Configuration
Section titled “Basic Configuration”When installing, you’ll be prompted for basic settings:
- Host: IP address to bind to (default: 0.0.0.0)
- Port: SNMP trap port (default: 162)
- Community: SNMP community string (default: public)
Advanced Configuration
Section titled “Advanced Configuration”Select “Configure advanced settings?” to access additional options:
- Timeout: SNMP timeout in seconds
- Memory Limit: Memory limit in MB
- Base Path: Application installation path
- Supervisor Config Directory: Where to place the config file
Command Line Usage
Section titled “Command Line Usage”Quick Installation
Section titled “Quick Installation”# Install with defaultsphp artisan rconfig:snmp-trap-supervisor install --force
# Install with custom settingsphp artisan rconfig:snmp-trap-supervisor install \ --host=192.168.1.100 \ --port=1162 \ --community=private
Service Management
Section titled “Service Management”# Check service statusphp artisan rconfig:snmp-trap-supervisor status
# Restart the servicephp artisan rconfig:snmp-trap-supervisor restart
# Uninstall the servicephp artisan rconfig:snmp-trap-supervisor uninstall
Monitoring and Troubleshooting
Section titled “Monitoring and Troubleshooting”Checking Service Status
Section titled “Checking Service Status”# Via rConfig commandphp artisan rconfig:snmp-trap-supervisor status
# Direct supervisor commandssupervisorctl status rconfig-snmp-trapsupervisorctl status # View all services
Viewing Logs
Section titled “Viewing Logs”# Follow logs in real-time (recommended for troubleshooting)supervisorctl tail -f rconfig-snmp-trap
# View recent log entriessupervisorctl tail rconfig-snmp-trap
# View error logssupervisorctl tail rconfig-snmp-trap stderr
Service Control
Section titled “Service Control”# Start the servicesupervisorctl start rconfig-snmp-trap
# Stop the servicesupervisorctl stop rconfig-snmp-trap
# Restart the servicesupervisorctl restart rconfig-snmp-trap
# Reload supervisor configurationsupervisorctl rereadsupervisorctl update
Advanced Troubleshooting
Section titled “Advanced Troubleshooting”For detailed debugging, run the command manually with verbose output:
# Stop the supervisor service firstsupervisorctl stop rconfig-snmp-trap
# Run manually for detailed outputphp artisan rconfig:snmp-trap-handler --host=0.0.0.0 --port=162 --daemon
Log File Locations
Section titled “Log File Locations”The service logs are automatically stored in:
- Standard Output:
storage/logs/snmp-trap-handler.log
- Error Output:
storage/logs/snmp-trap-handler-error.log
Testing SNMP Trap Reception
Section titled “Testing SNMP Trap Reception”Once the service is running, test it by sending a test trap:
# Send a test SNMP v2c trapsnmptrap -v2c -c public 127.0.0.1:162 "" 1.3.6.1.4.1.9.9.43.2.0.1 \ 1.3.6.1.4.1.9.9.43.1.1.1.0 s "Configuration changed by admin"
Monitor the logs to verify the trap is received and processed correctly.
Common Issues
Section titled “Common Issues”Service Won’t Start
Section titled “Service Won’t Start”- Verify the base path exists and contains the Laravel application
- Check that the specified port is not already in use
- Ensure proper permissions for the user running the service
Permission Denied on Port 162
Section titled “Permission Denied on Port 162”- Use a higher port number (e.g., 1162) or run as root
- Configure your network devices to send traps to the alternative port
Service Stops Unexpectedly
Section titled “Service Stops Unexpectedly”- Check error logs:
supervisorctl tail rconfig-snmp-trap stderr
- Verify memory limits are appropriate for your environment
- Review application logs for PHP errors
For complex issues or advanced configuration needs, please contact rConfig support.