remove cisco module and all refreneces
This commit is contained in:
parent
5ba5e6eda1
commit
9fbd9c1ca0
5 changed files with 4 additions and 101 deletions
|
@ -12,7 +12,6 @@ from logging import getLogger, StreamHandler, Formatter, DEBUG
|
|||
|
||||
from varken.ombi import OmbiAPI
|
||||
from varken.unifi import UniFiAPI
|
||||
from varken.cisco import CiscoAPI
|
||||
from varken import VERSION, BRANCH
|
||||
from varken.sonarr import SonarrAPI
|
||||
from varken.radarr import RadarrAPI
|
||||
|
@ -131,11 +130,6 @@ if __name__ == "__main__":
|
|||
if server.get_missing:
|
||||
schedule.every(server.get_missing_run_seconds).seconds.do(threaded, SICKCHILL.get_missing)
|
||||
|
||||
if CONFIG.ciscoasa_enabled:
|
||||
for firewall in CONFIG.ciscoasa_servers:
|
||||
ASA = CiscoAPI(firewall, DBMANAGER)
|
||||
schedule.every(firewall.get_bandwidth_run_seconds).seconds.do(threaded, ASA.get_bandwidth)
|
||||
|
||||
if CONFIG.unifi_enabled:
|
||||
for server in CONFIG.unifi_servers:
|
||||
UNIFI = UniFiAPI(server, DBMANAGER)
|
||||
|
@ -143,7 +137,7 @@ if __name__ == "__main__":
|
|||
|
||||
# Run all on startup
|
||||
SERVICES_ENABLED = [CONFIG.ombi_enabled, CONFIG.radarr_enabled, CONFIG.tautulli_enabled, CONFIG.unifi_enabled,
|
||||
CONFIG.sonarr_enabled, CONFIG.ciscoasa_enabled, CONFIG.sickchill_enabled]
|
||||
CONFIG.sonarr_enabled, CONFIG.sickchill_enabled]
|
||||
if not [enabled for enabled in SERVICES_ENABLED if enabled]:
|
||||
vl.logger.error("All services disabled. Exiting")
|
||||
exit(1)
|
||||
|
|
|
@ -3,7 +3,6 @@ sonarr_server_ids = 1,2
|
|||
radarr_server_ids = 1,2
|
||||
tautulli_server_ids = 1
|
||||
ombi_server_ids = 1
|
||||
ciscoasa_server_ids = false
|
||||
sickchill_server_ids = false
|
||||
unifi_server_ids = false
|
||||
|
||||
|
@ -88,15 +87,6 @@ verify_ssl = false
|
|||
get_missing = true
|
||||
get_missing_run_seconds = 300
|
||||
|
||||
[ciscoasa-1]
|
||||
url = firewall.domain.tld
|
||||
username = cisco
|
||||
password = cisco
|
||||
outside_interface = WAN
|
||||
ssl = false
|
||||
verify_ssl = false
|
||||
get_bandwidth_run_seconds = 300
|
||||
|
||||
[unifi-1]
|
||||
url = unifi.domain.tld:8443
|
||||
username = ubnt
|
||||
|
|
|
@ -1,60 +0,0 @@
|
|||
from logging import getLogger
|
||||
from requests import Session, Request
|
||||
from datetime import datetime, timezone
|
||||
|
||||
from varken.helpers import connection_handler
|
||||
|
||||
|
||||
class CiscoAPI(object):
|
||||
def __init__(self, firewall, dbmanager):
|
||||
self.dbmanager = dbmanager
|
||||
self.firewall = firewall
|
||||
# Create session to reduce server web thread load, and globally define pageSize for all requests
|
||||
self.session = Session()
|
||||
self.session.auth = (self.firewall.username, self.firewall.password)
|
||||
self.logger = getLogger()
|
||||
|
||||
self.get_token()
|
||||
|
||||
def __repr__(self):
|
||||
return f"<ciscoasa-{self.firewall.id}>"
|
||||
|
||||
def get_token(self):
|
||||
endpoint = '/api/tokenservices'
|
||||
|
||||
req = self.session.prepare_request(Request('POST', self.firewall.url + endpoint))
|
||||
post = connection_handler(self.session, req, self.firewall.verify_ssl)
|
||||
|
||||
if not post:
|
||||
return
|
||||
|
||||
self.session.headers = {'X-Auth-Token': post}
|
||||
|
||||
def get_bandwidth(self):
|
||||
now = datetime.now(timezone.utc).astimezone().isoformat()
|
||||
endpoint = '/api/monitoring/device/interfaces/' + self.firewall.outside_interface
|
||||
|
||||
if not self.session.headers:
|
||||
return
|
||||
|
||||
req = self.session.prepare_request(Request('GET', self.firewall.url + endpoint))
|
||||
get = connection_handler(self.session, req, self.firewall.verify_ssl)
|
||||
|
||||
if not get:
|
||||
return
|
||||
|
||||
influx_payload = [
|
||||
{
|
||||
"measurement": "Cisco ASA",
|
||||
"tags": {
|
||||
"interface": self.firewall.outside_interface
|
||||
},
|
||||
"time": now,
|
||||
"fields": {
|
||||
"upload_bitrate": get['outputBitRate'],
|
||||
"download_bitrate": get['inputBitRate']
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
self.dbmanager.write_points(influx_payload)
|
|
@ -7,7 +7,7 @@ from configparser import ConfigParser, NoOptionError, NoSectionError
|
|||
from varken.varkenlogger import BlacklistFilter
|
||||
from varken.structures import SickChillServer, UniFiServer
|
||||
from varken.helpers import clean_sid_check, rfc1918_ip_check
|
||||
from varken.structures import SonarrServer, RadarrServer, OmbiServer, TautulliServer, InfluxServer, CiscoASAFirewall
|
||||
from varken.structures import SonarrServer, RadarrServer, OmbiServer, TautulliServer, InfluxServer
|
||||
|
||||
|
||||
class INIParser(object):
|
||||
|
@ -15,7 +15,7 @@ class INIParser(object):
|
|||
self.config = None
|
||||
self.data_folder = data_folder
|
||||
self.filtered_strings = None
|
||||
self.services = ['sonarr', 'radarr', 'ombi', 'tautulli', 'sickchill', 'ciscoasa', 'unifi']
|
||||
self.services = ['sonarr', 'radarr', 'ombi', 'tautulli', 'sickchill', 'unifi']
|
||||
|
||||
self.logger = getLogger()
|
||||
self.influx_server = InfluxServer()
|
||||
|
@ -248,20 +248,9 @@ class INIParser(object):
|
|||
verify_ssl=verify_ssl, get_missing=get_missing,
|
||||
get_missing_run_seconds=get_missing_run_seconds)
|
||||
|
||||
if service in ['ciscoasa', 'unifi']:
|
||||
if service == 'unifi':
|
||||
username = self.config.get(section, 'username')
|
||||
password = self.config.get(section, 'password')
|
||||
|
||||
if service == 'ciscoasa':
|
||||
outside_interface = self.config.get(section, 'outside_interface')
|
||||
get_bandwidth_run_seconds = self.config.getint(section, 'get_bandwidth_run_seconds')
|
||||
|
||||
server = CiscoASAFirewall(id=server_id, url=scheme + url, verify_ssl=verify_ssl,
|
||||
username=username, password=password,
|
||||
outside_interface=outside_interface,
|
||||
get_bandwidth_run_seconds=get_bandwidth_run_seconds)
|
||||
|
||||
if service == 'unifi':
|
||||
site = self.config.get(section, 'site').lower()
|
||||
usg_name = self.config.get(section, 'usg_name')
|
||||
get_usg_stats_run_seconds = self.config.getint(section, 'get_usg_stats_run_seconds')
|
||||
|
|
|
@ -76,16 +76,6 @@ class SickChillServer(NamedTuple):
|
|||
verify_ssl: bool = False
|
||||
|
||||
|
||||
class CiscoASAFirewall(NamedTuple):
|
||||
get_bandwidth_run_seconds: int = 30
|
||||
id: int = None
|
||||
outside_interface: str = None
|
||||
password: str = 'cisco'
|
||||
url: str = '192.168.1.1'
|
||||
username: str = 'cisco'
|
||||
verify_ssl: bool = False
|
||||
|
||||
|
||||
class UniFiServer(NamedTuple):
|
||||
get_usg_stats_run_seconds: int = 30
|
||||
id: int = None
|
||||
|
|
Loading…
Reference in a new issue