Check if lldpctl present, and log debug if no lldpctl output. (#171)
This commit is contained in:
parent
137728be1f
commit
7999244096
1 changed files with 6 additions and 0 deletions
|
|
@ -1,8 +1,12 @@
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import logging
|
||||||
|
from netbox_agent.misc import is_tool
|
||||||
|
|
||||||
|
|
||||||
class LLDP():
|
class LLDP():
|
||||||
def __init__(self, output=None):
|
def __init__(self, output=None):
|
||||||
|
if not is_tool('lldpctl'):
|
||||||
|
logging.debug('lldpd package seems to be missing or daemon not running.')
|
||||||
if output:
|
if output:
|
||||||
self.output = output
|
self.output = output
|
||||||
else:
|
else:
|
||||||
|
|
@ -40,6 +44,8 @@ class LLDP():
|
||||||
current_dict[final] = value
|
current_dict[final] = value
|
||||||
for interface, vlan in vlans.items():
|
for interface, vlan in vlans.items():
|
||||||
output_dict['lldp'][interface]['vlan'] = vlan
|
output_dict['lldp'][interface]['vlan'] = vlan
|
||||||
|
if not output_dict:
|
||||||
|
logging.debug('No LLDP output, please check your network config.')
|
||||||
return output_dict
|
return output_dict
|
||||||
|
|
||||||
def get_switch_ip(self, interface):
|
def get_switch_ip(self, interface):
|
||||||
|
|
|
||||||
Loading…
Add table
editor.link_modal.header
Reference in a new issue