Python Advance script sensor PRTG ssh connection

46 Views Asked by At

I'm developing a project, it's about using the advance script sensors of PRTG. Testing the ssh connection in visual studio works fine but when I use the script in the sensor doesn't. I think I have to pass the authentication params in the sensor and not in the script but I don't know how. This is the ssh connection part of my code.

data_router = {}

    data_router ['host'] = host

    connect_data = {
            
        'device_type' : 'cisco_ios',
        'host' : host,
        'username' : 'router1',
        'password' : '12345678'
    }

    time.sleep(5)

    connection = ConnectHandler(**connect_data)

    time.sleep(5)

    enable_command = connection.send_command("enable")

    time.sleep(5)


def main():
    
    hosts = ['192.168.0.1']

    facts = []

    for host in hosts:
        
        facts.append(ssh_con(host))

        time.sleep(5)

I'm expecting more than a code or a part of a code an answer of my doubt, and if someone knows more of this sensors that information will be very welcome, because paessler docs doesn't help me a lot.

0

There are 0 best solutions below