<-- ne2k__ has left #net-snmp
--> rstory-work has joined #net-snmp
--> cyril_ has joined #net-snmp
--> hardaker has joined #net-snmp
[2010/08/24 06:15:33] #net-snmp <cyril_> Hi everyone ! I am trying to write a MIB module using tables (something quite similar to this : http://www.net-snmp.org/dev/agent/data__set_8c-example.html). I also need to define my own handler for GET and SET requests, but I'm having trouble getting that to work as I expect. Could anyone give me a hint ?
[2010/08/24 06:17:19] #net-snmp <rstory-work> can you be more specific about what's not working?
[2010/08/24 06:18:59] #net-snmp <cyril_> Well, being a beginner, I thought that what would be the easiest thing to do for my handler would be... nothing.
[2010/08/24 06:19:25] #net-snmp <cyril_> So I wrote a handler that just prints stuff to stdout, so I can be sure it has been called, and then returns 0.
[2010/08/24 06:20:12] #net-snmp <cyril_> But my snmpget requests still return data (which is not what I think should happen)
[2010/08/24 06:21:38] #net-snmp <cyril_> which makes me think I misunderstood the way the whole thing is supposed to work.
[2010/08/24 06:29:22] #net-snmp <rstory-work> ok.. iirc, data_set keeps the table data in memory and returns the data automatically
[2010/08/24 06:29:54] #net-snmp <rstory-work> i think adding your own handler lets you know when a request has been handled so you can do something extra
[2010/08/24 06:30:22] #net-snmp <rstory-work> but the parent handler has already prepared the data to be returned
[2010/08/24 06:31:59] #net-snmp <cyril_> Ok. Is there any way to prevent this from happening, and dealing myself with the GET/SET requests ?
[2010/08/24 06:32:05] #net-snmp <rstory-work> i think that maybe table_data will do what you want.. allow you to decide what to return.. but you have to do more work in preparing/checking/processing requests
[2010/08/24 06:32:57] #net-snmp <rstory-work> and if you want to do *all* the work, there is always the raw_table handler.. not recommended for newbies...
[2010/08/24 06:40:13] #net-snmp <cyril_> Then I should probably go for the table_data :) I am reading the documentation (http://net-snmp.sourceforge.net/dev/agent/group__table__data.html#_details), where it is written that "table where all the indexes are expected to be stored within the agent itself and not in some external storage location."
[2010/08/24 06:41:01] #net-snmp <cyril_> The fact is that my data will probably be stored in "some external storage location". Is there a helper that is really appropriate for this case ?
[2010/08/24 06:41:56] #net-snmp <cyril_> Oh no, I'm sorry, forget this, they were actually writing about the indexes.
[2010/08/24 06:57:37] #net-snmp <rstory-work> yeah, table data work either way.. internal data or external...
[2010/08/24 07:12:28] #net-snmp <cyril_> Does it mean, that, since my data is stored in a database, I don't even have to actually "add" data inside my program (using netsnmp_table_data_add_row(), for instance) ?
[2010/08/24 07:13:08] #net-snmp <cyril_> Indeed, I guess I could just interrogate the database every time I receive a GET/SET request
[2010/08/24 07:15:03] #net-snmp <rstory-work> you have to at least add the indexes so the agent can find the right row... i can't recall if there is a function to only add the index, or if you use add_row but just don't fill in all the row data
[2010/08/24 07:17:35] #net-snmp <rstory-work> if you have a lot of indexes and building the list of them is too expensive, then raw_table is the way to go.. but again, you'll have to have a much better understanding of OIDs and how the protocol works...
[2010/08/24 07:25:57] #net-snmp <cyril_> I probably won't have a lot of indexes, so table_data should be OK. While treating the requests, I guess that I'll be able to easily retrieve the column and row the user asked for, and then write the appropriate SQL request to fetch data.
[2010/08/24 07:26:52] #net-snmp <cyril_> But if I keep adding data in my database, does that mean I'll have to keep updating indexes ?
--> SJFriedl has joined #net-snmp
--> blotchy has joined #net-snmp
--> hardaker has joined #net-snmp
--> jsafrane has joined #net-snmp
--> snmpbot has joined #net-snmp