class Compliance(db.Model): __tablename__ = "compliance" vendor = db.Column(db.Text, primary_key=True) os = db.Column(db.Text, primary_key=True) standard_version = db.Column(db.Text) standard_config_file = db.Column(db.Text) def __repr__(self): return f"Compliance: {self.vendor}:{self.os}"
class HostStatusSummary(db.Model): __tablename__ = "host_status_summary" host_id = db.Column(db.Integer, primary_key=True) timestamp = db.Column(db.Text, primary_key=True) availability = db.Column(db.Integer) response_time = db.Column(db.Integer) def __repr__(self): return f"Status {self.host_id}"
class DeviceConfig(db.Model): __tablename__ = "device_config" id = db.Column(db.Integer, autoincrement=True, primary_key=True) device_id = db.Column(db.Integer) timestamp = db.Column(db.Text) config = db.Column(db.Text) def __repr__(self): return f"Status {self.device_id}"
class ServiceStatus(db.Model): __tablename__ = "service_status" service_id = db.Column(db.Integer, primary_key=True) timestamp = db.Column(db.Text, primary_key=True) availability = db.Column(db.Boolean) response_time = db.Column(db.Integer) def __repr__(self): return f"Status {self.service_id}"
class DeviceFacts(db.Model): __tablename__ = "device_facts" device_name = db.Column(db.Text, primary_key=True) fqdn = db.Column(db.Text) hostname = db.Column(db.Text) model = db.Column(db.Text) os_version = db.Column(db.Text) serial_number = db.Column(db.Text) vendor = db.Column(db.Text) uptime = db.Column(db.Integer) def __repr__(self): return f"Device: {self.hostname}"
class Command(db.Model): __tablename__ = "command" id = db.Column(db.Integer, primary_key=True, autoincrement=True) host = db.Column(db.Text) serial = db.Column(db.Text) worker_type = db.Column(db.Text) command = db.Column(db.Text) command_info = db.Column(db.Text) delivered = db.Column(db.Boolean) timestamp = db.Column(db.Text) def __repr__(self): return f"Worker: {self.name}"
class DeviceStatus(db.Model): __tablename__ = "device_status" id = db.Column(db.Integer, autoincrement=True, primary_key=True) device_id = db.Column(db.Integer) timestamp = db.Column(db.Text) availability = db.Column(db.Boolean) response_time = db.Column(db.Integer) cpu = db.Column(db.Integer) memory = db.Column(db.Integer) def __repr__(self): return f"Status {self.device_id}"
class Host(db.Model): __tablename__ = "host" id = db.Column(db.Integer, primary_key=True, autoincrement=True) name = db.Column(db.Text, nullable=False) ip_address = db.Column(db.Text, nullable=False) mac_address = db.Column(db.Text) availability = db.Column(db.Boolean) response_time = db.Column(db.Integer) last_heard = db.Column(db.Text) def __repr__(self): return f"Device: {self.name}"
class Portscan(db.Model): __tablename__ = "portscan" host_ip = db.Column(db.Text, primary_key=True) host_name = db.Column(db.Text, primary_key=True) source = db.Column(db.Text, primary_key=True) timestamp = db.Column(db.Text, primary_key=True) token = db.Column(db.Text) # addresses = db.Column(db.Text) # hostnames = db.Column(db.Text) # osmatch = db.Column(db.Text) # portused = db.Column(db.Text) # status = db.Column(db.Text) # vendor = db.Column(db.Text) # tcp = db.Column(db.Text) # udp = db.Column(db.Text) # ip = db.Column(db.Text) scan_output = db.Column(db.Text) def __repr__(self): return f"Status {self.host_id}"
class Service(db.Model): __tablename__ = "service" id = db.Column(db.Integer, primary_key=True, autoincrement=True) name = db.Column(db.Text, nullable=False) type = db.Column(db.Text) target = db.Column(db.Text, nullable=False) data = db.Column(db.Text) username = db.Column(db.Text) password = db.Column(db.Text) availability = db.Column(db.Boolean) response_time = db.Column(db.Integer) sla_availability = db.Column(db.Integer, default=0) sla_response_time = db.Column(db.Integer, default=99999) last_heard = db.Column(db.Text) def __repr__(self): return f"Service: {self.name}"
class Capture(db.Model): __tablename__ = "capture" id = db.Column(db.Integer, primary_key=True, autoincrement=True) timestamp = db.Column(db.Text) local_timestamp = db.Column(db.Text) source = db.Column(db.Text) ether_src = db.Column(db.Text) ether_dst = db.Column(db.Text) ip_src = db.Column(db.Text) ip_dst = db.Column(db.Text) protocol = db.Column(db.Text) sport = db.Column(db.Text) dport = db.Column(db.Text) packet_json = db.Column(db.Text) packet_hexdump = db.Column(db.Text) def __repr__(self): return f"Sniff host at {self.timestamp} for host {self.host_ip} packet: {self.packet}"
class Worker(db.Model): __tablename__ = "worker" id = db.Column(db.Integer, primary_key=True, autoincrement=True) name = db.Column(db.Text, nullable=False) host = db.Column(db.Text, nullable=False) serial = db.Column(db.Text) worker_type = db.Column(db.Text) connection_type = db.Column(db.Text) availability = db.Column(db.Boolean) response_time = db.Column(db.Integer) sla_availability = db.Column(db.Integer, default=0) sla_response_time = db.Column(db.Integer, default=99999) last_heard = db.Column(db.Text) cpu = db.Column(db.Integer) memory = db.Column(db.Integer) uptime = db.Column(db.Integer) def __repr__(self): return f"Worker: {self.name}"
class Device(db.Model): __tablename__ = "device" id = db.Column(db.Integer, primary_key=True) name = db.Column(db.Text, unique=True, nullable=False) fqdn = db.Column(db.Text) serial = db.Column(db.Text) ip_address = db.Column(db.Text) mac_address = db.Column(db.Text) vendor = db.Column(db.Text) model = db.Column(db.Text) os = db.Column(db.Text) version = db.Column(db.Text) transport = db.Column(db.Text) availability = db.Column(db.Boolean) response_time = db.Column(db.Integer) sla_availability = db.Column(db.Integer, default=0) sla_response_time = db.Column(db.Integer, default=99999) last_heard = db.Column(db.Text) cpu = db.Column(db.Integer) memory = db.Column(db.Integer) uptime = db.Column(db.Integer) os_compliance = db.Column(db.Boolean) config_compliance = db.Column(db.Boolean) last_compliance_check = db.Column(db.Text) ssh_port = db.Column(db.Integer) ncclient_name = db.Column(db.Text) netconf_port = db.Column(db.Integer) hostname = db.Column(db.Text) username = db.Column(db.Text) password = db.Column(db.Text) def __repr__(self): return f"Device: {self.name}"