Hi, gentlemen.
I am facing problems on creating a new table row using snmpset.
Let's start from beginning. Below is my MIB module - a simple table
containing three columns: 'name' (its index), 'score' and 'status' (a
RowStatus object type).
---
myTable DEFINITIONS ::= BEGIN
IMPORTS
netSnmpExamples FROM NET-SNMP-EXAMPLES-MIB
RowStatus FROM SNMPv2-TC
OBJECT-TYPE,
MODULE-IDENTITY FROM SNMPv2-SMI
MODULE-COMPLIANCE, OBJECT GROUP FROM SNMPv2-CONF;
myTable MODULE-IDENTITY
LAST-UPDATED "201208100000Z"
ORGANIZATION "ufersa"
CONTACT-INFO "postal: Helcio Wagner
P.O. Box 59.625-900
MossorĂ³, Brazil
email: helcio@...
"
DESCRIPTION "A simple editable table for evaluation purpose."
::= { netSnmpExamples 7 }
mySimpleTable OBJECT-TYPE
SYNTAX SEQUENCE OF MySimpleEntry
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION
"This table contains pairs of <name,score> related
to players of an hypothetical multiplayer game."
::= { myTable 1 }
mySimpleEntry OBJECT-TYPE
SYNTAX MySimpleEntry
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION
"A row describing a pair of <name,score>."
INDEX { name }
::= { mySimpleTable 1 }
MySimpleEntry ::= SEQUENCE {
name OCTET STRING,
score OCTET STRING,
status RowStatus
}
name OBJECT-TYPE
SYNTAX OCTET STRING (SIZE (1..16))
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION
"Player's name."
::= { mySimpleEntry 1 }
score OBJECT-TYPE
SYNTAX INTEGER
MAX-ACCESS read-create
STATUS current
DESCRIPTION
"Player's score."
DEFVAL { 0 }
::= { mySimpleEntry 2 }
status OBJECT-TYPE
SYNTAX RowStatus
MAX-ACCESS read-create
STATUS current
DESCRIPTION
"The status column used for creating,
modifying and deleting instances of
the columnar objects in this table."
::= { mySimpleEntry 3 }
END
---
I've used mib2c with 'mib2c.create-dataset.conf' config file to generate
myTable.c and myTable.h files. Below is a code snippet of myTable.c:
---
void initialize_table_myTable(void) {
const oid myTable_oid[] = {1,3,6,1,4,1,8072,2,7};
netsnmp_table_data_set *table_set;
table_set = netsnmp_create_table_data_set("myTable");
table_set->allow_creation = 1;
DEBUGMSGTL(("initialize_table_myTable",
"adding indexes to table myTable\n"));
netsnmp_table_set_add_indexes(table_set, ASN_OCTET_STR, 0);
DEBUGMSGTL(("initialize_table_myTable",
"adding column types to table myTable\n"));
netsnmp_table_set_multi_add_default_row(table_set,
1, ASN_OCTET_STR, 1, NULL, 0,
2, ASN_INTEGER, 1, NULL, 0,
3, ASN_INTEGER, 1, NULL, 0,
0);
netsnmp_register_table_data_set(netsnmp_create_handler_registration("myTable",
NULL,
myTable_oid,
OID_LENGTH(myTable_oid),
HANDLER_CAN_RWRITE),
table_set, NULL);
}
void init_myTable(void) {
initialize_table_myTable();
}
---
Well, I've copied both (.c and .h) files to the right place
(agent/mibgroups directory of NET-SNMP installation place), compiled the
agent with such MIB module and ran 'make' and 'make install'. Finally, I've
run 'snmpd'.
The problem rises when I use snmpset. Please, take a look:
---
snmpset -v2c -c public localhost
myTable::mySimpleTable.mySimpleEntry.status.\"Helcio\" i 4
Error in packet.
Reason: noCreation (That table does not support row creation or that object
can not ever be created)
Failed object: myTable::status."Helcio"
---
The same occurs when I try to set 'status' to 5, instead of 4.
Am I doing anything wrong, gentlemen? Any hope will be appreciated.
Helcio.
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users