Discussion:
Another question for: "Writing a Subagent
(too old to reply)
Mostafa Salari
2015-08-16 06:40:03 UTC
Permalink
Hello,
I want to write a subagent that updates the values of some MIBs from a text
file (Some other function fill the file).

I am altering the following tutorial code to reach my goal:
http://www.net-snmp.org/tutorial/tutorial-5/toolkit/demon/example-demon.c

So my subagent can check the file every (for example) 5 seconds, then call
a function that updates the OID values.
1. WHAT IS THAT UPDATE FUNCTION? I used
2. WHERE SHOULD I PLACE THIS CHECKING CODE? Is the main loop
*while(keep_running){...}* in the above link suitable?
3. WHAT DOES [agent_check_and_process(1);] LINE DO IN THE MAIN LOOP?
4. IS THERE ANOTHER WAY TO UPDATE SOME MIBS ITERATIVELY?

Thank you very much for your good support
Best regards,
Mustafa
Robson, Alan
2015-08-16 17:04:57 UTC
Permalink
How come your subagent can’t wait for a request to come in from the manager and check the file at that time ? For example, if the file contains data upon which the response is based, subagent waits for the poll, then opens the file, calculates and sends the response.

Or are you trying to keep track of changes in the file between polls from the manager ? What utility is there in opening the file if the manager is not asking for a response ?

Cheers

Alan

From: Mostafa Salari [mailto:***@gmail.com]
Sent: Saturday, August 15, 2015 11:40 PM
To: net-snmp-***@lists.sourceforge.net
Subject: Another question for: "Writing a Subagent

Hello,
I want to write a subagent that updates the values of some MIBs from a text file (Some other function fill the file).
I am altering the following tutorial code to reach my goal:
http://www.net-snmp.org/tutorial/tutorial-5/toolkit/demon/example-demon.c<https://urldefense.proofpoint.com/v2/url?u=http-3A__www.net-2Dsnmp.org_tutorial_tutorial-2D5_toolkit_demon_example-2Ddemon.c&d=BQMFaQ&c=jcv3orpCsv7C4ly8-ubDob57ycZ4jvhoYZNDBA06fPk&r=xN9AnMDZvO_QvUZQZcoply6WFqSJuNcpv-dDu2fA4Ac&m=mvQodtBRPkqKiBNDPH-P1rnsRbjvA4cmQ_qQSDS7yQ0&s=p6CsWa4_dbjm-G4-CqitiPdIIw_wEpye98bpgRhZlUU&e=>

So my subagent can check the file every (for example) 5 seconds, then call a function that updates the OID values.
1. WHAT IS THAT UPDATE FUNCTION? I used
2. WHERE SHOULD I PLACE THIS CHECKING CODE? Is the main loop while(keep_running){...} in the above link suitable?
3. WHAT DOES [agent_check_and_process(1);] LINE DO IN THE MAIN LOOP?
4. IS THERE ANOTHER WAY TO UPDATE SOME MIBS ITERATIVELY?
Thank you very much for your good support
Best regards,
Mustafa

Loading...