Skip to content

limanmys/mib-parser-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mibparser

This project is used to convert mib file to json format.
The created json format is in tree format.
This code takes the nodes id and the nodes parent id and finally creates an OID with this information
Informs the user if another mib file is needed for the created json format

Requirements

There must be required mib files in the specified path

Installation

go get github.com/limanmys/mib-parser-go

Usage

package main

import (
    "fmt"
    "log"

    "github.com/limanmys/mib-parser-go"
)

func main() {
    mibparserObject, err := mibparser.Load(mibparser.NewPath("./mib-files"))
    if err != nil {
        log.Fatalf("error when loading mibparser path")
    }
    mibTree, err := mibparserObject.GetJSONTree()
    if err != nil {
        log.Fatalf("error when parsing mib files, err " + err.Error())
    }
    fmt.Println("mibTree ", mibTree)

    mibObjects, err := mibparserObject.GetObjects()
    if err != nil {
        log.Fatalf("error when parsing mib files, err " + err.Error())
    }
    fmt.Println("mibObjects", mibObjects)
}

Created by

Logo