HaradaKumiko
HaradaKumiko

Reputation: 1

Check OLT ZTE C300 Using SNMP & PHP

So i want to develop web apps for monitoring my OLT ZTE C30O Using SNMP and PHP

i already success get a list my ONU

here's my code and output

<?php
$ip = 'my-ip';
$community = 'my-community';

$session = new SNMP(SNMP::VERSION_2C, $ip, $community);

$oid = '.1.3.6.1.4.1.3902.1012.3.28.1.1.3'; 

$result = $session->walk($oid);

if ($result === false) {
    echo "Failed to get value from OID $oid";
} else {
    print_r($result);
}

$session->close();
?>

//output
Array ( [iso.3.6.1.4.1.3902.1012.3.28.1.1.3.268566784.1] => STRING: "ONU-1:1" [iso.3.6.1.4.1.3902.1012.3.28.1.1.3.268566784.2] => STRING: "ONU-1:2" [iso.3.6.1.4.1.3902.1012.3.28.1.1.3.268566784.3] => STRING: "ONU-1:3" [iso.3.6.1.4.1.3902.1012.3.28.1.1.3.268567040.2] => STRING: "ONU-2:2" [iso.3.6.1.4.1.3902.1012.3.28.1.1.3.268567296.1] => STRING: "ONU-3:1" [iso.3.6.1.4.1.3902.1012.3.28.1.1.3.268567296.2] => STRING: "ONU-3:2" [iso.3.6.1.4.1.3902.1012.3.28.1.1.3.268567296.3] => STRING: "ONU-3:3" [iso.3.6.1.4.1.3902.1012.3.28.1.1.3.268567552.1] => STRING: "ONU-4:1" [iso.3.6.1.4.1.3902.1012.3.28.1.1.3.268567808.1] => STRING: "ONU-5:1" [iso.3.6.1.4.1.3902.1012.3.28.1.1.3.268701696.1] => STRING: "ONU-16:1" [iso.3.6.1.4.1.3902.1012.3.28.1.1.3.268701696.2] => STRING: "ONU-16:2")

the next step is i want to get my info at my ONU is working or not, i saw a video on youtube

he can get the status ONU with this code

<?php
$status = snmpwalk("OLT-IP", "community", "ZXGPON-SERVICE-MIB::zxGponOntPhaseState"); 
?>
//output
INTEGER: Working (3)

When i do it by myself with this code, it return error

<?php
$ip = 'my-ip';
$community = 'my-community';

// Buat session SNMP baru
$session = new SNMP(SNMP::VERSION_2C, $ip, $community);

$oid = 'ZXGPON-SERVICE-MIB::zxGponOntPhaseState'; 

$result = $session->walk($oid);

if ($result === false) {
    echo "Failed to get value from OID $oid";
} else {
    print_r($result);
}

// Tutup session SNMP
$session->close();
?>

//output

Warning: SNMP::walk(): Invalid object identifier: ZXGPON-SERVICE-MIB::zxGponOntPhaseState in C:\xampp\htdocs\snmpsuck\3.php on line 10
"Failed to get value from OID ZXGPON-SERVICE-MIB::zxGponOntPhaseState

I'm still confused whether what I'm doing is right or not, can anyone tell me what I should do?

I read in the forum I need a MIB file but I don't understand what the next step is.

Upvotes: 0

Views: 1506

Answers (1)

Ari Imam B
Ari Imam B

Reputation: 1

Use this id instead

.1.3.6.1.4.1.3902.1012.3.28.2.1.4

Upvotes: 0

Related Questions