netdisco-do - Run any Netdisco job from the command-line.
~/bin/netdisco-do <action> [-DISQR] [--enqueue] [--quiet] [-d <device> [-p <port>] [-e <extra>]]
This program allows you to run any Netdisco poller job from the command-line.
Note that some jobs ("discoverall", "macwalk",
"arpwalk", "nbtwalk") simply add entries to the Netdisco
job queue for other jobs, so won't seem to do much when you trigger them.
Everything else happens in real-time.
However the ""--enqueue"" option will force the queueing of
the job, regardless of type. This may be useful for cron-driven actions, or
for actions working across large IP spaces.
For any action, if you wish to run one of its individual worker stages, then
pass "action::stage" as the first argument to
"netdisco-do", for example "discover::neighbors".
Any action taking a "device" parameter can be passed either a hostname
or IP of any interface on a known or unknown device, or an IP prefix (subnet)
which will cause "netdisco-do" to run the action for all addresses
in that range.
Run a discover on the device (specified with "-d").
~netdisco/bin/netdisco-do discover -d 192.0.2.1
Queue a discover for all known devices.
Run a macsuck on the device (specified with "-d").
~netdisco/bin/netdisco-do macsuck -d 192.0.2.1
Queue a macsuck for all known devices.
Run an arpnip on the device (specified with "-d").
~netdisco/bin/netdisco-do arpnip -d 192.0.2.1
Queue an arpnip for all known devices.
Delete a device (specified with "-d"). Pass a log message for the
action in the "-e" parameter. Optionally request for associated
nodes to be archived (rather than deleted) by setting the "-p"
parameter to ""yes"" (mnemonic:
preserve).
~netdisco/bin/netdisco-do delete -d 192.0.2.1
~netdisco/bin/netdisco-do delete -d 192.0.2.1 -e 'older than the sun'
~netdisco/bin/netdisco-do delete -d 192.0.2.1 -e 'older than the sun' -p yes
Change the canonical IP address of a device (specified with "-d").
Pass the new IP address in the "-e" parameter. All related records
such as topology, log and node information will also be updated to refer to
the new device.
Note that
no check is made as to whether the new IP is reachable for
future polling.
~netdisco/bin/netdisco-do renumber -d 192.0.2.1 -e 192.0.2.254
Run an nbtstat on the node (specified with "-d").
~netdisco/bin/netdisco-do nbtstat -d 192.0.2.2
Queue an nbtstat for all known nodes.
Run Device and Node expiry actions according to configuration.
Archive nodes on the specified device. If you want to delete nodes, set the
"-e" parameter to ""no"" (mnemonic:
expire). If you want to perform the action on a specific port, set the
"-p" parameter.
~netdisco/bin/netdisco-do expirenodes -d 192.0.2.1
~netdisco/bin/netdisco-do expirenodes -d 192.0.2.1 -p FastEthernet0/1 -e no
Generate GraphViz graphs for the largest cluster of devices.
You'll need to install the Graph::Undirected and GraphViz Perl modules, and
possibly also the "graphviz" utility for your operating system. Also
create a directory for the output files.
mkdir ~netdisco/graph
~netdisco/bin/localenv cpanm Graph::Undirected
~netdisco/bin/localenv cpanm GraphViz
Dump the content of an SNMP MIB leaf, which is useful for diagnostics and
troubleshooting. You should provide the ""-e"" option
which is the name of the leaf (such as "interfaces" or
"uptime").
If you wish to test with a device class other than that discovered, prefix the
leaf with the class short name, for example
""Layer3::C3550::interfaces"" or
""Layer2::HP::uptime"".
~netdisco/bin/netdisco-do show -d 192.0.2.1 -e interfaces
~netdisco/bin/netdisco-do show -d 192.0.2.1 -e Layer2::HP::interfaces
A paramter may be passed to the "SNMP::Info" method in the
"-p" parameter:
~netdisco/bin/netdisco-do show -d 192.0.2.1 -e has_layer -p 3
Start an interactive terminal with the Netdisco PostgreSQL database. If you pass
an SQL statement in the "-e" option then it will be executed.
~netdisco/bin/netdisco-do psql
~netdisco/bin/netdisco-do psql -e 'SELECT ip, dns FROM device'
~netdisco/bin/netdisco-do psql -e 'COPY (SELECT ip, dns FROM device) TO STDOUT WITH CSV HEADER'
Updates Netdisco's statistics on number of devices, nodes, etc, for today.
Set the SNMP location field on the device (specified with "-d"). Pass
the location string in the "-e" extra parameter.
~netdisco/bin/netdisco-do location -d 192.0.2.1 -e 'wiring closet'
Set the SNMP contact field on the device (specified with "-d"). Pass
the contact name in the "-e" extra parameter.
~netdisco/bin/netdisco-do contact -d 192.0.2.1 -e 'tel: 555-2453'
Set the description on a device port. Requires the "-d" parameter
(device), "-p" parameter (port), and "-e" parameter
(description).
~netdisco/bin/netdisco-do portname -d 192.0.2.1 -p FastEthernet0/1 -e 'Web Server'
Set the up/down status on a device port. Requires the "-d" parameter
(device), "-p" parameter (port), and "-e" parameter
("up" or "down").
~netdisco/bin/netdisco-do portcontrol -d 192.0.2.1 -p FastEthernet0/1 -e up
~netdisco/bin/netdisco-do portcontrol -d 192.0.2.1 -p FastEthernet0/1 -e down
Set the native VLAN on a device port. Requires the "-d" parameter
(device), "-p" parameter (port), and "-e" parameter (VLAN
number).
~netdisco/bin/netdisco-do vlan -d 192.0.2.1 -p FastEthernet0/1 -e 102
Set the PoE on/off status on a device port. Requires the "-d"
parameter (device), "-p" parameter (port), and "-e"
parameter ("on" or "off").
~netdisco/bin/netdisco-do power -d 192.0.2.1 -p FastEthernet0/1 -e on
~netdisco/bin/netdisco-do power -d 192.0.2.1 -p FastEthernet0/1 -e off
Will dump the loaded and parsed configuration for the application. Pass a
specific configuration setting name to the "-e" parameter to dump
only that.
The flag ""-R"" will cause any changes to the database to be
rolled back at the end of the action.
The flags ""-DISQ"" can be specified, multiple times, and
enable the following items in order:
- "-D"
- Netdisco debug log level
- "-I" or "-II"
- SNMP::Info trace level (1 or 2).
- "-S" or "-SS" or "-SSS"
- SNMP (net-snmp) trace level (1, 2 or 3).
- "-Q"
- DBIx::Class trace enabled