#!/usr/bin/php log(__FILE__, "start."); $fhi = fopen('php://stdin', 'r'); $serv_infl = null; $perc_sev = null; $lcnt = 0; $sys_time = date('y.m.d h:i:s'); while (null != ($inp_line = fgets($fhi))) { $logger->log(__FILE__, trim($inp_line)); $lcnt++; switch ($lcnt) { case 1: $inst_addr = new InstAddr(InstAddrSel::NAME, trim($inp_line)); break; case 2: $aux_arr1 = explode ('[', $inp_line); $aux_arr2 = explode (']', $aux_arr1[1]); $agt_addr = $aux_arr2[0]; break; case 3: # uptime, not used break; default: $var_bind = explode ('=', $inp_line); switch (trim($var_bind[0])) { case '.1.3.6.1.6.3.1.1.4.1.0': $trap_oid = trim($var_bind[1]); break; case '.1.3.6.1.6.3.1.1.4.1.1': $serv_infl = new ServInfl((int)$var_bind[1]); break; case '.1.3.6.1.6.3.1.1.4.1.2': $perc_sev = new AlarmSevty((int)$var_bind[1]); break; case '.1.3.6.1.6.3.1.1.4.1.3': $serv_infl = new ServInfl(ServInfl::SI_THRAFF,(int)$var_bind[1]); break; case '.1.3.6.1.4.1.9.2.1.3': # hostname $inst_addr = new InstAddr(InstAddrSel::NAME, trim($var_bind[1])); break; case '.1.3.6.1.2.1.25.1.2': # hrSystemDate $sys_time = trim($var_bind[1]); break; } } } if ($trap_oid == ".1.3.6.1.4.1.193.96.115.1.0") { // systemUp $xml= "$inst_addr"; $ai = new AlarmInterfaceAdministration(); $ai->triggerWatchdog($xml); } else { AlarmManagement::processAlarm( $inst_addr, $sys_time, new EventSpec(EventSel::OID_NUMBER, $trap_oid), $serv_infl, $perc_sev); } ?>