public function zmqDiagnostics(&$diagnostic_errors) { if (!Configure::read('Plugin.ZeroMQ_enable')) { return 1; } App::uses('PubSubTool', 'Tools'); $pubSubTool = new PubSubTool(); if (!$pubSubTool->checkIfPythonLibInstalled()) { $diagnostic_errors++; return 2; } if ($pubSubTool->checkIfRunning()) { return 0; } $diagnostic_errors++; return 3; }
/** * Performs all the actions required to publish an event * * @param unknown_type $id */ public function publish($id, $passAlong = null, $jobId = null) { $this->id = $id; $this->recursive = 0; $event = $this->read(null, $id); if ($jobId) { $this->Behaviors->unload('SysLogLogable.SysLogLogable'); } else { // update the DB to set the published flag // for background jobs, this should be done already $fieldList = array('published', 'id', 'info', 'publish_timestamp'); $event['Event']['published'] = 1; $event['Event']['publish_timestamp'] = time(); $this->save($event, array('fieldList' => $fieldList)); } $uploaded = false; if (Configure::read('Plugin.ZeroMQ_enable')) { App::uses('PubSubTool', 'Tools'); $pubSubTool = new PubSubTool(); $hostOrg = Configure::read('MISP.org'); $fullEvent = $this->fetchEvent($id, false, $hostOrg, false); $pubSubTool->publishEvent($fullEvent[0]); } if ($event['Event']['distribution'] > 1) { $uploaded = $this->uploadEventToServersRouter($id, $passAlong); } else { return true; } return $uploaded; }
public function statusZeroMQServer() { App::uses('PubSubTool', 'Tools'); $pubSubTool = new PubSubTool(); $result = $pubSubTool->statusCheck(); if (!empty($result)) { $this->set('events', $result['publishCount']); $this->set('time', date('Y/m/d H:i:s', $result['timestamp'])); $this->set('time2', date('Y/m/d H:i:s', $result['timestampSettings'])); } $this->render('ajax/zeromqstatus'); }
private function statusZeroMQServer() { if (!$this->_isSiteAdmin()) { throw new MethodNotAllowedException(); } App::uses('PubSubTool', 'Tools'); $pubSubTool = new PubSubTool(); $result = $pubSubTool->statusCheck(); if (!empty($result)) { $this->set('events', $result['publishCount']); $this->set('time', date('Y/m/d H:i:s', $result['timestamp'])); $this->set('time2', date('Y/m/d H:i:s', $result['timestampSettings'])); } $this->render('ajax/zeromqstatus'); }
public function zmqDiagnostics(&$diagnostic_errors) { if (!Configure::read('Plugin.ZeroMQ_enable')) { return 1; } App::uses('PubSubTool', 'Tools'); $pubSubTool = new PubSubTool(); if ($pubSubTool->testZMQ()) { return 0; } $diagnostic_errors++; return 2; }