After more review it appears Zenoss has added this ability in Zenoss 4.0 with the JSON API called named 'remodel' on the Device Router. There is a back port that will allow this to work with Zenoss 3.X; patch attached. Please note that I make no guarantees that the patch will work successfully on your system.
The patch can be applied with the command: patch -p4 < changeset_r40190.diff
From the Perl interface side of things, this brings up an interesting topic. I believe I'm going to have to start updating the Zenoss Perl interface to work with the latest version of Zenoss, which has new features such as remodel (however most just came out). If a user doesn't have the appropriate version to execute the call, then I will have to Carp with an error. Given that this is open source, I really dont want to get into maintaining documentation for the rapid development of the Zenoss Monitoring Solution across multiple versions. With that said, some thought process will need to go into the method call validation.
For the impatient, you can add the following block of code to
Zenoss::Router::Device (Device.pm) that will allow you to execute the requested remodel command via the Zenoss module; $api->device_remodel({deviceUid => '/Servers/Linux/DeviceName})
Note, I havent tested this!
Show quoted text#======================================================================
# device_remodel
#======================================================================
sub device_remodel {
my ($self, $args) = @_;
$args = {} if !$args;
# Argument definition
my $definition = {
required => ['deviceUid'],
};
# Check the args
$self->_check_args($args, $definition);
# Route the request
$self->_router_request(
{
location => $self->DEVICE_LOCATION,
action => $self->DEVICE_ACTION,
method => 'remodel',
data => [$args],
}
);
} # END device_remodel
Index: /trunk/core/Products/Zuul/routers/device.py
===================================================================
--- /trunk/core/Products/Zuul/routers/device.py (revision 39869)
+++ /trunk/core/Products/Zuul/routers/device.py (revision 40190)
@@ -1228,4 +1228,18 @@
return DirectResponse.succeed(jobId=jobStatus.id)
+ @require('Manage Device')
+ def remodel(self, deviceUid):
+ """
+ Submit a job to have a device remodeled.
+
+ @type deviceUid: string
+ @param deviceUid: Device uid to have local template
+ @rtype: DirectResponse
+ @return: B{Properties}:
+ - jobId: (string) ID of the add device job
+ """
+ jobStatus = self._getFacade().remodel(deviceUid)
+ return DirectResponse.succeed(jobId=jobStatus.id)
+
@require('Edit Local Templates')
def addLocalTemplate(self, deviceUid, templateId):
Index: /trunk/core/Products/Zuul/facades/devicefacade.py
===================================================================
--- /trunk/core/Products/Zuul/facades/devicefacade.py (revision 39524)
+++ /trunk/core/Products/Zuul/facades/devicefacade.py (revision 40190)
@@ -279,4 +279,10 @@
return jobStatus
+ def remodel(self, deviceUid):
+ fake_request = {'CONTENT_TYPE': 'xml'}
+ device = self._getObject(deviceUid)
+ return device.getPerformanceServer().collectDevice(
+ device, background=True, REQUEST=fake_request)
+
def addLocalTemplate(self, deviceUid, templateId):
"""