Dear All,

I am new to SNMP world. I would to configure and send trap for Apache, Asterisk, MySQL to my NMS server. What I have to do. Will I have to write script in Perl please send any example for this.

Please also let me know why I m getting following error.

snmpwalk -v 1 -c public localhost IP-MIB::ipAdEntIfIndex
MIB search path: /root/.snmp/mibs:/usr/share/mibs/site:/usr/share/snmp/mibs:/usr/share/mibs/iana:/usr/share/mibs/ietf:/usr/share/mibs/netsnmp
Cannot find module (IP-MIB): At line 0 in (none)
IP-MIB::ipAdEntIfIndex: Unknown Object Identifier

snmpd.conf:

com2sec notConfigUser default public

group notConfigGroup v1 notConfigUser
group notConfigGroup v2c notConfigUser

view all included .1
view system included .iso.org.dod.internet.mgmt.mib-2.system

access notConfigGroup "" any noauth exact all none none

syslocation Pakistan, PK
syscontact NOC noc@xxxx.com

view all included .1 80

trapsink localhost public
authtrapenable 1

master agentx
agentXSocket /var/agentx/master
agentXPerms 0660 0775 nobody root

sysObjectID .1.3.6.1.4.1.22736.1
Dear All,

I am new to SNMP world. I would to configure and send trap for Apache, Asterisk, MySQL to my NMS server. What I have to do. Will I have to write script in Perl please send any example for this.

Please also let me know why I m getting following error.

snmpwalk -v 1 -c public localhost IP-MIB::ipAdEntIfIndex
MIB search path: /root/.snmp/mibs:/usr/share/mibs/site:/usr/share/snmp/mibs:/usr/share/mibs/iana:/usr/share/mibs/ietf:/usr/share/mibs/netsnmp
Cannot find module (IP-MIB): At line 0 in (none)
IP-MIB::ipAdEntIfIndex: Unknown Object Identifier

snmpd.conf:

com2sec notConfigUser default public

group notConfigGroup v1 notConfigUser
group notConfigGroup v2c notConfigUser

view all included .1
view system included .iso.org.dod.internet.mgmt.mib-2.system

access notConfigGroup "" any noauth exact all none none

syslocation Pakistan, PK
syscontact NOC noc@xxxx.com

view all included .1 80

trapsink localhost public
authtrapenable 1

master agentx
agentXSocket /var/agentx/master
agentXPerms 0660 0775 nobody root

sysObjectID .1.3.6.1.4.1.22736.1

Dani AI

Generated

Short summary and actionable next steps. is correct: the symptom in the first post is the agent/tools failing to load the IP MIB, so textual names (like IP‑MIB::ipAdEntIfIndex) cannot be resolved. Two independent tasks are needed: (A) get MIB name resolution working on the host (or use numeric OIDs), and (B) pick a delivery model for service alerts (pull via snmpd extensions / AgentX, or push via SNMP traps). Background on MIB loading and how the Net‑SNMP tools look for MIB files is in the Net‑SNMP MIBs guide. (net-snmp.org)

Practical fixes for the MIB error: install the distribution MIB bundle (Debian/Ubuntu commonly use the snmp‑mibs‑downloader package or copy vendor MIBs into the system MIB path), or enable loading in /etc/snmp/snmp.conf instead of suppressing it. If name resolution isn’t required, run tools in numeric mode (numeric OIDs) to verify the agent responds. Debian/Ubuntu package info for the downloader is here. (packages.debian.org)

Which way to monitor Apache / Asterisk / MySQL: two common choices.

  • Expose service state via snmpd (extend / pass / pass_persist or an AgentX subagent) so the NMS polls structured OIDs. This integrates cleanly with MIBs and is recommended when long‑term metrics are needed.
  • Use a small watchdog (cron or systemd timer) that checks service health and sends a trap to the manager when a problem occurs. Traps are fire‑and‑forget (can be lost), while polling is more reliable for steady monitoring. Net‑SNMP documents both sending traps with snmptrap and the snmpd extension mechanisms. (net-snmp.org)

Minimal Perl example (Net::SNMP) that sends an SNMPv2 trap; replace manager host, community, OIDs and text with appropriate values:

#!/usr/bin/perl
use strict;
use warnings;
use Net::SNMP;

my ($session, $err) = Net::SNMP->session(
  -hostname  => 'manager.example.com',
  -community => 'public',
  -port      => 162,
  -version   => 'snmpv2c',
);

die "session: $err\n" unless defined $session;

my $uptime  = 0;                # Timeticks; set appropriately
my $trapOid = '1.3.6.1.4.1.XXXXX';  # custom notification OID

$session->snmpv2_trap(
  -varbindlist => [
    '1.3.6.1.2.1.1.3.0', TIMETICKS, $uptime,
    '1.3.6.1.6.3.1.1.4.1.0', OBJECT_IDENTIFIER, $trapOid,
    '1.3.6.1.4.1.XXXXX.1.0', OCTET_STRING, 'service apache: DOWN',
  ],
);

$session->close;

The Net::SNMP documentation and the Net‑SNMP trap and snmpd.conf manuals explain the required OIDs, types and recommended practices. Test first with numeric OIDs and verify the NMS is listening for traps (UDP 162 / snmptrapd). (manpages.debian.org)

Simply that the "IP-MIB" module is not present on the system. Try running the same command without specifying a MIB. You should at least get the OIDs spit back at you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.