Re: Determine snmpd status

Paul Herring <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <CAEWO_9S6UuKpY-uEym3ScAOs+OjtDpgXrLsfbmZwMnsKWqsTuw@mail.gmail.com>
On Sun, Dec 22, 2019 at 2:56 PM Raz Moshe <[email protected]> wrote:

> Hello,
>
> Assuming I have no community string configured (and so cannot use
> 'snmpwalk' and other similar binaries), when I turn the snmp daemon on, is
> there a way to determine it has done initialization and ready for queries?
>
> I found that checking if the log file exists gives a good indication (if
> it was created already, snmpd is ready), but then there's a problem when I
> turn snmpd on, off and then on again. Since the log file isn't deleted when
> snmpd is turned off, it's gonna be there in the second time even before I
> turn snmpd on.
>
> A short sleep() after turning snmpd on can do the trick, but obviously
> that's a bad practice.
>
> Anything else I can do to get a good indication?
>

See if it's actually running?

$ pidof snmpd && echo running

See if there's anything listening on the standard port?

$ nmap localhost -p161 | grep -q open && echo running

That said, what use is the daemon running "for queries" if there's no users
configured that can actually perform queries?

_______________________________________________
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.