public function action_index() { $data = Model_Data::find(1); $sources = Model_Source::find()->where('meta_update_user', $this->user)->get(); $monitor = array('iconw' => $data['iconw'], 'iconc' => $data['iconc'], 'iconu' => $data['iconu'], 'osdw' => $data['osdw'], 'osdu' => $data['osdu'], 'osdc' => $data['osdc'], 'soundw' => $data['soundw'], 'soundu' => $data['soundu'], 'soundc' => $data['soundc']); $s = array(); foreach ($sources as $source) { $type = Model_Type::find($source->typeID); array_push($s, array('id' => $source['id'], 'type' => array('id' => $source->typeID, 'name' => $type->name), 'content' => $source['content'])); } echo json_encode(array('data' => $monitor, 'sources' => $s)); }
public function action_index() { $elements = array(); $total = array('hostTotals' => 0, 'hostTotalsUP' => 0, 'hostTotalsDOWN' => 0, 'hostTotalsCRITICAL' => 0, 'hostTotalsUNREACHABLE' => 0, 'hostTotalsPROBLEMS' => 0, 'serviceTotals' => 0, 'serviceTotalsOK' => 0, 'serviceTotalsWARNING' => 0, 'serviceTotalsCRITICAL' => 0, 'serviceTotalsUNKNOWN' => 0, 'serviceTotalsPROBLEMS' => 0, 'serviceTotals' => 0, 'nagiosCode' => array()); $sources = Model_Source::find()->where('meta_update_user', $this->user)->get(); foreach ($sources as $source) { $nagios = new \Nagios($source->content); $nagios->auth($source->user, $source->pass); $data = $nagios->getData($total); $elements = array_merge($elements, $data[0]); $total = $data[1]; } echo json_encode(array('total' => $total, 'services' => $elements)); }
public function action_index() { if ($_POST) { $val = \Validation::forge(); $val->add_field('id', 'Action', 'required|min_length[1]|max_length[20]'); $val->add_field('action', 'Value', 'required|min_length[1]|max_length[20]'); if ($val->run()) { $source = Model_Source::find($val->validated('id')); if ($val->validated('action') == 'get') { $type = Model_Type::find($source->typeID); $out = array('id' => $source['id'], 'type' => array('id' => $source->typeID, 'name' => $type->name), 'user' => $source['user'], 'pass' => $source['pass'], 'content' => $source['content']); } if ($val->validated('action') == 'remove') { } echo json_encode(array('source' => $out)); } } }
public function init($graph, $dev, $port, $sourceID) { //$graph=Model_Graphing_Cacti::find()->where('graphID',$id)->where('deviceID',$dev); $this->port = $port; ob_start(); $this->device = \Basic\Model_Device::find($dev); $this->heightlimit = 750; $this->_setTitle(); $this->_AddPage(); $this->zoom = 0.75; $source = Model_Source::find($sourceID); if ($source) { $this->cacti = new \Cacti($source->content); $code = $this->cacti->authentication($source->user, $source->pass); if ($code == 200) { $this->angle = 0; $this->SetFont('Verdana', '', 12); $this->SetTextColor(0, 0, 0); $this->_graph($graph, 5, 1, 20); ///$this->Ln(-180); $this->Rotate(90); $this->text(-80, 72, 'Daily'); $this->Rotate(0); $this->_graph($graph, 5, 2, 205); $this->Rotate(90); $this->text(-265, 72, 'Weekly'); $this->Rotate(0); $this->_graph($graph, 5, 3, 390); $this->Rotate(90); $this->text(-450, 72, 'Monthly'); $this->Rotate(0); $this->_graph($graph, 5, 4, 575); $this->Rotate(90); $this->text(-635, 72, 'Yearly'); $this->Rotate(0); } } /* $this->setTypeOfDevice(); $this->rack=Model_Rack::find($this->device->rack); $this->template=Model_Device_Template::find($this->device->get('type')); $this->heightlimit=750; $this->_setTitle(); $this->_AddPage(); $this->zoom=0.75; $this->rack_set(90,50,$this->rack->size); $this->device_general(); if($this->action[0]==1) $this->device_hardware(); if($this->action[1]==1) $this->device_network(); if($this->action[2]==1) $this->device_notes(); $this->device_power(); */ }