snmp ... mib2c.scalar.conf, how manipulate variables


 
Thread Tools Search this Thread
Special Forums IP Networking snmp ... mib2c.scalar.conf, how manipulate variables
# 1  
Old 04-12-2008
Question snmp ... mib2c.scalar.conf, how manipulate variables

Hi,

I'm reading net-snmp, using Unix (Solaries) and C language ...

- using mib2c.scalar.conf to get the .c and .h code ... I want to manipulate variable ( managed object which already defined in MIB file ) but there is no such variable declared in the generated .c code only handler for each variable?
how can I manipulate variable outside snmpset ... and to get modified value when I request snmpget ?

-(The mib2c.int-watch.conf declare only integer and I want to declare string so I use mib2c.scalar.conf, am I write ?)

Thank you in advance ..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Configure resolv.conf and nsswitch.conf

Hi, I've installed Solaris 11.3(live media) and configured DNS. Everytime I reboot the server, resolv.conf got deleted and it created a new nsswitch.conf. I used below to configure both settings: # svccfg -s dns/client svc:/network/dns/client> setprop config/nameserver = (xx.xx.xx.aa... (1 Reply)
Discussion started by: flexihopper18
1 Replies

2. Shell Programming and Scripting

Script to update rsyslog.conf and auditd.conf

Hello all, Newbie here. I'm currently tasked with updating rsyslog.conf and auditd.conf on a large set of servers. I know the exact logging configurations that I want to enable. I have updated both files on on a server and hope to use the updated files as a template for the rest of the... (3 Replies)
Discussion started by: Mide
3 Replies

3. UNIX for Dummies Questions & Answers

Need to transfer all kernel logs (var/log/messages) to the snmp listener as snmp trap

i am working with embedded system -Dell DCS management sub system. my question is as below: currently we are using linux kernel 2.6.30 build and we have a kernel logs stored to the /var/log/messages path. now we have to transfer all this logs to the specified SNMP target as a part of SNMP... (4 Replies)
Discussion started by: vipul_prajapati
4 Replies

4. Red Hat

Sending data from DELL OMSA SNMP and Custom SNMP MIB to same UDP port 161

Hi , Currently DELL OMSA SNMP sends data through default udp port 161.I want my custom SNMP MIB also to send data in the same udp port 161.Whether its possible.If yes where to configure .I tried starting my custom MIB in udp port 161,but it throws port already in use.Kindly guide. (1 Reply)
Discussion started by: prabakar4all
1 Replies

5. IP Networking

Sending data from DELL OMSA SNMP and Custom SNMP MIB to same UDP port 161

Hi , Currently DELL OMSA SNMP sends data through default udp port 161.I want my custom SNMP MIB also to send data in the same udp port 161.Whether its possible.If yes where to configure .I tried starting my custom MIB in udp port 161,but it throws port already in use.Kindly guide. (0 Replies)
Discussion started by: prabakar4all
0 Replies

6. Infrastructure Monitoring

conf snmp red hat 5

Please just installed in the company Red Hat Enterprise 5, I need to know how to configure the snmpd. conf cheymane community and you can collect the data it generates from a server which runs WhatsUp Gold <email deleted per forum rules> (2 Replies)
Discussion started by: cheymane
2 Replies

7. Infrastructure Monitoring

Proper permission /etc/snmp/snmpd.conf

Hi All, I'm hardening my linux. And I came across with this file. /etc/snmp/snmpd.conf It's current mod is 644 with root:root ownership and group. Can I make this 640 without hurting the OS? Meaning no public read access. Does other resources need to read to it? Thanks and more... (1 Reply)
Discussion started by: itik
1 Replies

8. Solaris

basic question on sd.conf and lpc.conf file

Hello Guys, Do we need to configure this file only if we add SAN disk or even if we add local disk, do we need to modify? (4 Replies)
Discussion started by: mokkan
4 Replies

9. Infrastructure Monitoring

snmp,how to edit code generated by mib2c?

Hi, I'm reading net-snmp site, using C language and unix environment, I have manager ( do get/set command), agent and server ... I'm trying to monitor cpu, memory and disk usage and get Ip address of server and send the value back to agent, stored in variable which enable manager to gets the... (1 Reply)
Discussion started by: zainab
1 Replies

10. Shell Programming and Scripting

Accessing Variables from .conf file

I can't figure out how to access variables that are stored in a separate file. Can someone let me in on the secret? Please, and thank you. -Kevin (7 Replies)
Discussion started by: wayne1411
7 Replies
Login or Register to Ask a Question
mib2c(1M)						  System Administration Commands						 mib2c(1M)

NAME
mib2c - produces template code from MIB definitions SYNOPSIS
/usr/sfw/bin/mib2c [-h] -c configfile [-f outname] [-i] [-q] [-S var=val] mibnode [mibnode...] DESCRIPTION
The mib2c tool is designed to take a portion of the MIB tree (as defined by a MIB file) and generate the template C code necessary to implement the corresponding MIB module. To implement a new MIB module, three files are necessary: o MIB definition file o C header file o C implementation file The mib2c tool uses the MIB definition file to produce the two C code files. Thus, mib2c generates a template that you can edit to add logic necessary to obtain information from the operating system or application to complete the module. The operand mibnode is the top level MIB node for which you want to generate code. You must give mib2c a MIB node (for example, ifTable), not a MIB file, on the command line. This distinction is a common source of user error. The mib2c tool accepts both SMIv1 and SMIv2 MIBs. mib2c needs to be able to find and load a MIB file in order to generate C code for the MIB. To enable mib2c to find the MIB file, set the MIBS environment variable to include the MIB file you are using. An example of setting this environment variable is: MIBS=+NET-SNMP-TUTORIAL-MIB or MIBS=ALL The first example ensures that mib2c finds the NET-SNMP-TUTORIAL-MIB MIB, in addition to the default MIB modules. The default list of MIB modules is set when the suite is first configured and built. The list corresponds to the list of modules that the agent supports. The sec- ond example ensures that mib2c finds all MIBs in the search location for MIB files. The default search location for MIB files is DATADIR/snmp/mibs. This search location can be modified by the MIBDIRS environment variable. Both the MIB files to be loaded and the MIB file search location can also be configured in the snmp.conf file. Please see snmp.conf(4) for more information. The generated .c and .h files are created in the current working directory. OPTIONS
The following options are supported: -h Display a help message. -c configfile Use configfile when generating code. These files are searched for first in the current directory and then in the DATADIR directory, which is where the default mib2c configuration files are located. Running mib2c without the -c configfile option displays a description of the valid values for configfile, that is, the available configuration files, including new ones that you might have created. For example: % mib2c ifTable ...displays the contents of the mib2.conf file, which displays hints on choosing the best configfile option for the mibnode. The following values are supported for configfile: mib2c.scalar.conf mib2c.int_watch.conf mib2c.iterate.conf mib2c.create-dataset.conf mib2c.array-user.conf mib2c.column_defines.conf mib2c.column_enums.conf See EXAMPLES for commands you can use to generate code for scalar objects, tables, header files, and for SunOS 4.x code. -f outname Places the output code into outname.c and outname.h. In most cases, mib2c places the output code into files with names that correspond to the group names for which it is generating code. -i Do not run indent in the resulting code. Omitting this option results in indent error messages. These can safely be ignored. For exam- ple: % /usr/sfw/bin/mib2c -c mib2c.scalar.conf ifTable writing to ifTable.h writing to ifTable.c running indent on ifTable.h indent: Command line: unknown parameter "-orig" running indent on ifTable.c indent: Command line: unknown parameter "-orig" % ls ifTable.c ifTable.h % rm i* % /usr/sfw/bin/mib2c -c mib2c.scalar.conf -i ifTable writing to ifTable.h writing to ifTable.c In the first invocation of mib2c, above, the indent errors are of no consequence. -q Run in "quiet" mode, which minimizes the status messages mib2c generates. -S var=val Preset a variable var in the mib2c.*.conf file to the value val. None of the existing mib2c configuration files (mib2c.*.conf) cur- rently makes use of this feature. Consider this option available only for future use. EXAMPLES
Example 1: Generating Code for Scalar Objects If you are writing code for some scalars, run: % mib2c -c mib2c.scalar.conf mibnode If you want to magically "tie" integer variables to integer scalars, use: % mib2c -c mib2c.int_watch.conf mibnode Example 2: Generating Code for Tables Consider the case where: o You need to "iterate" over your table data to find the correct data for the SNMP row being accessed. o Your table data is not kept within the agent (for example, it is in the kernel and not in the memory of the agent itself). Under such conditions, use a command such as: % mib2c -c mib2c.iterate.conf mibnode You can find a similar example in agent/mibgroup/mibII/vacm_context.c. If your table data is kept in the agent (that is, it is not located in an external source) and is purely data-driven (that is, you do not need to perform any work when a set occurs), you can use a command such as the following: % mib2c -c mib2c.create-dataset.conf mibnode See agent/mibgroup/examples/data_set.c for a similar example. If your table data is kept in the agent (that is, it is not located in an external source) and you can keep your data sorted by the table index, but you do need to perform work when a set occurs, use a command such as the following: % mib2c -c mib2c.array-user.conf mibnode Example 3: Generating Header File Definitions To generate just a header with a define for each column number in your table, enter a command such as: % mib2c -c mib2c.column_defines.conf mibnode To generate only a header with a define for each enum for any column containing enums, enter: % mib2c -c mib2c.column_enums.conf mibnode Example 4: Generating Code for the SunOS 4.X Line of Code The following command generates code for SunOS 4.x: % mib2c -c mib2c.old-api.conf mibnode Example 5: Generating Code for ucdDemoPublic The command below generates C template code for the header and implementation files to implement UCD-DEMO-MIB::ucdDemoPublic. % mib2c -c mib2c.scalar.conf ucdDemoPublic writing to ucdDemoPublic.h writing to ucdDemoPublic.c running indent on ucdDemoPublic.h running indent on ucdDemoPublic.c The resulting ucdDemoPublic.c and ucdDemoPublic.h files are generated in the current working directory. Example 6: Generating Code for tcpConnTable The command below generates C template code for the header and implementation files for the module to implement TCP-MIB::tcpConnTable. % mib2c -c mib2c.iterate.conf tcpConnTable writing to tcpConnTable.h writing to tcpConnTable.c running indent on tcpConnTable.h running indent on tcpConnTable.c The resulting tcpConnTable.c and tcpConnTable.h files are generated in the current working directory. EXIT STATUS
0 Successful completion. 1 A usage syntax error. A usage message is displayed. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWsmcmd | +-----------------------------+-----------------------------+ |Interface Stability |External | +-----------------------------+-----------------------------+ SEE ALSO
snmpcmd(1M), snmp.conf(4), attributes(5) SunOS 5.10 23 Jan 2004 mib2c(1M)