WebNMS Developer Forums
Click on Join Now to Sign Up
Hi,
I have my snmp agent built with SNMP C Agent Toolkit. I have to run the agent on a linux machine and so i cross compiled the agent. I ported the project folder on to the other machine using a flash drive and run the agent from command line interface. But I do not know the command to stop the agent properly. I am using CNTL+Z to abruptly stop the agent which is leaving some of the files in read-only mode. This is causing some problem as the files are getting currupt and I have to format my flash drive to rerun it again.
Please help me with the command line command to stop the snmp agent properly.
thank you,
Suman.
Dear Suman,
1) Use CTRL+C to kill / terminate the agent.
or
2) Set the gv_agentRunFlag to zero. call the function FreeAllResources() to free the resources.
For Example, insert the following code in the function DoOtherWorks() defined in submain.c and create a mem.txt file in agent/bin directory. If the content of the file is 0, then the agent will be stopped immediately.
To restart , set the content of mem.txt to 1 and start the agent.
FILE *fp;
INT32 ch = 0;
fp = fopen("mem.txt", "r+");
if (fp == NULL)
{
printf("cannot open file!!!\n");
}
fscanf(fp, "%d", &ch);
fclose(fp);
if (ch == 0)
{
gv_agentRunFlag=0;
FreeAllResources();
exit(0);
}
Hope this helps.
For further clarifications, please mail your queries to cagent-support@webnms.com.
Hi ,
Kindly let me know which version of our Agent Toolkit C-Edtion product do you have for creating an Agent. And any specific project settings do you have so that we can also try to recreate this issue at our end. As you mentioned it is not reproducible, It would be great if you can share the config.h file which is available under <projectname>/agent/source/system/include/ directory so that we can do that configuration here at our end to analyze this issue. Please send in your queries to cagent-support@webnms.com.
If possible share your project as a zip so that it will help us to identify the exact issue to assist you further.
Thanks for your understanding in this regard.
thanks and regards,
- subarayan -
(C-Agent Support)
Dear Reema,
Greetings.
Thanks for your mail. We were unable to find the attachment in your reply. Please send in your reply with the attachments to the email id cagent-support@webnms.com which will help us to analyze the issue.
thanks for your understanding and co-operation in this regard.
Thanks and Regards,
- subarayan -
(C-Agent Support)
Hi Subrayan,
Thanks for your reply.
Version: AdventNet Agent Toolkit C Edition 6
I am attaching my project in zip format. config.h file is alos available along with the project.
Thanks,
Reema
Hi Subarayan,
Thanks for your reply.
Plz find config.h attached. Agent version is 6.
Thanks,
Reema