0% found this document useful (0 votes)
20 views3 pages

Code Show ZTE ONTs Status

Uploaded by

Ozil Real
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views3 pages

Code Show ZTE ONTs Status

Uploaded by

Ozil Real
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

Sub ONTstatus()

Dim OID As String


Dim strIP As String
Dim strChatID As String
Dim strMessage As String
Dim strPostData As String
Dim strFSPid As String
On Error Resume Next

'Clear Cells contents


For x = 1 To 64
Cells(x + 9, 3).ClearContents
Next

strIP = Cells(4, 2).Value


strFSPid = Cells(4, 5).Value
strChatID = "your_chat_group_id"

' The status of the ONUs


'OID: .1.3.6.1.4.1.3902.1012.3.28.2.1.4
'Description:
'INTEGER { Logging ( 0 ), Los ( 1 ), syncMib ( 2 ), Working ( 3 ), Dyinggasp ( 4 ),
AuthFailed ( 5 ),Offline ( 6 ) }
Set objSNMP = CreateObject("OlePrn.OleSNMP")
objSNMP.Open strIP, "public", 2, 1000
For x = 1 To 64
OID = ".1.3.6.1.4.1.3902.1012.3.28.2.1.4." & strFSPid & "." & x
ontS = objSNMP.get(OID)

If ontS = 3 Then
Cells(x + 9, 3).Font.Color = vbGreen
Cells(x + 9, 3).Value = "Working"
ontS = 7
ElseIf ontS = 6 Then
Cells(x + 9, 3).Font.Color = vbRed
Cells(x + 9, 3).Value = "offline"
strMessage = "Warning : " & Cells(4, 1).Value & " " & Cells(x + 9,
1).Value & " " & Cells(x + 9, 2).Value & " : is Offline"
strPostData = "chat_id=" & strChatID & "&text=" & strMessage
SendMessage (strPostData)
ontS = 7
ElseIf ontS = 0 Then
Cells(x + 9, 3).Font.Color = vbBlack
Cells(x + 9, 3).Value = "logging"
ontS = 7
ElseIf ontS = 1 Then
Cells(x + 9, 3).Font.Color = vbBlack
Cells(x + 9, 3).Value = "los"
ontS = 7
ElseIf ps = 2 Then
Cells(x + 9, 3).Font.Color = vbBlack
Cells(x + 9, 3).Value = "syncMib"
ontS = 7
ElseIf ps = 4 Then
Cells(x + 9, 3).Font.Color = vbBlack
Cells(x + 9, 3).Value = "dyinggasp"
ontS = 7
ElseIf ps = 5 Then
Cells(x + 9, 3).Font.Color = vbBlack
Cells(x + 9, 3).Value = "authFailed"
ontS = 7
Else
Cells(x + 9, 3).Value = " "
End If
Next
objSNMP.Close
End Sub
Function SendMessage(strPostData)
Dim objRequest As Object

Set objRequest = CreateObject("MSXML2.XMLHTTP")

With objRequest
.Open "POST", "https://api.telegram.org/your_telegram_token/sendMessage?",
False
.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
.send (strPostData)

End With

End Function

-----------------------------------------------------------------------------------
---------------------------
ONU Status
Name: zxGponOntPhaseState
OID: .1.3.6.1.4.1.3902.1012.3.28.2.1.4
Description:
INTEGER { logging ( 0 ) , los ( 1 ) , syncMib ( 2 ) , working ( 3 ) , dyinggasp ( 4
) , authFailed ( 5 ) ,
offline ( 6 ) }

-------------------------------------------Frame/Slot/Port
ID---------------------------------------------------

1/1/1 268501248
1/1/2 268501504
1/1/3 268501760
1/1/4 268502016
1/1/5 268502272
1/1/6 268502528
1/1/7 268502784
1/1/8 268503040
1/1/9 268503296
1/1/10 268503552
1/1/11 268503808
1/1/12 268504064
1/1/13 268504320
1/1/14 268504576
1/1/15 268504832
1/1/16 268505088
1/2/1 268566784
1/2/2 268567040
1/2/3 268567296
1/2/4 268567552
1/2/5 268567808
1/2/6 268568064
1/2/7 268568320
1/2/8 268568576
1/2/9 268568832
1/2/10 268569088
1/2/11 268569344
1/2/12 268569600
1/2/13 268569856
1/2/14 268570112
1/2/15 268570368
1/2/16 268570624

You might also like