Documentation ¶
Index ¶
- Constants
- func ConvertJson2Yaml(file string, log logger.ContextL) error
- type Constraint
- type Device
- type MIB
- type Match
- type MibDB
- func (db *MibDB) Close()
- func (mdb *MibDB) FindProfile(sysid string, sysdesc string, mibProfile string) *Profile
- func (db *MibDB) GetForKey(oid string) (*kt.Mib, error)
- func (db *MibDB) GetForOid(oid string, profile string, description string) (map[string]*kt.Mib, kt.Provider, error)
- func (db *MibDB) GetForOidRecur(oid string, profile string, description string) (map[string]*kt.Mib, kt.Provider, bool, error)
- func (db *MibDB) GetTrap(oid string) *Trap
- func (mdb *MibDB) LoadProfiles(profileDir string) (int, error)
- func (mdb *MibDB) LoadPyMibSet(profileDir string) (int, error)
- type MibList
- type OID
- type Profile
- func (p *Profile) DumpOids(log logger.ContextL)
- func (p *Profile) GetDeviceSysComment(sysid string) string
- func (p *Profile) GetMetadata(enabledMibs []string) (map[string]*kt.Mib, map[string]*kt.Mib)
- func (p *Profile) GetMetrics(enabledMibs []string, counterTimeSec int) (map[string]*kt.Mib, map[string]*kt.Mib, int)
- func (p *Profile) GetMibs() map[string]bool
- func (p *Profile) GetProfileName(override string) string
- type PySMIMib
- type PySMIMibFile
- type PySyntax
- type PySysidMap
- type Tag
- type Trap
- type TrapBase
- type Type
Constants ¶
const (
SysidMap = "SYSID_MAP.json"
)
Variables ¶
This section is empty.
Functions ¶
func ConvertJson2Yaml ¶
* Code to generate a yaml from file a .mib file. To run:
* Install https://github.com/etingof/pysmi. (pip install pysmi) * Install librenms. (git clone https://github.com/librenms/librenms.git) * Download your mib target. Place into /tmp/snmp_in directory. Create /tmp/snmp_out directory. Use https://help.zscaler.com/downloads/zia/documentation-knowledgebase/analytics/snmp-mibs/about-the-zscaler-snmp-mibs/zscaler-nss-mib.mib as a test if you need one.
* Run mibdump: mibdump.py --mib-source=file:///path/to/src/librenms/mibs --mib-source=file:///tmp/snmp_in --generate-mib-texts --ignore-errors --destination-format json --destination-directory=/tmp/snmp_out MY_MIB_NAME
For example, using mib ZSCALER-NSS-MIB: mibdump.py --mib-source=file:///home/pye/src/librenms/mibs --mib-source=file:///tmp/snmp_in --generate-mib-texts --ignore-errors --destination-format json --destination-directory=/tmp/snmp_out ZSCALER-NSS-MIB
* Verify that /tmp/snmp_out/ZSCALER-NSS-MIB.json exists
* Convert to yaml docker run --rm -v /tmp/snmp_out:/snmp_out kentik/ktranslate:v2 -snmp /etc/ktranslate/snmp-base.yaml -snmp_json2yaml /snmp_out/MY_MIB_NAME.json
For example, using ZSCALER-NSS-MIB: docker run --rm -v /tmp/snmp_out:/snmp_out kentik/ktranslate:v2 -snmp /etc/ktranslate/snmp-base.yaml -snmp_json2yaml /snmp_out/ZSCALER-NSS-MIB.json
* The final yaml file is at /tmp/snmp_out/ZSCALER-NSS-MIB.yaml
NOTE: human checking is still needed. Notably, you will need to:
1) Add an extends section. 2) Ensure that the sysobjectid section is present and sane.
Types ¶
type Constraint ¶
type MIB ¶
type MIB struct { Mib string `yaml:"MIB,omitempty"` Table OID `yaml:"table,omitempty"` Symbols []OID `yaml:"symbols,omitempty"` MetricTags []Tag `yaml:"metric_tags,omitempty"` ForcedType string `yaml:"forced_type,omitempty"` Symbol OID `yaml:"symbol,omitempty"` IsInterface bool `yaml:"is_interface,omitempty"` // contains filtered or unexported fields }
type MibDB ¶
type MibDB struct {
// contains filtered or unexported fields
}
func (*MibDB) FindProfile ¶
type OID ¶
type OID struct { Oid string `yaml:"OID,omitempty"` Name string `yaml:"name,omitempty"` Enum map[string]int64 `yaml:"enum,omitempty"` Tag string `yaml:"tag,omitempty"` Desc string `yaml:"description,omitempty"` Conversion string `yaml:"conversion,omitempty"` PollTime int `yaml:"poll_time_sec,omitempty"` MatchAttr []string `yaml:"match_attributes,omitempty"` Format string `yaml:"format,omitempty"` AllowDup bool `yaml:"allow_duplicate,omitempty"` }
func (*OID) GetTableName ¶
type Profile ¶
type Profile struct { logger.ContextL `yaml:"-"` Metrics []MIB `yaml:"metrics,omitempty"` Extends []string `yaml:"extends,omitempty"` Device Device `yaml:"device,omitempty"` MetricTags []Tag `yaml:"metric_tags,omitempty"` Sysobjectid kt.StringArray `yaml:"sysobjectid,omitempty"` From string `yaml:"from,omitempty"` Provider kt.Provider `yaml:"provider,omitempty"` NoUseBulkWalkAll bool `yaml:"no_use_bulkwalkall"` Matches map[string]string `yaml:"matches"` MatchesList []Match `yaml:"matches_list"` SysMap map[string]string // contains filtered or unexported fields }
func (*Profile) GetDeviceSysComment ¶
func (*Profile) GetMetadata ¶
func (*Profile) GetMetrics ¶
func (*Profile) GetProfileName ¶
type PySMIMibFile ¶
type PySysidMap ¶
type Trap ¶
type Trap struct { Oid string `yaml:"trap_oid"` Name string `yaml:"trap_name"` DropUndefined bool `yaml:"drop_undefined"` Events []OID `yaml:"events"` }
func (*Trap) DropUndefinedVars ¶
type Type ¶
type Type struct {
Constraints Constraint `json:"constraints"`
}