def manage_pagerTest(self, REQUEST=None): ''' Send a test page ''' destSettings = self.getUserSettings(self.getId()) destPagers = [ x.strip() for x in (destSettings.getPagerAddresses() or []) ] msg = None fqdn = socket.getfqdn() srcId = self.getUser().getId() testMsg = ('Test sent by %s' % srcId + ' from the Zenoss installation on %s.' % fqdn) for destPager in destPagers: result, errorMsg = Utils.sendPage(destPager, testMsg, self.dmd.pageCommand) if result: msg = 'Test page sent to %s' % ', '.join(destPagers) else: msg = 'Test failed: %s' % errorMsg break if not destPagers: msg = 'Test page not sent, user has no pager number.' if REQUEST: messaging.IMessageSender(self).sendToBrowser( 'Pager Test', msg) return self.callZenScreen(REQUEST) else: return msg
def executeOnTarget(self, notification, signal, target): """ @TODO: handle the deferred parameter on the sendPage call. """ log.debug('Executing action: Page') data = self._signalToContextDict(signal, notification) if signal.clear: log.debug('This is a clearing signal.') subject = processTalSource( notification.content['clear_subject_format'], **data) else: subject = processTalSource(notification.content['subject_format'], **data) success, errorMsg = Utils.sendPage( target, subject, self.page_command, #deferred=self.options.cycle) deferred=False) if success: log.debug("Notification '%s' sent page to %s." % (notification, target)) else: raise ActionExecutionException( "Notification '%s' failed to send page to %s. (%s)" % (notification, target, errorMsg))
def executeOnTarget(self, notification, signal, target): """ @TODO: handle the deferred parameter on the sendPage call. """ log.debug("Executing action: Page") data = self._signalToContextDict(signal, notification) if signal.clear: log.debug("This is a clearing signal.") subject = processTalSource(notification.content["clear_subject_format"], **data) else: subject = processTalSource(notification.content["subject_format"], **data) success, errorMsg = Utils.sendPage( target, subject, self.page_command, # deferred=self.options.cycle) deferred=False, ) if success: log.debug("Notification '%s' sent page to %s." % (notification, target)) else: raise ActionExecutionException( "Notification '%s' failed to send page to %s. (%s)" % (notification, target, errorMsg) )