Beispiel #1
0
    def __init__(self):
        self.memoryMonitor = MemoryMonitor()
        self.systemLoadMonitor = SystemLoadMonitor()
        self.httpMonitor = HTTPConMonitor()
        self.sshAccessMonitor = SSHAccessMonitor()
        self.availabilityMonitor = AvailabilityMonitor()
        self.backupMonitor = BackupMonitor()
        self.encryptionMonitor = EncryptionMonitor()
        self.integrityMonitor = IntegrityMonitor()
        self.malwareMonitor = MalwareMonitor()
        self.passwordMonitor = PasswordMonitor()
        self.vulnerabilityMonitor = VulnerabilityMonitor()

        while True:
            now = datetime.datetime.now()
            print now.strftime("%d-%m-%Y %H:%M:%S")
            data = self.get_monitoring_data()
            self.send_monitoring_data(data)
            time.sleep(300)  # 5 minutes for now
Beispiel #2
0
class Monitor:
    def __init__(self):
        self.memoryMonitor = MemoryMonitor()
        self.systemLoadMonitor = SystemLoadMonitor()
        self.httpMonitor = HTTPConMonitor()
        self.sshAccessMonitor = SSHAccessMonitor()
        self.availabilityMonitor = AvailabilityMonitor()
        self.backupMonitor = BackupMonitor()
        self.encryptionMonitor = EncryptionMonitor()
        self.integrityMonitor = IntegrityMonitor()
        self.malwareMonitor = MalwareMonitor()
        self.passwordMonitor = PasswordMonitor()
        self.vulnerabilityMonitor = VulnerabilityMonitor()

        while True:
            now = datetime.datetime.now()
            print now.strftime("%d-%m-%Y %H:%M:%S")
            data = self.get_monitoring_data()
            self.send_monitoring_data(data)
            time.sleep(300)  # 5 minutes for now

    def get_monitoring_data(self):
        data = {}
        #data.append(self.memoryMonitor.get_memory_usage())
        data['memory'] = self.memoryMonitor.get_meminfo()
        data['loadavg'] = self.systemLoadMonitor.get_loadavg()
        data['http'] = self.httpMonitor.get_http_connections()
        data['sshattempts'] = self.sshAccessMonitor.get_ssh_access_attempts()
        data['availabity'] = self.availabilityMonitor.get_availability_info()
        data['backup'] = self.backupMonitor.get_backup_info()
        data['encryption'] = self.encryptionMonitor.get_encryption_info()
        data['integrity'] = self.integrityMonitor.get_integrity_info()
        data['malware'] = self.malwareMonitor.get_malware_info()
        data['password'] = self.passwordMonitor.get_password_security()
        data[
            'vulnerability'] = self.vulnerabilityMonitor.get_vulnerability_info(
            )

        return data

    def send_monitoring_data(self, data):
        '''
        connect to a server to send monitoring data
        '''
        try:
            logging.debug('Connecting to Monitoring Server...')
            server = xmlrpclib.ServerProxy(
                '%s:%s' % (settings.SERVER, settings.SERVER_PORT))
            sent = server.get_vm_notification(data)
        except (socket_error, xmlrpclib.Fault, xmlrpclib.ProtocolError,
                xmlrpclib.ResponseError), error_code:
            print error_code
            logging.error('Err: (%s)' % error_code)
Beispiel #3
0
class Monitor:

    def __init__(self):
        self.memoryMonitor = MemoryMonitor()
        self.systemLoadMonitor = SystemLoadMonitor()
        self.httpMonitor = HTTPConMonitor()
        self.sshAccessMonitor = SSHAccessMonitor()
        self.availabilityMonitor = AvailabilityMonitor()
        self.backupMonitor = BackupMonitor()
        self.encryptionMonitor = EncryptionMonitor()
        self.integrityMonitor = IntegrityMonitor()
        self.malwareMonitor = MalwareMonitor()
        self.passwordMonitor = PasswordMonitor()
        self.vulnerabilityMonitor = VulnerabilityMonitor()

        while True:
            now = datetime.datetime.now()
            print now.strftime("%d-%m-%Y %H:%M:%S")
            data = self.get_monitoring_data()
            self.send_monitoring_data(data)
            time.sleep(300) # 5 minutes for now

    def get_monitoring_data(self):
        data = {}
        #data.append(self.memoryMonitor.get_memory_usage())
        data['memory']= self.memoryMonitor.get_meminfo()
        data['loadavg'] = self.systemLoadMonitor.get_loadavg()
        data['http'] = self.httpMonitor.get_http_connections()
        data['sshattempts'] = self.sshAccessMonitor.get_ssh_access_attempts()
        data['availabity'] = self.availabilityMonitor.get_availability_info()
        data['backup'] = self.backupMonitor.get_backup_info()
        data['encryption'] = self.encryptionMonitor.get_encryption_info()
        data['integrity'] = self.integrityMonitor.get_integrity_info()
        data['malware'] = self.malwareMonitor.get_malware_info()
        data['password'] = self.passwordMonitor.get_password_security()
        data['vulnerability'] = self.vulnerabilityMonitor.get_vulnerability_info()

        return data

    def send_monitoring_data(self,data):
        '''
        connect to a server to send monitoring data
        '''
        try:
            logging.debug('Connecting to Monitoring Server...')
            server = xmlrpclib.ServerProxy('%s:%s'%(settings.SERVER, settings.SERVER_PORT))
            sent = server.get_vm_notification(data)
        except (socket_error, xmlrpclib.Fault, xmlrpclib.ProtocolError, xmlrpclib.ResponseError), error_code:
            print error_code
            logging.error('Err: (%s)'%error_code)
Beispiel #4
0
    def __init__(self):
        self.memoryMonitor = MemoryMonitor()
        self.systemLoadMonitor = SystemLoadMonitor()
        self.httpMonitor = HTTPConMonitor()
        self.sshAccessMonitor = SSHAccessMonitor()
        self.availabilityMonitor = AvailabilityMonitor()
        self.backupMonitor = BackupMonitor()
        self.encryptionMonitor = EncryptionMonitor()
        self.integrityMonitor = IntegrityMonitor()
        self.malwareMonitor = MalwareMonitor()
        self.passwordMonitor = PasswordMonitor()
        self.vulnerabilityMonitor = VulnerabilityMonitor()

        while True:
            now = datetime.datetime.now()
            print now.strftime("%d-%m-%Y %H:%M:%S")
            data = self.get_monitoring_data()
            self.send_monitoring_data(data)
            time.sleep(300) # 5 minutes for now