7

I've got a server running Postgresql 9.1 replication. I wrote a script which prints out the current replication lag (master inserts a unix timestamp every 60s, and the slave compares it to the current timestamp).

I've added

extend replag /usr/local/bin/check_lag_quietly.sh

to snmpd.conf, and restarted the snmpd service, but when I snmpwalk the host, either from localhost, or from another machine on the network, I can see all of the other OIDs, but not this one.
If I do SNMP-Get as

tom.oconnor@charcoal-black:~$ snmpget -v2c -cpublic dns-2 UCD-SNMP-MIB::extTable
UCD-SNMP-MIB::extTable = No Such Object available on this agent at this OID

Then it can't find the OID there either.

Net-SNMP version 5.4.2.1, Ubuntu 10.04.

Tom O'Connor
  • 27,440
  • 10
  • 72
  • 148
  • Just checking the basics: is the `check_lag_quietly.sh` script set as executable, and is it and the entire /usr/local/bin/ path have the read and execute permissions set correctly for the user that the `snmpd` daemon is executing under? – dan_linder Jun 14 '12 at 18:07
  • -rwxrwxr-x 1 root root 444 Jun 12 14:48 check_lag_quietly.sh – Tom O'Connor Jun 14 '12 at 18:09
  • drwxr-xr-x 2 root root 4.0K Jun 12 14:48 bin – Tom O'Connor Jun 14 '12 at 18:09
  • The "No Such Object available" leads me to believe that the `UCD-SNMP-MIB::extTable` may be incorrect. Other on-line examples show using `NET-SNMP-EXTEND-MIB::nsExtendObjects`. [From this RedHat example.](http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/sect-System_Monitoring_Tools-Net-SNMP-Extending.html) – dan_linder Jun 14 '12 at 18:10
  • When you restart the snmpd service, does anything get logged to /var/log/messages? Does the snmpd init.d have a check config option? – becomingwisest Jun 14 '12 at 23:43

2 Answers2

4

On Debian with 5.4.3 snmpd dosn't seem to load all it's modules by default, by adding:

-I interface,ifTable,ifXTable,cpu,cpu_linux,hw_mem,extend,versioninfo,snmp_mib,ip,at,system_mib

to the command line for snmpd (note the 'extend' in there), i can:

snmpwalk -Ou  -v 1 -c public localhost nsExtendOutput2Table

which returns the default 'extend' examples:

enterprises.netSnmp.netSnmpObjects.nsExtensions.nsExtendObjects.nsExtendOutput2Table.nsExtendOutput2Entry.nsExtendOutLine."test1".1 = STRING: Hello, world!
enterprises.netSnmp.netSnmpObjects.nsExtensions.nsExtendObjects.nsExtendOutput2Table.nsExtendOutput2Entry.nsExtendOutLine."test2".1 = STRING: Hello, world!
enterprises.netSnmp.netSnmpObjects.nsExtensions.nsExtendObjects.nsExtendOutput2Table.nsExtendOutput2Entry.nsExtendOutLine."test2".2 = STRING: Hi there

Which is close to what you want.

You can get a list of all the snmpd modules with:

snmpd -Dmib_init -H

I guess the real question here is "How do i get snmpd to load all it's modules by default"

JasperWallace
  • 214
  • 1
  • 4
  • Where would this be added on Ubuntu? perhaps `/etc/default/snmpd` or `/etc/init.d/snmpd` or elsewhere? – cwd Jan 24 '15 at 18:55
  • On newer versions, it's also required to uncomment `#rocommunity public localhost` if you actually want to be able to access the output of extend commands. – Tom O'Connor Jul 07 '20 at 21:56
0

We need to enable agent/extend module while configuring the pkg.

./configure --with-default-snmp-version=2 --with-logfile=/var/log/snmpd.log --with-sys-location= --with-sys-contact= --with-persistent-directory=/home/swuser/snmp --with-mibs=RFC1213-MIB --with-mibdirs= --disable-scripts --with-out-mib-modules=examples/ucdDemoPublic,mibII/system_mib --without-kmem-usage --disable-mibs --disable-mib-loading --disable-manuals --without-perl-modules --enable-shared --host=arm-none-linux-gnueabi --with-cc=arm-none-linux-gnueabi-gcc --target=arm-none-linux-gnueabi --disable-embedded-perl --with-ar=arm-none-linux-gnueabi-ar --with-mib-modules="ucd-snmp/dlmod"

Here if you can disable agent/extend module by --with-out-mib-modules=agent/extend or else by default it's enabled in net-snmp-5.7

Tom O'Connor
  • 27,440
  • 10
  • 72
  • 148