n8n-nodes-librenms
Version:
n8n community node for LibreNMS network monitoring system integration with comprehensive device management and monitoring capabilities
208 lines (189 loc) • 5.17 kB
text/typescript
import { INodeType, INodeTypeDescription } from 'n8n-workflow';
// Import resource modules
import { systemOperations, systemFields } from './resources/system';
import { devicesOperations, devicesFields } from './resources/devices';
import { alertsOperations, alertsFields } from './resources/alerts';
import { alertRulesOperations, alertRulesFields } from './resources/alertRules';
import { portsOperations, portsFields } from './resources/ports';
import { servicesOperations, servicesFields } from './resources/services';
import { routingOperations, routingFields } from './resources/routing';
import { billsOperations, billsFields } from './resources/bills';
import { switchingOperations, switchingFields } from './resources/switching';
import { logsOperations, logsFields } from './resources/logs';
import { arpOperations, arpFields } from './resources/arp';
import { deviceGroupsOperations, deviceGroupsFields } from './resources/deviceGroups';
import { inventoryOperations, inventoryFields } from './resources/inventory';
import { locationsOperations, locationsFields } from './resources/locations';
import { pollerGroupsOperations, pollerGroupsFields } from './resources/pollerGroups';
import { portGroupsOperations, portGroupsFields } from './resources/portGroups';
export class LibreNms implements INodeType {
description: INodeTypeDescription = {
displayName: 'LibreNMS',
name: 'libreNms',
icon: 'file:librenms.svg',
group: ['transform'],
version: 1,
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
description: 'Interact with LibreNMS network monitoring system',
defaults: {
name: 'LibreNMS',
color: '#33aa55',
},
inputs: ['main'],
outputs: ['main'],
usableAsTool: true,
credentials: [
{
name: 'libreNmsApi',
required: true,
},
],
requestDefaults: {
baseURL: '={{$credentials.url.replace(/\\/$/, "")}}/api/v0',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
skipSslCertificateValidation: '={{$credentials.allowUnauthorizedCerts}}',
},
properties: [
{
displayName: 'Resource',
name: 'resource',
type: 'options',
noDataExpression: true,
options: [
{
name: 'Alerts',
value: 'alerts',
description: 'Manage alerts',
},
{
name: 'Alert Rules',
value: 'alertRules',
description: 'Manage alert rules',
},
{
name: 'ARP',
value: 'arp',
description: 'ARP table entries',
},
{
name: 'Bills',
value: 'bills',
description: 'Billing information',
},
{
name: 'Devices',
value: 'devices',
description: 'Manage network devices',
},
{
name: 'Device Groups',
value: 'deviceGroups',
description: 'Device group management',
},
{
name: 'Inventory',
value: 'inventory',
description: 'Device inventory information',
},
{
name: 'Locations',
value: 'locations',
description: 'Location management',
},
{
name: 'Logs',
value: 'logs',
description: 'System logs',
},
{
name: 'Poller Groups',
value: 'pollerGroups',
description: 'Poller group information',
},
{
name: 'Ports',
value: 'ports',
description: 'Manage device ports',
},
{
name: 'Port Groups',
value: 'portGroups',
description: 'Port group management',
},
{
name: 'Routing',
value: 'routing',
description: 'BGP, OSPF, and routing information',
},
{
name: 'Services',
value: 'services',
description: 'Monitor services',
},
{
name: 'Switching',
value: 'switching',
description: 'VLANs, links, and switching data',
},
{
name: 'System',
value: 'system',
description: 'LibreNMS system information',
},
],
default: 'system',
},
// System operations
...systemOperations,
...systemFields,
// Devices operations
...devicesOperations,
...devicesFields,
// Alerts operations
...alertsOperations,
...alertsFields,
// Alert Rules operations
...alertRulesOperations,
...alertRulesFields,
// Ports operations
...portsOperations,
...portsFields,
// Services operations
...servicesOperations,
...servicesFields,
// Routing operations
...routingOperations,
...routingFields,
// Bills operations
...billsOperations,
...billsFields,
// Switching operations
...switchingOperations,
...switchingFields,
// Logs operations
...logsOperations,
...logsFields,
// ARP operations
...arpOperations,
...arpFields,
// Device Groups operations
...deviceGroupsOperations,
...deviceGroupsFields,
// Inventory operations
...inventoryOperations,
...inventoryFields,
// Locations operations
...locationsOperations,
...locationsFields,
// Poller Groups operations
...pollerGroupsOperations,
...pollerGroupsFields,
// Port Groups operations
...portGroupsOperations,
...portGroupsFields,
],
};
}