Re: Reconnect subagent automatically

Bill Fenner <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <CAF4SogZacbB92_1dvKGO1mmoqA7CpDjQ6uWS_AovG93tHzQ08A@mail.gmail.com>
On Mon, Oct 22, 2018 at 1:01 AM Rajaa, Mukuntha (Nokia - IN/Bangalore) <
[email protected]> wrote:

> Hi,
>
>
> I am using subagent mainly for "traps". So I am not using "agent_check_and_process".
> From what I understand, "agent_check_and_process" polls on to the
> connection between snmpd and subagent for any incoming request. My subagent
> is not serving any request at all. So I have skipped this function check at
> all.
>

The master agent will disconnect you regularly, then, if you're not
responding to pings, because it will think that you've gone unresponsive.

So whenever master-agent (snmpd ) gets restarted, subagent isnt
> re-establishing the connection. My code snippet is something like this,
>
>
>     while ( whatever )
>
>     {
>
>         wait_for_events_to_arrive_in_pipe(); // blocks on read-system call
>
>     }
>
>
> Currently I am hooking up netsnmp init script ( yes I am working on legacy
> system. No systemd ) to restart my subagent too. I am not too happy with
> this method. Is there an advisable way in doing so.
>

If you need to block until something happens, then I recommend establishing
the connection, sending the trap, and closing the connection again, like
the agentxtrap command does.

  Bill

_______________________________________________
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.