Integration Guide
Overview
Section titled “Overview”n8n is a powerful workflow automation tool integrated into the Sysadmin Anywhere ecosystem for creating alerts, monitoring, and automating administrative tasks.
Basic Use Cases
Section titled “Basic Use Cases”1. Security Event Alerts
Section titled “1. Security Event Alerts”Goal: Automatically notify administrators of critical security events.
Setup:
- Create webhook in n8n to receive events from Incident Service
- Filter events by severity level
- Add notification actions
Example workflow:
{ "nodes": [ { "name": "Webhook", "type": "n8n-nodes-base.webhook", "parameters": { "path": "security-events", "method": "POST" } }, { "name": "Filter Critical Events", "type": "n8n-nodes-base.filter", "parameters": { "conditions": { "string": [ { "value1": "={{ $json.level }}", "operation": "equal", "value2": "critical" } ] } } }, { "name": "Send Email Alert", "type": "n8n-nodes-base.emailSend", "parameters": { "subject": "Critical Security Event: {{ $json.eventType }}", "text": "Event detected: {{ $json.description }}" } } ]}2. Service Health Monitoring
Section titled “2. Service Health Monitoring”Goal: Check availability of all Sysadmin Anywhere services and alert on issues.
Setup:
- Use HTTP Request node to check each service
- Add logic to determine status
- Configure notifications for failures
Example workflow:
{ "nodes": [ { "name": "Check Directory Service", "type": "n8n-nodes-base.httpRequest", "parameters": { "url": "http://directory:8080/actuator/health", "method": "GET" } }, { "name": "Check Inventory Service", "type": "n8n-nodes-base.httpRequest", "parameters": { "url": "http://inventory:8080/actuator/health", "method": "GET" } }, { "name": "Check Incident Service", "type": "n8n-nodes-base.httpRequest", "parameters": { "url": "http://incident:8080/actuator/health", "method": "GET" } }, { "name": "Evaluate Status", "type": "n8n-nodes-base.function", "parameters": { "functionCode": "return items.map(item => ({ json: { service: item.node.name, status: item.json.status === 'UP' ? 'healthy' : 'unhealthy' } }))" } }, { "name": "Alert on Unhealthy", "type": "n8n-nodes-base.if", "parameters": { "conditions": { "string": [ { "value1": "={{ $json.status }}", "operation": "equal", "value2": "unhealthy" } ] } } }, { "name": "Send Slack Notification", "type": "n8n-nodes-base.slack", "parameters": { "channel": "#alerts", "text": "🚨 Service {{ $json.service }} is down!" } } ]}3. User Management Automation
Section titled “3. User Management Automation”Goal: Automatically create/update users based on events from external systems.
Setup:
- Configure webhook to receive user data
- Add validation and data transformation
- Integrate with Directory Service API
4. Daily Reports
Section titled “4. Daily Reports”Goal: Automatically generate and send daily system status reports.
Setup:
- Use Cron trigger for daily execution
- Collect data from all services
- Generate report and send via email
Sysadmin Anywhere Service Integration
Section titled “Sysadmin Anywhere Service Integration”Directory Service
Section titled “Directory Service”API Endpoints:
GET /api/users- Get user listPOST /api/users- Create userPUT /api/users/{id}- Update userDELETE /api/users/{id}- Delete user
Example n8n usage:
{ "name": "Create User in AD", "type": "n8n-nodes-base.httpRequest", "parameters": { "url": "http://directory:8080/api/users", "method": "POST", "body": { "username": "={{ $json.username }}", "email": "={{ $json.email }}", "firstName": "={{ $json.firstName }}", "lastName": "={{ $json.lastName }}" } }}Inventory Service
Section titled “Inventory Service”API Endpoints:
GET /api/computers- Get computer listGET /api/software- Get installed softwarePOST /api/scan- Start scanning
Incident Service
Section titled “Incident Service”API Endpoints:
GET /api/incidents- Get incidentsPOST /api/incidents- Create incidentGET /api/events- Get events
Notification Setup
Section titled “Notification Setup”Email Notifications
Section titled “Email Notifications”- Set up SMTP credentials in n8n settings
- Use Email Send node for sending notifications
- Configure templates for different event types
Slack Notifications
Section titled “Slack Notifications”- Create Slack Bot and get token
- Add Slack credentials to n8n
- Configure channels for different notification types
SMS Notifications
Section titled “SMS Notifications”- Connect SMS service (Twilio, etc.)
- Set up credentials for SMS API
- Use HTTP Request node to send SMS
Monitoring and Logging
Section titled “Monitoring and Logging”Viewing Workflow Executions
Section titled “Viewing Workflow Executions”- Open Sysadmin Anywhere interface
- Go to Automation → Workflows
- Select workflow to view details
- Track executions in Executions section
Error Logging
Section titled “Error Logging”- Configure Error Trigger in workflow
- Add error logging to file or monitoring system
- Set up critical error notifications
Best Practices
Section titled “Best Practices”Security
Section titled “Security”- Use API keys for authentication
- Store credentials in Vault
- Limit workflow permissions
- Update n8n regularly
Performance
Section titled “Performance”- Optimize API requests
- Use caching where possible
- Configure parallel task execution
- Monitor system load
Reliability
Section titled “Reliability”- Add retry mechanisms for critical operations
- Configure error handling
- Use dead letter queues for failed messages
- Test workflows regularly
Troubleshooting
Section titled “Troubleshooting”Common Issues
Section titled “Common Issues”- Connection refused: Check service availability
- Authentication failed: Verify API keys and credentials
- Timeout errors: Increase timeouts or optimize workflow
- Memory issues: Limit concurrent executions
Diagnostics
Section titled “Diagnostics”- Check n8n container logs:
docker logs n8n - Review execution logs in n8n interface
- Use service Health Check endpoints
- Monitor system resources
Example Ready-to-Use Workflows
Section titled “Example Ready-to-Use Workflows”1. Disk Space Monitor
Section titled “1. Disk Space Monitor”{ "name": "Disk Space Monitor", "nodes": [ { "name": "Get Disk Usage", "type": "n8n-nodes-base.httpRequest", "parameters": { "url": "http://inventory:8080/api/computers/disk-usage", "method": "GET" } }, { "name": "Check Threshold", "type": "n8n-nodes-base.if", "parameters": { "conditions": { "number": [ { "value1": "={{ $json.freeSpacePercent }}", "operation": "smaller", "value2": 10 } ] } } }, { "name": "Send Alert", "type": "n8n-nodes-base.emailSend", "parameters": { "subject": "Low Disk Space Alert", "text": "Computer {{ $json.computerName }} has only {{ $json.freeSpacePercent }}% free space" } } ]}2. Automatic Inactive User Disable
Section titled “2. Automatic Inactive User Disable”{ "name": "Disable Inactive Users", "nodes": [ { "name": "Get Inactive Users", "type": "n8n-nodes-base.httpRequest", "parameters": { "url": "http://directory:8080/api/users?inactiveDays=90", "method": "GET" } }, { "name": "Disable User", "type": "n8n-nodes-base.httpRequest", "parameters": { "url": "http://directory:8080/api/users/{{ $json.id }}/disable", "method": "POST" } }, { "name": "Log Action", "type": "n8n-nodes-base.httpRequest", "parameters": { "url": "http://incident:8080/api/audit-log", "method": "POST", "body": { "action": "USER_DISABLED", "userId": "={{ $json.id }}", "reason": "Automatic inactive user cleanup" } } } ]}Conclusion
Section titled “Conclusion”n8n provides powerful automation capabilities for administrative tasks in the Sysadmin Anywhere ecosystem. Start with simple workflows and gradually increase complexity as needed.
For additional information and support, refer to the n8n documentation (https://docs.n8n.io) and create issues in the project repository.