[asterisk-users] ASTERISK and SNMP

Lee Archer Lee.Archer at thebigword.com
Fri Nov 27 06:31:50 CST 2009


I use CentOS, and it works fairly well.   But I had to piece together info from several places.  I've tried it several different wants and this way worked, as long as asterisk is run as root.

 

Copy asterisk-mib.txt and digium-mib.txt from <asterisk_source>/doc to /usr/share/snmp/mibs/

 

mkdir /var/agentx

touch /var/agentx/master

 

My /etc/asterisk/res_snmp.conf

 

;

; Configuration file for res_snmp

;

 

[general]

; We run as a subagent per default -- to run as a full agent

; we must run as root (to be able to bind to port 161)

;subagent = yes

; SNMP must be explicitly enabled to be active

enabled = yes

 

My snmp.conf

 

rwcommunity private 127.0.0.1

rocommunity public

disk /

master agentx

agentXperms 0660 0550 root root

 

restart snmp and the /var/agentx/master should look like srw-rw---- 1 root root 0 Nov 25 11:31 /var/agentx/master

 

restart asterisk manually and you see a net-snmp connect.

 

export MIBS=+ASTERISK-MIB

 

You should be able to to do a snmpwalk -v 2c -c public localhost asterisk

 

Regards

 

Lee

 

From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of mickael ropars
Sent: 27 November 2009 11:58
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] ASTERISK and SNMP

 

Michal

please wait I found some issues in my con file

2009/11/27 mickael ropars <mropars at gmail.com>

I am running on Trixbox so my OS is Cent0S 5.4 and the Asterisk version is 1.4.22-4

on asterisk side Snmp module is running:

> module load res_snmp.so
  == Parsing '/etc/asterisk/res_snmp.conf': Found
 Loading [Sub]Agent Module
 Loaded res_snmp.so => (SNMP [Sub]Agent for Asterisk)

see below my snmpd.conf file (I remove commented line for an easy reading)

regards

Mickael




###############################################################################
# Access Control
###############################################################################

####
# First, map the community name (COMMUNITY) into a security name
# (local and mynetwork, depending on where the request is coming
# from):

#       sec.name  source          community
com2sec local     localhost       COMMUNITY
com2sec mynetwork NETWORK/24      COMMUNITY


rwcommunity local
rocommunity local

####
# Second, map the security names into group names:

#               sec.model  sec.name
group MyRWGroup v1         local
group MyRWGroup v2c        local
group MyRWGroup usm        local
group MyROGroup v1         mynetwork
group MyROGroup v2c        mynetwork
group MyROGroup usm        mynetwork

####
# Third, create a view for us to let the groups have rights to:

#           incl/excl subtree                          mask
view all    included  .1                               80

####
# Finally, grant the 2 groups access to the 1 view with different
# write permissions:

#                context sec.model sec.level match  read   write  notif
access MyROGroup ""      any       noauth    exact  all    none   none
access MyRWGroup ""      any       noauth    exact  all    all    none


###############################################################################
# System contact information
#

syslocation Right here, right now.
syscontact Me <me at somewhere.org>



###############################################################################
# Process checks.
#
#  Make sure mountd is running
proc mountd

#  Make sure there are no more than 4 ntalkds running, but 0 is ok too.
proc ntalkd 4

#  Make sure at least one sendmail, but less than or equal to 10 are running.
proc sendmail 10 1


###############################################################################
# Executables/scripts
#

# a simple hello world
exec echotest /bin/echo hello world

###############################################################################
# disk checks
#

disk / 10000


###############################################################################
# load average checks
#

# Check for loads:
load 12 14 14


###############################################################################
# Extensible sections.
#



###############################################################################
# Pass through control.
#

###############################################################################
# Subagent control


#

master agentx
agentXperms 0660 0550 nobody asterisk
SNMPD_FLAGS="${SNMPD_FLAGS} -x /var/agentx/master"
mibs +ASTERISK-MIB

###############################################################################
# Further Information







2009/11/27 michal kalinowski <michal.kalinowski at interia.pl>

What operating system do You have ? What asterisk version You compile ?
After install net-snmp do You recompile asterisk with res_snmp module ?

I'm used instruction from here
http://voxilla.com/2009/02/03/configuring-asterisk-snmp-support-1131
and everything work correctly.

BR,
Michał
W dniu 27 listopada 2009 11:18 użytkownik mickael ropars
<mropars at gmail.com> napisał:

> Hi Michal,
>
> thanks a lot for you quick answer I appreciate.
>
> I run your commands and I have the following answer
>
> [localhost snmp]# snmpwalk -c local -v 1 localhost asterisk
> no answer
>
> [localhost snmp]# snmpwalk -c local -v 2c localhost asterisk
> ASTERISK-MIB::asterisk = No Such Object available on this agent at this OID
>
>
> since I don't know well snmp what's going wrong ?
>
> regards
>
> Mickael
>
>
>
> 2009/11/27 michal kalinowski <michal.kalinowski at interia.pl>
>>
>> Hello Mickael
>>
>> Here You have the snmpd.conf file
>>
>> cat /etc/snmp/snmpd.conf
>> rocommunity your_community
>> master agentx
>> agentXperms 0660 0550 nobody asterisk
>> SNMPD_FLAGS="${SNMPD_FLAGS} -x /var/agentx/master"
>> mibs +ASTERISK-MIB
>>
>> and also you need create file /etc/snmp/snmp.conf with following entry
>> "mibs +ASTERISK-MIB"
>>
>> cat /etc/snmp/snmp.conf
>> mibs +ASTERISK-MIB
>>
>> Next use command "snmpwalk -c your_community -v 1 localhost asterisk"
>> to check is everything correct.
>>
>>
>>
>> Michał
>>
>> 2009/11/27 mickael ropars <mropars at gmail.com>:
>> > Hi all,
>> >
>> > I am currently not able to configure SNMP for asterisk, but I am not
>> > able to
>> > acess to the asterisk MIB (the asterisk MIB is in /usr/share/snmp/mibs/)
>> >
>> >
>> > Does somebody has an example of smnpd.conf file wich is working ?
>> >
>> > regards
>> >
>> > Mickael
>> >
>> > _______________________________________________
>> > -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>> >
>> > asterisk-users mailing list
>> > To UNSUBSCRIBE or update options visit:
>> >   http://lists.digium.com/mailman/listinfo/asterisk-users
>> >
>>
>> _______________________________________________
>> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>>
>> asterisk-users mailing list
>> To UNSUBSCRIBE or update options visit:
>>   http://lists.digium.com/mailman/listinfo/asterisk-users
>
>
> _______________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-users
>

_______________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20091127/8a165924/attachment-0001.htm 


More information about the asterisk-users mailing list