nodes

package
v1.0.0-beta7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 31, 2021 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AssetsCliCommand = cli.Command{
	Name:  "assets",
	Usage: "Manage Assets Record",
	Subcommands: []cli.Command{
		{
			Name:      "list",
			Usage:     "Lists all the assets for a given node",
			ArgsUsage: "<nodeId|foreignSource:foreignID>",
			Action:    getAssets,
		},
		{
			Name:   "enum",
			Usage:  "Enumerates the available asset fields",
			Action: getFields,
		},
		{
			Name:      "set",
			Usage:     "Adds or updates an asset field for a given node",
			ArgsUsage: "<nodeId|foreignSource:foreignID> <fieldName> <fieldValue>",
			Action:    addAssetField,
		},
		{
			Name:      "delete",
			Usage:     "Deletes an existing asset field from a given node (cannot be undone)",
			ArgsUsage: "<nodeId|foreignSource:foreignID> <fieldName>",
			Action:    deleteAssetField,
		},
	},
}

AssetsCliCommand the CLI command to manage nodes

View Source
var CategoriesCliCommand = cli.Command{
	Name:  "categories",
	Usage: "Manage Surveillance or Node Categories",
	Subcommands: []cli.Command{
		{
			Name:      "list",
			Usage:     "Lists all the categories for a given node",
			ArgsUsage: "<nodeId|foreignSource:foreignID>",
			Action:    getCategories,
		},
		{
			Name:      "add",
			Usage:     "Add a new category to a given node",
			ArgsUsage: "<nodeId|foreignSource:foreignID> <categoryName>",
			Action:    addCategory,
		},
		{
			Name:      "delete",
			Usage:     "Deletes an existing category from a given node (cannot be undone)",
			ArgsUsage: "<nodeId|foreignSource:foreignID> <category>",
			Action:    deleteCategory,
		},
	},
}

CategoriesCliCommand the CLI command to manage nodes

View Source
var CliCommand = cli.Command{
	Name:        "nodes",
	Usage:       "Manage OpenNMS Nodes / Inventory",
	Description: "Manage OpenNMS Nodes / Inventory\n   The recommended way to populate the inventory is via Provisioning Requisitions or Auto-Discover.\n   When neither of those methods are possible, you can manually build the inventory using this sub-command.\n   It is expected a YAML file with 'nodes' as root tag and an array of elements inside of it.",
	Subcommands: []cli.Command{
		{
			Name:   "list",
			Usage:  "Lists all the nodes",
			Action: getNodes,
		},
		{
			Name:   "add",
			Usage:  "Add a new node",
			Action: addNode,
			Flags: []cli.Flag{
				cli.StringFlag{
					Name:     "label, l",
					Usage:    "Node Label",
					Required: true,
				},
				cli.StringFlag{
					Name:  "location, L",
					Usage: "Node Minion Location",
				},
				cli.StringFlag{
					Name:  "sysOID, so",
					Usage: "SNMP System Object ID",
				},
				cli.StringFlag{
					Name:  "sysName, sn",
					Usage: "SNMP System Name",
				},
				cli.StringFlag{
					Name:  "sysDescr, sd",
					Usage: "SNMP System Description",
				},
				cli.StringFlag{
					Name:  "sysLocation, sl",
					Usage: "SNMP System Location",
				},
				cli.StringFlag{
					Name:  "sysContact, sc",
					Usage: "SNMP System Contact",
				},
			},
		},
		{
			Name:   "apply",
			Usage:  "Adds a new set of nodes from a external file",
			Action: addNodes,
			Flags: []cli.Flag{
				cli.StringFlag{
					Name:  "file, f",
					Usage: "External file (use '-' for STDIN Pipe)",
				},
			},
			ArgsUsage: "<content>",
		},
		{
			Name:      "delete",
			Usage:     "Deletes an existing node (cannot be undone)",
			ArgsUsage: "<nodeId|foreignSource:foreignID>",
			Action:    deleteNode,
		},
		{
			Name:  "metadata",
			Usage: "Manage node-level metadata",
			Subcommands: []cli.Command{
				{
					Name:      "list",
					Usage:     "Lists all the node-level metadata",
					Action:    listNodeMetadata,
					ArgsUsage: "<nodeId|foreignSource:foreignID>",
				},
				{
					Name:      "set",
					Usage:     "Adds or updates a node-level metadata entry",
					Action:    setNodeMetadata,
					ArgsUsage: "<nodeId|foreignSource:foreignID>",
					Flags: []cli.Flag{
						cli.StringFlag{
							Name:     "context, c",
							Usage:    "Metadata Context",
							Required: true,
						},
						cli.StringFlag{
							Name:     "key, k",
							Usage:    "Metadata Key",
							Required: true,
						},
						cli.StringFlag{
							Name:     "value, v",
							Usage:    "Metadata Value",
							Required: true,
						},
					},
				},
				{
					Name:      "delete",
					Usage:     "Deletes an existing node-level metadata entry",
					Action:    deleteNodeMetadata,
					ArgsUsage: "<nodeId|foreignSource:foreignID>",
					Flags: []cli.Flag{
						cli.StringFlag{
							Name:     "context, c",
							Usage:    "Metadata Context",
							Required: true,
						},
						cli.StringFlag{
							Name:     "key, k",
							Usage:    "Metadata Key",
							Required: true,
						},
					},
				},
			},
		},
		IPInterfacesCliCommand,
		SnmpInterfacesCliCommand,
		CategoriesCliCommand,
		AssetsCliCommand,
	},
}

CliCommand the CLI command to manage nodes

View Source
var IPInterfacesCliCommand = cli.Command{
	Name:  "ipInterfaces",
	Usage: "Manage IP Interfaces",
	Subcommands: []cli.Command{
		{
			Name:      "list",
			Usage:     "Lists all the IP interfaces for a given node",
			ArgsUsage: "<nodeId|foreignSource:foreignID>",
			Action:    getIPInterfaces,
		},
		{
			Name:      "add",
			Usage:     "Add a new IP interface to a given node",
			ArgsUsage: "<nodeId|foreignSource:foreignID>",
			Action:    addIPInterface,
			Flags: []cli.Flag{
				cli.StringFlag{
					Name:     "ipAddr, i",
					Usage:    "IP Address",
					Required: true,
				},
				cli.StringFlag{
					Name:  "hostname, n",
					Usage: "Hostname or FQDN",
				},
				cli.StringFlag{
					Name:  "isManaged, m",
					Usage: "Managed Flag",
				},
				cli.StringFlag{
					Name:  "snmpPrimary, p",
					Usage: "SNMP Primary Flag",
				},
				cli.IntFlag{
					Name:  "ifIndex, I",
					Usage: "ifIndex of the existing SNMP interface to associte with the IP interface",
				},
			},
		},
		{
			Name:      "delete",
			Usage:     "Deletes an existing IP interface from a given node (cannot be undone)",
			ArgsUsage: "<nodeId|foreignSource:foreignID> <ipAddress>",
			Action:    deleteIPInterface,
		},
		{
			Name:  "metadata",
			Usage: "Manage interface-level metadata",
			Subcommands: []cli.Command{
				{
					Name:      "list",
					Usage:     "Lists all the interface-level metadata",
					Action:    listInterfaceMetadata,
					ArgsUsage: "<nodeId|foreignSource:foreignID> <ipAddress>",
				},
				{
					Name:      "set",
					Usage:     "Adds or updates a interface-level metadata entry",
					Action:    setInterfaceMetadata,
					ArgsUsage: "<nodeId|foreignSource:foreignID> <ipAddress>",
					Flags: []cli.Flag{
						cli.StringFlag{
							Name:     "context, c",
							Usage:    "Metadata Context",
							Required: true,
						},
						cli.StringFlag{
							Name:     "key, k",
							Usage:    "Metadata Key",
							Required: true,
						},
						cli.StringFlag{
							Name:     "value, v",
							Usage:    "Metadata Value",
							Required: true,
						},
					},
				},
				{
					Name:      "delete",
					Usage:     "Deletes an existing interface-level metadata entry",
					Action:    deleteInterfaceMetadata,
					ArgsUsage: "<nodeId|foreignSource:foreignID> <ipAddress>",
					Flags: []cli.Flag{
						cli.StringFlag{
							Name:     "context, c",
							Usage:    "Metadata Context",
							Required: true,
						},
						cli.StringFlag{
							Name:     "key, k",
							Usage:    "Metadata Key",
							Required: true,
						},
					},
				},
			},
		},
		ServicesCliCommand,
	},
}

IPInterfacesCliCommand the CLI command to manage nodes

View Source
var ServicesCliCommand = cli.Command{
	Name:  "services",
	Usage: "Manage Monitored Services",
	Subcommands: []cli.Command{
		{
			Name:      "list",
			Usage:     "Lists all the monitoring services for a given IP interface on a given node",
			ArgsUsage: "<nodeId|foreignSource:foreignID> <ipAddress>",
			Action:    getServices,
		},
		{
			Name:      "add",
			Usage:     "Add a new monitored service a given IP interface on a given node",
			ArgsUsage: "<nodeId|foreignSource:foreignID> <ipAddress> <serviceName>",
			Action:    addService,
		},
		{
			Name:      "delete",
			Usage:     "Deletes an existing monitored service from a given IP interface on a given node (cannot be undone)",
			ArgsUsage: "<nodeId|foreignSource:foreignID> <ipAddress> <serviceName>",
			Action:    deleteService,
		},
		{
			Name:  "metadata",
			Usage: "Manage service-level metadata",
			Subcommands: []cli.Command{
				{
					Name:      "list",
					Usage:     "Lists all the service-level metadata",
					Action:    listServiceMetadata,
					ArgsUsage: "<nodeId|foreignSource:foreignID> <ipAddress> <serviceName>",
				},
				{
					Name:      "set",
					Usage:     "Adds or updates a service-level metadata entry",
					Action:    setServiceMetadata,
					ArgsUsage: "<nodeId|foreignSource:foreignID> <ipAddress> <serviceName>",
					Flags: []cli.Flag{
						cli.StringFlag{
							Name:     "context, c",
							Usage:    "Metadata Context",
							Required: true,
						},
						cli.StringFlag{
							Name:     "key, k",
							Usage:    "Metadata Key",
							Required: true,
						},
						cli.StringFlag{
							Name:     "value, v",
							Usage:    "Metadata Value",
							Required: true,
						},
					},
				},
				{
					Name:      "delete",
					Usage:     "Deletes an existing service-level metadata entry",
					Action:    deleteServiceMetadata,
					ArgsUsage: "<nodeId|foreignSource:foreignID> <ipAddress> <serviceName>",
					Flags: []cli.Flag{
						cli.StringFlag{
							Name:     "context, c",
							Usage:    "Metadata Context",
							Required: true,
						},
						cli.StringFlag{
							Name:     "key, k",
							Usage:    "Metadata Key",
							Required: true,
						},
					},
				},
			},
		},
	},
}

ServicesCliCommand the CLI command to manage nodes

View Source
var SnmpInterfacesCliCommand = cli.Command{
	Name:  "snmpInterfaces",
	Usage: "Manage SNMP Interfaces",
	Subcommands: []cli.Command{
		{
			Name:      "list",
			Usage:     "Lists all the SNMP interfaces for a given node",
			ArgsUsage: "<nodeId|foreignSource:foreignID>",
			Action:    getSnmpInterfaces,
		},
		{
			Name:      "add",
			Usage:     "Add a new SNMP interface to a given node",
			ArgsUsage: "<nodeId|foreignSource:foreignID>",
			Action:    addSnmpInterface,
			Flags: []cli.Flag{
				cli.IntFlag{
					Name:     "ifIndex, i",
					Usage:    "The IF-MIB::ifIndex",
					Required: true,
				},
				cli.IntFlag{
					Name:  "ifOper, o",
					Usage: "The IF-MIB::ifOperStatus (1:up, 2:down, 3:testing, 4:unknown, 5:dormant, 6:notPresent, 7:lowerLayerDown)",
					Value: 1,
				},
				cli.IntFlag{
					Name:  "ifAdmin, A",
					Usage: "The IF-MIB::ifAdminStatus (1:up, 2:down, 3:testing)",
					Value: 1,
				},
				cli.Int64Flag{
					Name:  "ifSpeed, s",
					Usage: "The IF-MIB::ifSpeed expressed in bits per second",
				},
				cli.IntFlag{
					Name:  "ifType, t",
					Usage: "The IF-MIB::ifType",
				},
				cli.StringFlag{
					Name:     "ifName, n",
					Usage:    "The IF-MIB::ifName",
					Required: true,
				},
				cli.StringFlag{
					Name:  "ifDescr, d",
					Usage: "The IF-MIB::ifDescr",
				},
				cli.StringFlag{
					Name:  "ifAlias, a",
					Usage: "The IF-MIB::ifAlias",
				},
				cli.StringFlag{
					Name:  "physAddress, p",
					Usage: "The IF-MIB::ifPhysAddress (MAC Address)",
				},
				cli.BoolTFlag{
					Name:  "collect",
					Usage: "flag to collect performance metrics via SNMP Collector",
				},
				cli.BoolFlag{
					Name:  "poll",
					Usage: "flag to poll status via SNMP Interface Poller",
				},
			},
		},
		{
			Name:      "delete",
			Usage:     "Deletes an existing SNMP interface from a given node (cannot be undone)",
			ArgsUsage: "<nodeId|foreignSource:foreignID> <ifIndex>",
			Action:    deleteSnmpInterface,
		},
	},
}

SnmpInterfacesCliCommand the CLI command to manage nodes

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL