mib2c -c mib2c. mfd. conf что писать здесь?
This module can be used with tables, not branches or entire MIBs. Please specify and OID that is a table. (OID: имя папретра)
afdxSwitchLowBagValueLoopbackTestResult OBJECT-TYPE SYNTAX INTEGER { passed (1), failed (2) } ACCESS read-only STATUS current DESCRIPTION "The result of the Low Bag Value Loopback test executed on ground. The possible values are: - passed (1), - failed (2)." ::= { afdxSwitchPrivate 2 }
export MIBS="/home/robo/netsnmp/afdxswitch.mib"
mib2c -c mib2c.scalar.conf afdxSwitchLowBagValueLoopbackTestResult
C++ (Qt)#include <net-snmp/net-snmp-config.h>#include <net-snmp/net-snmp-includes.h>#include <net-snmp/agent/net-snmp-agent-includes.h>#include "afdxSwitchLowBagValueLoopbackTestResult.h" /** Initializes the afdxSwitchLowBagValueLoopbackTestResult module */voidinit_afdxSwitchLowBagValueLoopbackTestResult(void){ const oid afdxSwitchLowBagValueLoopbackTestResult_oid[] = { 1,3,6,1,4,1,8419,11,1,2 }; DEBUGMSGTL(("afdxSwitchLowBagValueLoopbackTestResult", "Initializing\n")); netsnmp_register_scalar( netsnmp_create_handler_registration("afdxSwitchLowBagValueLoopbackTestResult", handle_afdxSwitchLowBagValueLoopbackTestResult, afdxSwitchLowBagValueLoopbackTestResult_oid, OID_LENGTH(afdxSwitchLowBagValueLoopbackTestResult_oid), HANDLER_CAN_RONLY ));} inthandle_afdxSwitchLowBagValueLoopbackTestResult(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests){ /* We are never called for a GETNEXT if it's registered as a "instance", as it's "magically" handled for us. */ /* a instance handler also only hands us one request at a time, so we don't need to loop over a list of requests; we'll only get one. */ switch(reqinfo->mode) { case MODE_GET: snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER, //_____________Что с этим делать?_________________ //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! /* XXX: a pointer to the scalar's data */, /* XXX: the length of the data in bytes */); //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! break; default: /* we should never get here, so this is a really bad error */ snmp_log(LOG_ERR, "unknown mode (%d) in handle_afdxSwitchLowBagValueLoopbackTestResult\n", reqinfo->mode ); return SNMP_ERR_GENERR; } return SNMP_ERR_NOERROR;}
/* XXX: a pointer to the scalar's data */, /* XXX: the length of the data in bytes */
./configure --with-mib-modules="name"
make
sudo make install
cd /usr/local/sbin/./snmpd
snmpget -v2c -c public localhost 1.3.6.1.4.1.8419.11.1.1Timeout: No Response from localhost.
Warning: no access control information configured. (Config search path: /usr/local/etc/snmp:/usr/local/share/snmp:/usr/local/lib/snmp:/home/evgen/.snmp) It's unlikely this agent can serve any useful purpose in this state. Run "snmpconf -g basic_setup" to help you configure the snmpd.conf file for this agent.NET-SNMP version 5.9.1
snmpset -v2c -c public localhost .1.3.6.1.4.1.8419.11.1.1.0 = 5Error in packet.Reason: (genError) A general failure occured
snmpget -v2c -c public localhost .1.3.6.1.4.1.8419.11.1.1.0 AIRBUS-AFDX-SW-MIB::afdxSwitchEDACTestResult.0 = INTEGER: 10
snmpwalk -v2c -c public localhost .1.3.6.1.4.1.8419.11.1.1.0 AIRBUS-AFDX-SW-MIB::afdxSwitchEDACTestResult.0 = INTEGER: 10
AIRBUS-AFDX-SW-MIB DEFINITIONS ::= BEGINIMPORTS enterprises, Counter, IpAddress, TimeTicks FROM RFC1155-SMI TRAP-TYPE FROM RFC-1215 OBJECT-TYPE FROM RFC-1212; collins-Avionics OBJECT IDENTIFIER ::= { enterprises 8419 }AFDX OBJECT IDENTIFIER ::= { collins-Avionics 11 }-- Groups in AIRBUS AFDX Switch MIBafdxSwitchPrivate OBJECT IDENTIFIER ::= { AFDX 1 }---- The afdxSwitchPrivate group-- -- The afdxSwitchPrivate group contains objects related to the RC Switch-- internal architecture.--afdxSwitchEDACTestResult OBJECT-TYPE SYNTAX INTEGER { passed (1), failed (2) } ACCESS read-write STATUS current DESCRIPTION "The result of the EDAC test executed on ground. The possible values are: - passed (1), - failed (2)." ::= { afdxSwitchPrivate 1 }END
################################################################################# EXAMPLE.conf:# An example configuration file for configuring the Net-SNMP agent ('snmpd')# See the 'snmpd.conf(5)' man page for details## Some entries are deliberately commented out, and will need to be explicitly activated################################################################################## AGENT BEHAVIOUR## Listen for connections from the local system onlyagentAddress udp:127.0.0.1:161# Listen for connections on all interfaces (both IPv4 *and* IPv6)#agentAddress udp:161,udp6:[::1]:161################################################################################# SNMPv3 AUTHENTICATION## Note that these particular settings don't actually belong here.# They should be copied to the file /var/lib/snmp/snmpd.conf# and the passwords changed, before being uncommented in that file *only*.# Then restart the agent# createUser authOnlyUser MD5 "remember to change this password"# createUser authPrivUser SHA "remember to change this one too" DES# createUser internalUser MD5 "this is only ever used internally, but still change the password"# If you also change the usernames (which might be sensible),# then remember to update the other occurances in this example config file to match.################################################################################# ACCESS CONTROL# # system + hrSystem groups onlyview systemonly included .1.3.6.1.2.1.1view systemonly included .1.3.6.1.2.1.25.1view all included .1 # Full access from the local host#rocommunity public localhostrwcommunity public localhost # Default access to basic system info rocommunity public default -V systemonly # rocommunity6 is for IPv6 rocommunity6 public default -V systemonly # Full access from an example network # Adjust this network address to match your local # settings, change the community string, # and check the 'agentAddress' setting above#rocommunity secret 10.0.0.0/16 # Full read-only access for SNMPv3 rouser authOnlyUser # Full write access for encrypted requests # Remember to activate the 'createUser' lines above# rwuser authPrivUser priv# It's no longer typically necessary to use the full 'com2sec/group/access' configuration# r[ow]user and r[ow]community, together with suitable views, should cover most requirements################################################################################# SYSTEM INFORMATION## Note that setting these values here, results in the corresponding MIB objects being 'read-only'# See snmpd.conf(5) for more detailssysLocation Sitting on the Dock of the BaysysContact Me <me@example.org> # Application + End-to-End layerssysServices 72## Process Monitoring# # At least one 'mountd' processproc mountd # No more than 4 'ntalkd' processes - 0 is OKproc ntalkd 4 # At least one 'sendmail' process, but no more than 10proc sendmail 10 1# Walk the UCD-SNMP-MIB::prTable to see the resulting output# Note that this table will be empty if there are no "proc" entries in the snmpd.conf file## Disk Monitoring# # 10MBs required on root disk, 5% free on /var, 10% free on all other disksdisk / 10000disk /var 5%includeAllDisks 10%# Walk the UCD-SNMP-MIB::dskTable to see the resulting output# Note that this table will be empty if there are no "disk" entries in the snmpd.conf file## System Load# # Unacceptable 1-, 5-, and 15-minute load averagesload 12 10 5# Walk the UCD-SNMP-MIB::laTable to see the resulting output# Note that this table *will* be populated, even without a "load" entry in the snmpd.conf file################################################################################# ACTIVE MONITORING# # send SNMPv1 traps trapsink localhost public # send SNMPv2c traps#trap2sink localhost public # send SNMPv2c INFORMs#informsink localhost public# Note that you typically only want *one* of these three lines# Uncommenting two (or all three) will result in multiple copies of each notification.## Event MIB - automatically generate alerts# # Remember to activate the 'createUser' lines aboveiquerySecName internalUser rouser internalUser # generate traps on UCD error conditionsdefaultMonitors yes # generate traps on linkUp/DownlinkUpDownNotifications yes################################################################################# EXTENDING THE AGENT### Arbitrary extension commands# extend test1 /bin/echo Hello, world! extend-sh test2 echo Hello, world! ; echo Hi there ; exit 35#extend-sh test3 /bin/sh /tmp/shtest# Note that this last entry requires the script '/tmp/shtest' to be created first,# containing the same three shell commands, before the line is uncommented# Walk the NET-SNMP-EXTEND-MIB tables (nsExtendConfigTable, nsExtendOutput1Table# and nsExtendOutput2Table) to see the resulting output# Note that the "extend" directive supercedes the previous "exec" and "sh" directives# However, walking the UCD-SNMP-MIB::extTable should still returns the same output,# as well as the fuller results in the above tables.## "Pass-through" MIB extension command##pass .1.3.6.1.4.1.8072.2.255 /bin/sh PREFIX/local/passtest#pass .1.3.6.1.4.1.8072.2.255 /usr/bin/perl PREFIX/local/passtest.pl# Note that this requires one of the two 'passtest' scripts to be installed first,# before the appropriate line is uncommented.# These scripts can be found in the 'local' directory of the source distribution,# and are not installed automatically.# Walk the NET-SNMP-PASS-MIB::netSnmpPassExamples subtree to see the resulting output## AgentX Sub-agents# # Run as an AgentX master agent master agentx # Listen for network connections (from localhost) # rather than the default named socket /var/agentx/master#agentXSocket tcp:localhost:705setserialno 462583681################################################################ snmpNotifyFilterTable persistent data###############################################################engineBoots 28oldEngineID 0x80001f888025d749712555646200000000################################################################ ifXTable persistent data#ifXTable .1 14:0 18:0x $ifXTable .2 14:0 18:0x $ifXTable .3 14:0 18:0x $##############################################################
C++ (Qt)/* * Note: this file originally auto-generated by mib2c * using mib2c.scalar.conf */ #include <net-snmp/net-snmp-config.h>#include <net-snmp/net-snmp-includes.h>#include <net-snmp/agent/net-snmp-agent-includes.h>#include "collins_Avionics.h" static u_char mydata = 10; /** Initializes the collins_Avionics module */voidinit_collins_Avionics(void){ const oid afdxSwitchEDACTestResult_oid[] = { 1,3,6,1,4,1,8419,11,1,1 }; DEBUGMSGTL(("collins_Avionics", "Initializing\n")); netsnmp_register_scalar( netsnmp_create_handler_registration("afdxSwitchEDACTestResult", handle_afdxSwitchEDACTestResult, afdxSwitchEDACTestResult_oid, OID_LENGTH(afdxSwitchEDACTestResult_oid), HANDLER_CAN_RWRITE ));} inthandle_afdxSwitchEDACTestResult(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests){ int ret; /* We are never called for a GETNEXT if it's registered as a "instance", as it's "magically" handled for us. */ /* a instance handler also only hands us one request at a time, so we don't need to loop over a list of requests; we'll only get one. */ switch(reqinfo->mode) { case MODE_GET: case MODE_GETNEXT: snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER, &mydata /* XXX: a pointer to the scalar's data */, sizeof(mydata) /* XXX: the length of the data in bytes */); break; /* * SET REQUEST * * multiple states in the transaction. See: * http://www.net-snmp.org/tutorial-5/toolkit/mib_module/set-actions.jpg */ //case MODE_SET_RESERVE1: // /* or you could use netsnmp_check_vb_type_and_size instead */ // ret = netsnmp_check_vb_type(requests->requestvb, ASN_INTEGER); // if ( ret != SNMP_ERR_NOERROR ) { // netsnmp_set_request_error(reqinfo, requests, ret ); // } // break; //case MODE_SET_RESERVE2: // /* XXX malloc "undo" storage buffer */ // if (/* XXX if malloc, or whatever, failed: */) { // netsnmp_set_request_error(reqinfo, requests, SNMP_ERR_RESOURCEUNAVAILABLE); // } // break; //case MODE_SET_FREE: // /* XXX: free resources allocated in RESERVE1 and/or // RESERVE2. Something failed somewhere, and the states // below won't be called. */ // break; case MODE_SET_ACTION: ///* XXX: perform the value change here */ mydata = *(requests->requestvb->val.integer); //if (/* XXX: error? */) { // netsnmp_set_request_error(reqinfo, requests, /* some error */); //} break; //case MODE_SET_COMMIT: // /* XXX: delete temporary storage */ // if (/* XXX: error? */) { // /* try _really_really_ hard to never get to this point */ // netsnmp_set_request_error(reqinfo, requests, SNMP_ERR_COMMITFAILED); // } // break; //case MODE_SET_UNDO: // /* XXX: UNDO and return to previous value for the object */ // if (/* XXX: error? */) { // /* try _really_really_ hard to never get to this point */ // netsnmp_set_request_error(reqinfo, requests, SNMP_ERR_UNDOFAILED); // } // break; default: /* we should never get here, so this is a really bad error */ snmp_log(LOG_ERR, "unknown mode (%d) in handle_afdxSwitchEDACTestResult\n", reqinfo->mode ); return SNMP_ERR_GENERR; } return SNMP_ERR_NOERROR;}
C++ (Qt) /* * Note: this file originally auto-generated by mib2c * using mib2c.scalar.conf */ #include <net-snmp/net-snmp-config.h>#include <net-snmp/net-snmp-includes.h>#include <net-snmp/agent/net-snmp-agent-includes.h>#include "collins_Avionics.h" static u_char mydata = 10; /** Initializes the collins_Avionics module */voidinit_collins_Avionics(void){ const oid afdxSwitchEDACTestResult_oid[] = { 1,3,6,1,4,1,8419,11,1,1 }; DEBUGMSGTL(("collins_Avionics", "Initializing\n")); netsnmp_register_scalar( netsnmp_create_handler_registration("afdxSwitchEDACTestResult", handle_afdxSwitchEDACTestResult, afdxSwitchEDACTestResult_oid, OID_LENGTH(afdxSwitchEDACTestResult_oid), HANDLER_CAN_RWRITE ));} inthandle_afdxSwitchEDACTestResult(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests){ int ret; /* We are never called for a GETNEXT if it's registered as a "instance", as it's "magically" handled for us. */ /* a instance handler also only hands us one request at a time, so we don't need to loop over a list of requests; we'll only get one. */ switch(reqinfo->mode) { case MODE_GET: case MODE_GETNEXT: snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER, &mydata /* XXX: a pointer to the scalar's data */, sizeof(mydata) /* XXX: the length of the data in bytes */); break; /* * SET REQUEST * * multiple states in the transaction. See: * http://www.net-snmp.org/tutorial-5/toolkit/mib_module/set-actions.jpg */ case MODE_SET_RESERVE1: // /* or you could use netsnmp_check_vb_type_and_size instead */ // ret = netsnmp_check_vb_type(requests->requestvb, ASN_INTEGER); // if ( ret != SNMP_ERR_NOERROR ) { // netsnmp_set_request_error(reqinfo, requests, ret ); // } break; case MODE_SET_RESERVE2: // /* XXX malloc "undo" storage buffer */ // if (/* XXX if malloc, or whatever, failed: */) { // netsnmp_set_request_error(reqinfo, requests, SNMP_ERR_RESOURCEUNAVAILABLE); // } break; case MODE_SET_FREE: // /* XXX: free resources allocated in RESERVE1 and/or // RESERVE2. Something failed somewhere, and the states // below won't be called. */ break; case MODE_SET_ACTION: ///* XXX: perform the value change here */ mydata = *(requests->requestvb->val.integer); //if (/* XXX: error? */) { // netsnmp_set_request_error(reqinfo, requests, /* some error */); //} break; case MODE_SET_COMMIT: // /* XXX: delete temporary storage */ // if (/* XXX: error? */) { // /* try _really_really_ hard to never get to this point */ // netsnmp_set_request_error(reqinfo, requests, SNMP_ERR_COMMITFAILED); // } break; case MODE_SET_UNDO: // /* XXX: UNDO and return to previous value for the object */ // if (/* XXX: error? */) { // /* try _really_really_ hard to never get to this point */ // netsnmp_set_request_error(reqinfo, requests, SNMP_ERR_UNDOFAILED); // } break; default: /* we should never get here, so this is a really bad error */ snmp_log(LOG_ERR, "unknown mode (%d) in handle_afdxSwitchEDACTestResult\n", reqinfo->mode ); return SNMP_ERR_GENERR; } return SNMP_ERR_NOERROR;}
https://sourceforge-net.translate.goog/p/net-snmp/mailman/message/14633956/?_x_tr_sl=en&_x_tr_tl=ru&_x_tr_hl=ru&_x_tr_pto=sc
DPS-MIB-V38 DEFINITIONS ::= BEGINIMPORTS DisplayString FROM RFC1213-MIBOBJECT-TYPE FROM RFC-1212enterprises FROM RFC1155-SMI;dpsInc OBJECT IDENTIFIER ::= {enterprises 2682}dpsAlarmControl OBJECT IDENTIFIER ::= {dpsInc 1}tmonXM OBJECT IDENTIFIER ::= {dpsAlarmControl 1}tmonIdent OBJECT IDENTIFIER ::= {tmonXM 1}tmonIdentManufacturer OBJECT-TYPESYNTAX DisplayStringACCESS read-onlySTATUS mandatoryDESCRIPTION “The TMON/XM Unit manufacturer.”::= {tmonIdent 1}
DisplayString ::= OCTET STRING
AIRBUS-AFDX-SW-MIB DEFINITIONS ::= BEGINIMPORTS enterprises, Counter, IpAddress, TimeTicks FROM RFC1155-SMI TRAP-TYPE FROM RFC-1215 OBJECT-TYPE FROM RFC-1212;......afdxRedundancyStatsEntry OBJECT-TYPE SYNTAX AfdxRedundancyStatsEntry ACCESS read-only STATUS mandatory DESCRIPTION "An entry in the redundancy Stats table" INDEX { afdxRedundancyVLPortIndex, afdxRedundancyVLMacAddress} ::= { afdxRedundancyStatsTable 1 }AfdxRedundancyStatsEntry ::= SEQUENCE {afdxRedundancyVLPortIndex INTEGER,afdxRedundancyVLMacAddress INTEGER,afdxRedundancyVLIntegrityCheckError Counter,afdxRedundancyVLFirstInFrames Counter}
mib2c.array-user.conf mib2c.create-dataset.conf mib2c.int_watch.conf mib2c.iterate.conf mib2c.iterate_access.conf mib2c.mfd.conf mib2c.notify.conf mib2c.old-api.conf mib2c.scalar.conf
mib2c.array-user.conf