mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
feature: Support for up/down detection of ping only devices.
* Added support for ping only devices. * Renamed sql-schema/206 to 207. * Discovery tried to detect the OS when it shouldn't. * Updated db_schema.yaml * Added ping icon. * Don't show unused graphs and tabs when SNMP is disabled. * Allow the user to specify OS of ping only devices. * Removing custom OS now changes it to 'ping'. * Removed unnecessary use of mres(). * UI select box for SNMP enable/disable. * Hide device_ping_perf if ping is disable on device. * Fixed SNMP settings update status messages. * Added functionality to add ping only devices via the web ui. * Added ping only option to addhost.php * Added ping only support to snmp-scan.py * Moved sql 208 to 211 * Fixed scrutinizer issues. * Fixed broken ossearch. * Added ping only support to the API. * Updated API doc. * Added (optional) to OS and hardware description. Hid Port Settings, Applications, Modules, Storage, Processors, Memory and Components from the edit menu * Style fix. * Updated ping icon. * clean() instead of mres(). More escaping. Better help in snmp-scan.py and addhost.php * Fixed scrutinizer issue. * Always try SNMP in snmp-scan.py, new option for it in addhost.php. Slice instead of chunk in ajax_ossuggest.php. Other minor style changes. * Updated sql modifications to insert the new column in the same place as in db_schema.yaml.
This commit is contained in:
15
snmp-scan.py
15
snmp-scan.py
@@ -25,6 +25,7 @@ from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import argparse
|
||||
from argparse import RawTextHelpFormatter
|
||||
import json
|
||||
from collections import namedtuple
|
||||
from multiprocessing import Pool
|
||||
@@ -120,7 +121,7 @@ def scan_host(ip):
|
||||
pass
|
||||
|
||||
try:
|
||||
add_output = check_output(['/usr/bin/env', 'php', 'addhost.php', hostname or ip])
|
||||
add_output = check_output(['/usr/bin/env', 'php', 'addhost.php', args.ping, hostname or ip])
|
||||
return Result(ip, hostname, Outcome.ADDED, add_output)
|
||||
except CalledProcessError as err:
|
||||
output = err.output.decode().rstrip()
|
||||
@@ -141,12 +142,14 @@ if __name__ == '__main__':
|
||||
###################
|
||||
# Parse arguments #
|
||||
###################
|
||||
parser = argparse.ArgumentParser(description='Scan network for snmp hosts and add them to LibreNMS.')
|
||||
parser = argparse.ArgumentParser(description='Scan network for snmp hosts and add them to LibreNMS.', formatter_class=RawTextHelpFormatter)
|
||||
parser.add_argument('network', action='append', nargs='*', type=str, help="""CIDR noted IP-Range to scan. Can be specified multiple times
|
||||
This argument is only required if $config['nets'] is not set
|
||||
Example: 192.168.0.0/24
|
||||
Example: 192.168.0.0/31 will be treated as an RFC3021 p-t-p network with two addresses, 192.168.0.0 and 192.168.0.1
|
||||
Example: 192.168.0.1/32 will be treated as a single host address""")
|
||||
This argument is only required if $config['nets'] is not set
|
||||
Example: 192.168.0.0/24
|
||||
Example: 192.168.0.0/31 will be treated as an RFC3021 p-t-p network with two addresses, 192.168.0.0 and 192.168.0.1
|
||||
Example: 192.168.0.1/32 will be treated as a single host address""")
|
||||
parser.add_argument('-P', '--ping', action='store_const', const="-b", default="", help="""Add the device as an ICMP only device if it replies to ping but not SNMP.
|
||||
Example: """ + __file__ + """ -P 192.168.0.0/24""")
|
||||
parser.add_argument('-t', dest='threads', type=int,
|
||||
help="How many IPs to scan at a time. More will increase the scan speed," +
|
||||
" but could overload your system. Default: {}".format(THREADS))
|
||||
|
||||
Reference in New Issue
Block a user