Automated Microsoft Teams notifications when routers go offline
https://api.kerchunknetworks.com/data/routers.json)SSH into your Linode VM and run:
# Install Docker if not already installed
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
# Run n8n with Docker
docker run -it --rm \\
--name n8n \\
-p 5678:5678 \\
-v ~/.n8n:/home/node/.n8n \\
n8nio/n8n
Access n8n at: http://your-linode-ip:5678
If you don't want to manage your own server:
This will run your workflow every 5 minutes to check router status.
This fetches your router data.
https://api.kerchunknetworks.com/data/routers.jsonThis checks if any routers changed state.
// Get current router data
const currentRouters = $input.all()[0].json.routers;
// Get previous state from workflow static data (persisted between runs)
const previousState = $workflow.staticData.routerStates || {};
// Initialize if first run
if (Object.keys(previousState).length === 0) {
currentRouters.forEach(router => {
previousState[router.id] = router.state;
});
$workflow.staticData.routerStates = previousState;
return []; // Don't send alerts on first run
}
// Check for state changes
const alerts = [];
currentRouters.forEach(router => {
const previousRouterState = previousState[router.id];
if (previousRouterState !== router.state) {
alerts.push({
name: router.name,
id: router.id,
previousState: previousRouterState,
currentState: router.state,
timestamp: new Date().toISOString()
});
// Update state
previousState[router.id] = router.state;
}
});
// Save updated state
$workflow.staticData.routerStates = previousState;
// Return alerts (if any)
return alerts.map(alert => ({ json: alert }));
Content-Type: application/json{
"@type": "MessageCard",
"@context": "https://schema.org/extensions",
"summary": "Router Status Alert",
"themeColor": "{{$json.currentState === 'offline' ? 'FF0000' : '00FF00'}}",
"title": "🚨 Router Status Change",
"sections": [{
"activityTitle": "{{$json.name}}",
"activitySubtitle": "Status changed from {{$json.previousState}} to {{$json.currentState}}",
"facts": [
{
"name": "Router Name:",
"value": "{{$json.name}}"
},
{
"name": "Router ID:",
"value": "{{$json.id}}"
},
{
"name": "Previous State:",
"value": "{{$json.previousState}}"
},
{
"name": "Current State:",
"value": "{{$json.currentState}}"
},
{
"name": "Time:",
"value": "{{$json.timestamp}}"
}
],
"markdown": true
}],
"potentialAction": [{
"@type": "OpenUri",
"name": "View Dashboard",
"targets": [{
"os": "default",
"uri": "https://kerchunknetworks.com/monitor.html"
}]
}]
}
In the Schedule Trigger node, adjust the interval:
You can modify the Function node to alert on:
Create a second workflow with a daily schedule that sends a summary:
Need help? Contact IT at [email protected]