Configuration Guide #
Complete configuration options for the Server Monitor plugin.
Environment Variables #
Core Settings #
# API Security
SERVER_MONITOR_API_KEY=your-secure-api-key-here
SERVER_MONITOR_ADMIN_EMAIL=admin@example.com
# Debug & Development
SERVERMONITOR_NOTIFICATION_DEBUG=false
APP_DEBUG=false
# Queue Configuration
QUEUE_CONNECTION=database # or 'redis' for better performance
SMS Configuration (Twilio) #
# Twilio Credentials (for SMS notifications)
TWILIO_SID=your-twilio-account-sid
TWILIO_TOKEN=your-twilio-auth-token
TWILIO_NUMBER=+1234567890
# SMS Cost Tracking (in USD, 4 decimal places)
SERVER_MONITOR_SMS_COST=0.0075
Plan Limits (Optional Overrides) #
# Free Plan Limits
SERVER_MONITOR_FREE_LIMIT=50
SERVER_MONITOR_FREE_USER_LIMIT=1
SERVER_MONITOR_FREE_LOGS_ENABLED=true
SERVER_MONITOR_FREE_LOG_RETENTION=7
# Basic Plan Limits
SERVER_MONITOR_BASIC_LIMIT=200
SERVER_MONITOR_BASIC_USER_LIMIT=0 # 0 = unlimited
SERVER_MONITOR_BASIC_LOGS_ENABLED=true
SERVER_MONITOR_BASIC_LOG_RETENTION=30
# Pro Plan Limits
SERVER_MONITOR_PRO_LIMIT=500
SERVER_MONITOR_PRO_USER_LIMIT=0
SERVER_MONITOR_PRO_LOGS_ENABLED=true
SERVER_MONITOR_PRO_LOG_RETENTION=90
# Enterprise Plan Limits
SERVER_MONITOR_ENTERPRISE_LIMIT=0 # 0 = unlimited
SERVER_MONITOR_ENTERPRISE_USER_LIMIT=0
SERVER_MONITOR_ENTERPRISE_LOGS_ENABLED=true
SERVER_MONITOR_ENTERPRISE_LOG_RETENTION=90
Configuration File #
Create plugins/albrightlabs/servermonitor/config/config.php:
<?php
return [
// Admin notification settings
'admin_email' => env('SERVER_MONITOR_ADMIN_EMAIL', 'joe@albrightlabs.com'),
// API security settings
'api_key' => env('SERVER_MONITOR_API_KEY'),
// Debug settings
'notification_debug' => env('SERVERMONITOR_NOTIFICATION_DEBUG', false),
// SMS cost - in USD with 4 decimal places
'sms_cost' => env('SERVER_MONITOR_SMS_COST', '0.0075'),
// Plan limits and features
'plans' => [
'free' => [
'server_limit' => env('SERVER_MONITOR_FREE_LIMIT', 50),
'user_limit' => env('SERVER_MONITOR_FREE_USER_LIMIT', 1),
'logs_enabled' => env('SERVER_MONITOR_FREE_LOGS_ENABLED', true),
'log_retention_days' => env('SERVER_MONITOR_FREE_LOG_RETENTION', 7),
],
'basic' => [
'server_limit' => env('SERVER_MONITOR_BASIC_LIMIT', 200),
'user_limit' => env('SERVER_MONITOR_BASIC_USER_LIMIT', 0), // 0 = unlimited
'logs_enabled' => env('SERVER_MONITOR_BASIC_LOGS_ENABLED', true),
'log_retention_days' => env('SERVER_MONITOR_BASIC_LOG_RETENTION', 30),
],
'pro' => [
'server_limit' => env('SERVER_MONITOR_PRO_LIMIT', 500),
'user_limit' => env('SERVER_MONITOR_PRO_USER_LIMIT', 0),
'logs_enabled' => env('SERVER_MONITOR_PRO_LOGS_ENABLED', true),
'log_retention_days' => env('SERVER_MONITOR_PRO_LOG_RETENTION', 90),
],
'enterprise' => [
'server_limit' => env('SERVER_MONITOR_ENTERPRISE_LIMIT', 0), // 0 = unlimited
'user_limit' => env('SERVER_MONITOR_ENTERPRISE_USER_LIMIT', 0),
'logs_enabled' => env('SERVER_MONITOR_ENTERPRISE_LOGS_ENABLED', true),
'log_retention_days' => env('SERVER_MONITOR_ENTERPRISE_LOG_RETENTION', 90),
],
],
];
Plan Configuration Details #
Server & Heartbeat Limits #
0= Unlimited servers/heartbeats- Any positive integer = Maximum allowed
- Note: Heartbeats use the same limits as servers (
server_limitapplies to both)
User Limits #
0= Unlimited users in organization- Any positive integer = Maximum notification recipients
Log Settings #
logs_enabled: true= Create and store status change logslogs_enabled: false= No logs created (not recommended)log_retention_days: 0= Keep logs foreverlog_retention_days: X= Delete logs older than X days
Heartbeat Configuration #
Heartbeats share the same plan limits as servers. The server_limit configuration applies to both:
| Plan | Server Limit | Heartbeat Limit | Check Frequency |
|---|---|---|---|
| Free | 50 | 50 | Every minute |
| Basic | 200 | 200 | Every minute |
| Pro | 500 | 500 | Every minute |
| Enterprise | Unlimited | Unlimited | Every minute |
Heartbeat Timeframes #
Available timeframes for heartbeat monitoring:
10m- 10 minutes30m- 30 minutes1h- 1 hour1d- 1 day (24 hours)1w- 1 week1m- 1 month
Heartbeat Cleanup #
Old heartbeat pings are automatically cleaned up to maintain performance:
- Keeps the last 1000 pings per heartbeat
- Older pings are removed during each new ping
Twilio SMS Setup #
1. Create Twilio Account #
- Visit https://www.twilio.com
- Sign up for a new account
- Verify your phone number
- Purchase a phone number
2. Get Credentials #
From your Twilio Console:
- Account SID →
TWILIO_SID - Auth Token →
TWILIO_TOKEN - Phone Number →
TWILIO_NUMBER
3. Configure Costs #
SMS costs vary by destination. Update SERVER_MONITOR_SMS_COST with your average cost per message (usually $0.0075 - $0.01).
Debug Mode #
Enable detailed logging for troubleshooting:
SERVERMONITOR_NOTIFICATION_DEBUG=true
This logs:
- Notification attempt details
- Twilio API responses
- Email sending results
- Threshold crossing analysis
Important: Disable in production to avoid log spam.
Security Configuration #
API Key Best Practices #
# Generate strong API key
openssl rand -base64 32
# Or use PHP
php -r "echo base64_encode(random_bytes(32));"
Security Tips:
- Use a unique key (never reuse keys)
- Store securely in
.envfile - Rotate periodically
- Never commit to version control
Email Configuration #
Ensure your mail driver is properly configured in config/mail.php:
// For production, use a service like Mailgun, SendGrid, etc.
'default' => 'smtp',
'mailers' => [
'smtp' => [
'transport' => 'smtp',
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'port' => env('MAIL_PORT', 587),
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
],
],
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'noreply@yourdomain.com'),
'name' => env('MAIL_FROM_NAME', 'Your Monitoring Service'),
],
Performance Configuration #
Queue Driver #
Database Queue (Default)
QUEUE_CONNECTION=database
- Easy setup, good for small deployments
- Can be slower with high volume
Redis Queue (Recommended for Production)
QUEUE_CONNECTION=redis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
- Better performance, handles high volume
- Requires Redis installation
Cache Configuration #
In config/cache.php:
'disableRequestCache' => true,
This prevents conflicts between web requests and queue workers.
Subscription Enforcement #
The plugin automatically enforces subscription status:
- Active subscriptions: Full monitoring services
- Past due: Grace period continues service
- Cancelled/Suspended: Services stopped immediately
No additional configuration required - this uses SaasBase subscription data.
Environment-Specific Settings #
Development #
APP_DEBUG=true
SERVERMONITOR_NOTIFICATION_DEBUG=true
SERVER_MONITOR_SMS_COST=0.0000 # Disable SMS costs in dev
Staging #
APP_DEBUG=false
SERVERMONITOR_NOTIFICATION_DEBUG=true
# Use test Twilio credentials
Production #
APP_DEBUG=false
SERVERMONITOR_NOTIFICATION_DEBUG=false
# Use production Twilio credentials
# Set strong API key
# Configure proper mail driver
Validation #
Test your configuration:
# Test console access
php artisan servermonitor:checkserverstatus --help
# Test API key
curl -s "https://yoursite.com/api/servermonitor/worker-status/YOUR_API_KEY"
# Test queue connection
php artisan queue:work --once
# Test email configuration
php artisan tinker
>>> Mail::raw('Test', function($m) { $m->to('test@example.com')->subject('Test'); });
Next Steps #
After configuration:
- Set Up Queue Workers - Configure Supervisor for background processing
- Configure Notifications - Set up email and SMS alerts
- Add API Endpoints - Schedule cron jobs for monitoring
Previous: Installation | Next: Queue Setup