[IMP] maintenance_server_monitoring:

* add cron
* ssh in other module
* new maintenance request if error
* disk usage test
This commit is contained in:
clementthomas
2024-04-03 18:13:02 +02:00
parent 5f9119c4e8
commit b18940fe56
11 changed files with 445 additions and 36 deletions

View File

@@ -0,0 +1 @@
from . import maintenance_equipment

View File

@@ -0,0 +1,20 @@
from odoo import fields, models
import subprocess
import sys
import psutil
class MaintenanceEquipment(models.Model):
_inherit = 'maintenance.equipment'
server_domain = fields.Char('Server Domain')
ssh_private_key_path = fields.Char("SSH private key path", default="/opt/odoo/auto/dev/ssh_keys/id_rsa")
def get_ssh_connection(self):
import paramiko
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(self.server_domain, username="root", key_filename=self.ssh_private_key_path)
return ssh