Configuration & Administration

Expand all | Collapse all

Automate Resetting of IP Address for Device

  • 1.  Automate Resetting of IP Address for Device

    Posted 01-13-2020 10:43 PM
    Zenoss has a menu command to "Reset/Change IP Address" for a device. We have several devices that change IP addresses on a regular basis. What is the actual command which is doing the "reset"? We want to create a notification to automatically run when this condition is detected.

    We are running Zenoss 6.2.1.

    Thanks in advance,


  • 2.  RE: Automate Resetting of IP Address for Device

    Posted 01-14-2020 01:36 AM
    Hello Larry,

    You could launch a reset command through the API. This is exactly what the Web UI is doing.

    Here is the definition of this command in the DeviceRouter:

    resetIp(self, uids, hashcheck, uid=None, ranges=(), params=None, sort='name', dir='ASC', ip='')

    source code 

    Reset IP address(es) of device(s) to the results of a DNS lookup or a manually set address

    • uids ([string]) - List of device uids with IP's to reset
    • hashcheck (string) - Hashcheck for the devices (from getDevices())
    • uid (string) - (optional) Organizer to use when using ranges to get additional uids (default: None)
    • ranges ([integer]) - (optional) List of two integers that are the min/max values of a range of uids to include (default: None)
    • params (dictionary) - (optional) Key-value pair of filters for this search. Can be one of the following: name, ipAddress, deviceClass, or productionState (default: None)
    • sort (string) - (optional) Key on which to sort the return result (default: 'name')
    • dir (string) - (optional) Sort order; can be either 'ASC' or 'DESC' (default: 'ASC')
    • ip (string) - (optional) IP to set device to. Empty string causes DNS lookup (default: '')
    Returns: DirectResponse
    Success or failure message
    I tested it on one of my devices and here was the payload:

    action: "DeviceRouter",
    method: "resetIp",
    data: [
        {ip: "",
         uids: [
         hashcheck: null}],

    type: "rpc",
    tid: 1}

    Kind regards,

    Laurent Hemeryck
    Monitoring Engineer

  • 3.  RE: Automate Resetting of IP Address for Device

    Posted 01-14-2020 04:02 PM
    Thanks Laurent! I will give that a shot.


  • 4.  RE: Automate Resetting of IP Address for Device

    Posted 27 days ago
    We have a few virtual devices that become invisible to the network when they are inactive. We have a global name that resolves to the IP of the currently up/active device. So perhaps similar needs to you.

    I wrote this transform for in the /Status/Ping event class and has been working pretty well

    # For hosts with 'powered off' vsphere redunancy, the below updates the IP immediatly following failovers.
    # This transaction is blocking, so minimize additions to list.
    if evt.device in ('globalname1','globalname2'):
      evt.message = '%s %s' % (evt.message, evt.device)
      import socket, sys
        DNSIP = socket.gethostbyname(evt.device)  # get the IP address from DNS
        if (device.manageIp != DNSIP):            # if the devices IP doesnt match the DNSIP
          from transaction import commit
          device.setManageIp(DNSIP)               # set the new IP on the device, push and commit.
          evt.message += "\nThe IP address was reset to match DNS."  #downgrade the event to informational 
          evt.severity = 2  
      except Exception as e:
        evt.message = "%s %s" % (evt.message, e)​

    Morgan Timney
    The Southern Company
    Birmingham AL