@@ -65,10 +65,10 @@ discard block |
||
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** Mib management |
| 68 | - * Post param : action=update_mib_db : update mib database |
|
| 69 | - * Post param : ation=check_update : check if mib update is finished |
|
| 70 | - * File post : mibfile -> save mib file |
|
| 71 | - */ |
|
| 68 | + * Post param : action=update_mib_db : update mib database |
|
| 69 | + * Post param : ation=check_update : check if mib update is finished |
|
| 70 | + * File post : mibfile -> save mib file |
|
| 71 | + */ |
|
| 72 | 72 | public function mibAction() |
| 73 | 73 | { |
| 74 | 74 | $this->prepareTabs()->activate('mib'); |
@@ -87,22 +87,22 @@ discard block |
||
| 87 | 87 | $return=exec('icingacli trapdirector mib update --pid /tmp/trapdirector_update.pid'); |
| 88 | 88 | if (preg_match('/OK/',$return)) |
| 89 | 89 | { |
| 90 | - $this->_helper->json(array('status'=>'OK')); |
|
| 90 | + $this->_helper->json(array('status'=>'OK')); |
|
| 91 | 91 | } |
| 92 | 92 | // Error |
| 93 | 93 | $this->_helper->json(array('status'=>$return)); |
| 94 | 94 | } |
| 95 | 95 | if ($action == 'check_update') |
| 96 | 96 | { |
| 97 | - $file=@fopen('/tmp/trapdirector_update.pid','r'); |
|
| 98 | - if ($file == false) |
|
| 99 | - { // process is dead |
|
| 100 | - $this->_helper->json(array('status'=>'tu quoque fili','err'=>'Cannot open file')); |
|
| 101 | - return; |
|
| 102 | - } |
|
| 103 | - $pid=fgets($file); |
|
| 104 | - $output=array(); |
|
| 105 | - $retVal=0; |
|
| 97 | + $file=@fopen('/tmp/trapdirector_update.pid','r'); |
|
| 98 | + if ($file == false) |
|
| 99 | + { // process is dead |
|
| 100 | + $this->_helper->json(array('status'=>'tu quoque fili','err'=>'Cannot open file')); |
|
| 101 | + return; |
|
| 102 | + } |
|
| 103 | + $pid=fgets($file); |
|
| 104 | + $output=array(); |
|
| 105 | + $retVal=0; |
|
| 106 | 106 | exec('ps '.$pid,$output,$retVal); |
| 107 | 107 | if ($retVal == 0) |
| 108 | 108 | { // process is alive |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | } |
| 111 | 111 | else |
| 112 | 112 | { // process is dead |
| 113 | - $this->_helper->json(array('status'=>'tu quoque fili','err'=>'no proc'.$pid)); |
|
| 113 | + $this->_helper->json(array('status'=>'tu quoque fili','err'=>'no proc'.$pid)); |
|
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | $this->_helper->json(array('status'=>'ERR : no '.$action.' action possible' )); |
@@ -123,26 +123,26 @@ discard block |
||
| 123 | 123 | $destDir=array_shift($DirConf); |
| 124 | 124 | if (!is_dir($destDir)) |
| 125 | 125 | { |
| 126 | - $this->view->uploadStatus="ERROR : no $destDir directory, check module configuration"; |
|
| 126 | + $this->view->uploadStatus="ERROR : no $destDir directory, check module configuration"; |
|
| 127 | 127 | } |
| 128 | 128 | else |
| 129 | 129 | { |
| 130 | - if (!is_writable($destDir)) |
|
| 131 | - { |
|
| 132 | - $this->view->uploadStatus="ERROR : $destDir directory is not writable"; |
|
| 133 | - } |
|
| 134 | - else |
|
| 135 | - { |
|
| 136 | - $destination = $destDir .'/'.$name; //$this->Module()->getBaseDir() . "/mibs/$name"; |
|
| 137 | - if (move_uploaded_file($_FILES['mibfile']['tmp_name'],$destination)===false) |
|
| 138 | - { |
|
| 139 | - $this->view->uploadStatus="ERROR, file $destination not loaded. Check file and path name or selinux violations"; |
|
| 140 | - } |
|
| 141 | - else |
|
| 142 | - { |
|
| 143 | - $this->view->uploadStatus="File $name uploaded in $destDir"; |
|
| 144 | - } |
|
| 145 | - } |
|
| 130 | + if (!is_writable($destDir)) |
|
| 131 | + { |
|
| 132 | + $this->view->uploadStatus="ERROR : $destDir directory is not writable"; |
|
| 133 | + } |
|
| 134 | + else |
|
| 135 | + { |
|
| 136 | + $destination = $destDir .'/'.$name; //$this->Module()->getBaseDir() . "/mibs/$name"; |
|
| 137 | + if (move_uploaded_file($_FILES['mibfile']['tmp_name'],$destination)===false) |
|
| 138 | + { |
|
| 139 | + $this->view->uploadStatus="ERROR, file $destination not loaded. Check file and path name or selinux violations"; |
|
| 140 | + } |
|
| 141 | + else |
|
| 142 | + { |
|
| 143 | + $this->view->uploadStatus="File $name uploaded in $destDir"; |
|
| 144 | + } |
|
| 145 | + } |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | } |
@@ -275,20 +275,20 @@ discard block |
||
| 275 | 275 | // TODO : see if useless |
| 276 | 276 | class UploadForm extends Form |
| 277 | 277 | { |
| 278 | - public function __construct($options = null) |
|
| 279 | - { |
|
| 280 | - parent::__construct($options); |
|
| 281 | - $this->addElements2(); |
|
| 282 | - } |
|
| 278 | + public function __construct($options = null) |
|
| 279 | + { |
|
| 280 | + parent::__construct($options); |
|
| 281 | + $this->addElements2(); |
|
| 282 | + } |
|
| 283 | 283 | |
| 284 | - public function addElements2() |
|
| 285 | - { |
|
| 286 | - // File Input |
|
| 287 | - $file = new File('mib-file'); |
|
| 288 | - $file->setLabel('Mib upload'); |
|
| 289 | - //->setAttrib('multiple', null); |
|
| 290 | - $this->addElement($file); |
|
| 284 | + public function addElements2() |
|
| 285 | + { |
|
| 286 | + // File Input |
|
| 287 | + $file = new File('mib-file'); |
|
| 288 | + $file->setLabel('Mib upload'); |
|
| 289 | + //->setAttrib('multiple', null); |
|
| 290 | + $this->addElement($file); |
|
| 291 | 291 | $button = new Submit("upload",array('ignore'=>false)); |
| 292 | 292 | $this->addElement($button);//->setIgnore(false); |
| 293 | - } |
|
| 293 | + } |
|
| 294 | 294 | } |
@@ -22,18 +22,18 @@ discard block |
||
| 22 | 22 | /************ Trapdb ***********/ |
| 23 | 23 | try |
| 24 | 24 | { |
| 25 | - $db = $this->getDb()->getConnection(); |
|
| 26 | - $query = $db->select()->from( |
|
| 25 | + $db=$this->getDb()->getConnection(); |
|
| 26 | + $query=$db->select()->from( |
|
| 27 | 27 | $this->getModuleConfig()->getTrapTableName(), |
| 28 | 28 | array('COUNT(*)') |
| 29 | 29 | ); |
| 30 | 30 | $this->view->trap_count=$db->fetchOne($query); |
| 31 | - $query = $db->select()->from( |
|
| 31 | + $query=$db->select()->from( |
|
| 32 | 32 | $this->getModuleConfig()->getTrapDataTableName(), |
| 33 | 33 | array('COUNT(*)') |
| 34 | 34 | ); |
| 35 | 35 | $this->view->trap_object_count=$db->fetchOne($query); |
| 36 | - $query = $db->select()->from( |
|
| 36 | + $query=$db->select()->from( |
|
| 37 | 37 | $this->getModuleConfig()->getTrapRuleName(), |
| 38 | 38 | array('COUNT(*)') |
| 39 | 39 | ); |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | } |
| 45 | 45 | catch (Exception $e) |
| 46 | 46 | { |
| 47 | - $this->displayExitError('status',$e->getMessage()); |
|
| 47 | + $this->displayExitError('status', $e->getMessage()); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /*************** Log destination *******************/ |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | } |
| 60 | 60 | catch (Exception $e) |
| 61 | 61 | { |
| 62 | - $this->displayExitError('status',$e->getMessage()); |
|
| 62 | + $this->displayExitError('status', $e->getMessage()); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | } |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | if ($action == 'update_mib_db') |
| 86 | 86 | { // Do the update in background |
| 87 | 87 | $return=exec('icingacli trapdirector mib update --pid /tmp/trapdirector_update.pid'); |
| 88 | - if (preg_match('/OK/',$return)) |
|
| 88 | + if (preg_match('/OK/', $return)) |
|
| 89 | 89 | { |
| 90 | 90 | $this->_helper->json(array('status'=>'OK')); |
| 91 | 91 | } |
@@ -94,32 +94,32 @@ discard block |
||
| 94 | 94 | } |
| 95 | 95 | if ($action == 'check_update') |
| 96 | 96 | { |
| 97 | - $file=@fopen('/tmp/trapdirector_update.pid','r'); |
|
| 97 | + $file=@fopen('/tmp/trapdirector_update.pid', 'r'); |
|
| 98 | 98 | if ($file == false) |
| 99 | 99 | { // process is dead |
| 100 | - $this->_helper->json(array('status'=>'tu quoque fili','err'=>'Cannot open file')); |
|
| 100 | + $this->_helper->json(array('status'=>'tu quoque fili', 'err'=>'Cannot open file')); |
|
| 101 | 101 | return; |
| 102 | 102 | } |
| 103 | 103 | $pid=fgets($file); |
| 104 | 104 | $output=array(); |
| 105 | 105 | $retVal=0; |
| 106 | - exec('ps '.$pid,$output,$retVal); |
|
| 106 | + exec('ps '.$pid, $output, $retVal); |
|
| 107 | 107 | if ($retVal == 0) |
| 108 | 108 | { // process is alive |
| 109 | 109 | $this->_helper->json(array('status'=>'Alive and kicking')); |
| 110 | 110 | } |
| 111 | 111 | else |
| 112 | 112 | { // process is dead |
| 113 | - $this->_helper->json(array('status'=>'tu quoque fili','err'=>'no proc'.$pid)); |
|
| 113 | + $this->_helper->json(array('status'=>'tu quoque fili', 'err'=>'no proc'.$pid)); |
|
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | - $this->_helper->json(array('status'=>'ERR : no '.$action.' action possible' )); |
|
| 116 | + $this->_helper->json(array('status'=>'ERR : no '.$action.' action possible')); |
|
| 117 | 117 | } |
| 118 | 118 | /** Check for mib file UPLOAD */ |
| 119 | 119 | if (isset($_FILES['mibfile'])) |
| 120 | 120 | { |
| 121 | 121 | $name=$_FILES['mibfile']['name']; |
| 122 | - $DirConf=explode(':',$this->Config()->get('config', 'snmptranslate_dirs')); |
|
| 122 | + $DirConf=explode(':', $this->Config()->get('config', 'snmptranslate_dirs')); |
|
| 123 | 123 | $destDir=array_shift($DirConf); |
| 124 | 124 | if (!is_dir($destDir)) |
| 125 | 125 | { |
@@ -133,8 +133,8 @@ discard block |
||
| 133 | 133 | } |
| 134 | 134 | else |
| 135 | 135 | { |
| 136 | - $destination = $destDir .'/'.$name; //$this->Module()->getBaseDir() . "/mibs/$name"; |
|
| 137 | - if (move_uploaded_file($_FILES['mibfile']['tmp_name'],$destination)===false) |
|
| 136 | + $destination=$destDir.'/'.$name; //$this->Module()->getBaseDir() . "/mibs/$name"; |
|
| 137 | + if (move_uploaded_file($_FILES['mibfile']['tmp_name'], $destination) === false) |
|
| 138 | 138 | { |
| 139 | 139 | $this->view->uploadStatus="ERROR, file $destination not loaded. Check file and path name or selinux violations"; |
| 140 | 140 | } |
@@ -150,13 +150,13 @@ discard block |
||
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | // snmptranslate tests |
| 153 | - $snmptranslate = $this->Config()->get('config', 'snmptranslate'); |
|
| 153 | + $snmptranslate=$this->Config()->get('config', 'snmptranslate'); |
|
| 154 | 154 | $this->view->snmptranslate_bin=$snmptranslate; |
| 155 | 155 | $this->view->snmptranslate_state='warn'; |
| 156 | - if (is_executable ( $snmptranslate )) |
|
| 156 | + if (is_executable($snmptranslate)) |
|
| 157 | 157 | { |
| 158 | - $translate=exec($snmptranslate . ' 1'); |
|
| 159 | - if (preg_match('/iso/',$translate)) |
|
| 158 | + $translate=exec($snmptranslate.' 1'); |
|
| 159 | + if (preg_match('/iso/', $translate)) |
|
| 160 | 160 | { |
| 161 | 161 | $this->view->snmptranslate='works fine'; |
| 162 | 162 | $this->view->snmptranslate_state='ok'; |
@@ -174,46 +174,46 @@ discard block |
||
| 174 | 174 | // mib database |
| 175 | 175 | |
| 176 | 176 | $this->view->mibDbCount=$this->getMIB()->countObjects(); |
| 177 | - $this->view->mibDbCountTrap=$this->getMIB()->countObjects(null,21); |
|
| 177 | + $this->view->mibDbCountTrap=$this->getMIB()->countObjects(null, 21); |
|
| 178 | 178 | |
| 179 | 179 | // mib dirs |
| 180 | 180 | $DirConf=$this->Config()->get('config', 'snmptranslate_dirs'); |
| 181 | - $dirArray=explode(':',$DirConf); |
|
| 181 | + $dirArray=explode(':', $DirConf); |
|
| 182 | 182 | |
| 183 | 183 | // Get base directories from net-snmp-config |
| 184 | 184 | $output=$matches=array(); |
| 185 | 185 | $retVal=0; |
| 186 | - $sysDirs=exec('net-snmp-config --default-mibdirs',$output,$retVal); |
|
| 187 | - if ($retVal==0) |
|
| 186 | + $sysDirs=exec('net-snmp-config --default-mibdirs', $output, $retVal); |
|
| 187 | + if ($retVal == 0) |
|
| 188 | 188 | { |
| 189 | - $dirArray=array_merge($dirArray,explode(':',$sysDirs)); |
|
| 189 | + $dirArray=array_merge($dirArray, explode(':', $sysDirs)); |
|
| 190 | 190 | } |
| 191 | 191 | else |
| 192 | 192 | { |
| 193 | - $translateOut=exec($this->Config()->get('config', 'snmptranslate') . ' -Dinit_mib .1.3 2>&1 | grep MIBDIRS'); |
|
| 194 | - if (preg_match('/MIBDIRS.*\'([^\']+)\'/',$translateOut,$matches)) |
|
| 193 | + $translateOut=exec($this->Config()->get('config', 'snmptranslate').' -Dinit_mib .1.3 2>&1 | grep MIBDIRS'); |
|
| 194 | + if (preg_match('/MIBDIRS.*\'([^\']+)\'/', $translateOut, $matches)) |
|
| 195 | 195 | { |
| 196 | - $dirArray=array_merge($dirArray,explode(':',$matches[1])); |
|
| 196 | + $dirArray=array_merge($dirArray, explode(':', $matches[1])); |
|
| 197 | 197 | } |
| 198 | 198 | else |
| 199 | 199 | { |
| 200 | - array_push($dirArray,'Install net-snmp-config to see system directories'); |
|
| 200 | + array_push($dirArray, 'Install net-snmp-config to see system directories'); |
|
| 201 | 201 | } |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | $this->view->dirArray=$dirArray; |
| 205 | 205 | |
| 206 | 206 | $output=null; |
| 207 | - foreach (explode(':',$DirConf) as $mibdir) |
|
| 207 | + foreach (explode(':', $DirConf) as $mibdir) |
|
| 208 | 208 | { |
| 209 | - exec('ls '.$mibdir.' | grep -v traplist.txt',$output); |
|
| 209 | + exec('ls '.$mibdir.' | grep -v traplist.txt', $output); |
|
| 210 | 210 | } |
| 211 | 211 | //$i=0;$listFiles='';while (isset($output[$i])) $listFiles.=$output[$i++]; |
| 212 | 212 | //$this->view->fileList=explode(' ',$listFiles); |
| 213 | 213 | $this->view->fileList=$output; |
| 214 | 214 | |
| 215 | 215 | // Zend form |
| 216 | - $this->view->form= new UploadForm(); |
|
| 216 | + $this->view->form=new UploadForm(); |
|
| 217 | 217 | //$this->view->form= new Form('upload-form'); |
| 218 | 218 | |
| 219 | 219 | |
@@ -237,18 +237,18 @@ discard block |
||
| 237 | 237 | $this->view->templateForm_output=''; |
| 238 | 238 | if (isset($postData['template_name']) && isset($postData['template_revert_time'])) |
| 239 | 239 | { |
| 240 | - $template_create = 'icingacli director service create --json \'{ "check_command": "dummy", '; |
|
| 241 | - $template_create .= '"check_interval": "' .$postData['template_revert_time']. '", "check_timeout": "20", "disabled": false, "enable_active_checks": true, "enable_event_handler": true, "enable_notifications": true, "enable_passive_checks": true, "enable_perfdata": true, "max_check_attempts": "1", '; |
|
| 242 | - $template_create .= '"object_name": "'.$postData['template_name'].'", "object_type": "template", "retry_interval": "'.$postData['template_revert_time'].'"}\''; |
|
| 240 | + $template_create='icingacli director service create --json \'{ "check_command": "dummy", '; |
|
| 241 | + $template_create.='"check_interval": "'.$postData['template_revert_time'].'", "check_timeout": "20", "disabled": false, "enable_active_checks": true, "enable_event_handler": true, "enable_notifications": true, "enable_passive_checks": true, "enable_perfdata": true, "max_check_attempts": "1", '; |
|
| 242 | + $template_create.='"object_name": "'.$postData['template_name'].'", "object_type": "template", "retry_interval": "'.$postData['template_revert_time'].'"}\''; |
|
| 243 | 243 | $output=array(); |
| 244 | 244 | $ret_code=0; |
| 245 | - exec($template_create,$output,$ret_code); |
|
| 245 | + exec($template_create, $output, $ret_code); |
|
| 246 | 246 | if ($ret_code != 0) |
| 247 | 247 | { |
| 248 | - $this->displayExitError("Status -> Services","Error creating template : ".$output[0].'<br>Command was : '.$template_create); |
|
| 248 | + $this->displayExitError("Status -> Services", "Error creating template : ".$output[0].'<br>Command was : '.$template_create); |
|
| 249 | 249 | } |
| 250 | - exec('icingacli director config deploy',$output,$ret_code); |
|
| 251 | - $this->view->templateForm_output='Template '.$postData['template_name']. ' created'; |
|
| 250 | + exec('icingacli director config deploy', $output, $ret_code); |
|
| 251 | + $this->view->templateForm_output='Template '.$postData['template_name'].' created'; |
|
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | // template creation form |
@@ -261,13 +261,13 @@ discard block |
||
| 261 | 261 | { |
| 262 | 262 | return $this->getTabs()->add('status', array( |
| 263 | 263 | 'label' => $this->translate('Status'), |
| 264 | - 'url' => $this->getModuleConfig()->urlPath() . '/status') |
|
| 264 | + 'url' => $this->getModuleConfig()->urlPath().'/status') |
|
| 265 | 265 | )->add('mib', array( |
| 266 | 266 | 'label' => $this->translate('MIB Management'), |
| 267 | - 'url' => $this->getModuleConfig()->urlPath() . '/status/mib') |
|
| 267 | + 'url' => $this->getModuleConfig()->urlPath().'/status/mib') |
|
| 268 | 268 | )->add('services', array( |
| 269 | 269 | 'label' => $this->translate('Services management'), |
| 270 | - 'url' => $this->getModuleConfig()->urlPath() . '/status/services') |
|
| 270 | + 'url' => $this->getModuleConfig()->urlPath().'/status/services') |
|
| 271 | 271 | ); |
| 272 | 272 | } |
| 273 | 273 | } |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | // TODO : see if useless |
| 276 | 276 | class UploadForm extends Form |
| 277 | 277 | { |
| 278 | - public function __construct($options = null) |
|
| 278 | + public function __construct($options=null) |
|
| 279 | 279 | { |
| 280 | 280 | parent::__construct($options); |
| 281 | 281 | $this->addElements2(); |
@@ -284,11 +284,11 @@ discard block |
||
| 284 | 284 | public function addElements2() |
| 285 | 285 | { |
| 286 | 286 | // File Input |
| 287 | - $file = new File('mib-file'); |
|
| 287 | + $file=new File('mib-file'); |
|
| 288 | 288 | $file->setLabel('Mib upload'); |
| 289 | 289 | //->setAttrib('multiple', null); |
| 290 | 290 | $this->addElement($file); |
| 291 | - $button = new Submit("upload",array('ignore'=>false)); |
|
| 292 | - $this->addElement($button);//->setIgnore(false); |
|
| 291 | + $button=new Submit("upload", array('ignore'=>false)); |
|
| 292 | + $this->addElement($button); //->setIgnore(false); |
|
| 293 | 293 | } |
| 294 | 294 | } |
@@ -41,8 +41,7 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | $this->view->trap_days_delete=$this->getDBConfigValue('db_remove_days'); |
| 43 | 43 | |
| 44 | - } |
|
| 45 | - catch (Exception $e) |
|
| 44 | + } catch (Exception $e) |
|
| 46 | 45 | { |
| 47 | 46 | $this->displayExitError('status',$e->getMessage()); |
| 48 | 47 | } |
@@ -56,8 +55,7 @@ discard block |
||
| 56 | 55 | $this->view->currentLogFile=$this->getDBConfigValue('log_file'); |
| 57 | 56 | $this->view->logLevels=$this->getModuleConfig()->getlogLevels(); |
| 58 | 57 | $this->view->currentLogLevel=$this->getDBConfigValue('log_level'); |
| 59 | - } |
|
| 60 | - catch (Exception $e) |
|
| 58 | + } catch (Exception $e) |
|
| 61 | 59 | { |
| 62 | 60 | $this->displayExitError('status',$e->getMessage()); |
| 63 | 61 | } |
@@ -107,8 +105,7 @@ discard block |
||
| 107 | 105 | if ($retVal == 0) |
| 108 | 106 | { // process is alive |
| 109 | 107 | $this->_helper->json(array('status'=>'Alive and kicking')); |
| 110 | - } |
|
| 111 | - else |
|
| 108 | + } else |
|
| 112 | 109 | { // process is dead |
| 113 | 110 | $this->_helper->json(array('status'=>'tu quoque fili','err'=>'no proc'.$pid)); |
| 114 | 111 | } |
@@ -124,21 +121,18 @@ discard block |
||
| 124 | 121 | if (!is_dir($destDir)) |
| 125 | 122 | { |
| 126 | 123 | $this->view->uploadStatus="ERROR : no $destDir directory, check module configuration"; |
| 127 | - } |
|
| 128 | - else |
|
| 124 | + } else |
|
| 129 | 125 | { |
| 130 | 126 | if (!is_writable($destDir)) |
| 131 | 127 | { |
| 132 | 128 | $this->view->uploadStatus="ERROR : $destDir directory is not writable"; |
| 133 | - } |
|
| 134 | - else |
|
| 129 | + } else |
|
| 135 | 130 | { |
| 136 | 131 | $destination = $destDir .'/'.$name; //$this->Module()->getBaseDir() . "/mibs/$name"; |
| 137 | 132 | if (move_uploaded_file($_FILES['mibfile']['tmp_name'],$destination)===false) |
| 138 | 133 | { |
| 139 | 134 | $this->view->uploadStatus="ERROR, file $destination not loaded. Check file and path name or selinux violations"; |
| 140 | - } |
|
| 141 | - else |
|
| 135 | + } else |
|
| 142 | 136 | { |
| 143 | 137 | $this->view->uploadStatus="File $name uploaded in $destDir"; |
| 144 | 138 | } |
@@ -160,13 +154,11 @@ discard block |
||
| 160 | 154 | { |
| 161 | 155 | $this->view->snmptranslate='works fine'; |
| 162 | 156 | $this->view->snmptranslate_state='ok'; |
| 163 | - } |
|
| 164 | - else |
|
| 157 | + } else |
|
| 165 | 158 | { |
| 166 | 159 | $this->view->snmptranslate='can execute but no resolution'; |
| 167 | 160 | } |
| 168 | - } |
|
| 169 | - else |
|
| 161 | + } else |
|
| 170 | 162 | { |
| 171 | 163 | $this->view->snmptranslate='cannot execute'; |
| 172 | 164 | } |
@@ -187,15 +179,13 @@ discard block |
||
| 187 | 179 | if ($retVal==0) |
| 188 | 180 | { |
| 189 | 181 | $dirArray=array_merge($dirArray,explode(':',$sysDirs)); |
| 190 | - } |
|
| 191 | - else |
|
| 182 | + } else |
|
| 192 | 183 | { |
| 193 | 184 | $translateOut=exec($this->Config()->get('config', 'snmptranslate') . ' -Dinit_mib .1.3 2>&1 | grep MIBDIRS'); |
| 194 | 185 | if (preg_match('/MIBDIRS.*\'([^\']+)\'/',$translateOut,$matches)) |
| 195 | 186 | { |
| 196 | 187 | $dirArray=array_merge($dirArray,explode(':',$matches[1])); |
| 197 | - } |
|
| 198 | - else |
|
| 188 | + } else |
|
| 199 | 189 | { |
| 200 | 190 | array_push($dirArray,'Install net-snmp-config to see system directories'); |
| 201 | 191 | } |