aouyar / PyMunin

Python Module for developing Munin Multigraph Monitoring Plugins. Multigraph Plugins for Apache Web Server, Apache Tomcat, APC PHP Cache, PHP FPM (Fast Process Manager), Asterisk, FreeSWITCH, Lighttpd, Memcached, MySQL Database, Nginx, NTP, PostgreSQL Database, CPU Utilization, Memory Utilization, Disk Usage, Disk I/O, Network Interfaces, Network Connections, Processes and Threads, etc.
http://aouyar.github.io/PyMunin
GNU General Public License v3.0
128 stars 44 forks source link

Empty Asterisk graphs? #1

Closed patrickod closed 13 years ago

patrickod commented 13 years ago

So I have tried to set up pymunin's asterisk plugin on a machine of mine. I can see the pymunin "manager" log in and out in the Asterisk CLI and I know that data is being received by the main box from this node as other graphs are accurate.

aouyar commented 13 years ago

Could you run the following commands on the node and send me the output: munin-run asteriskstats config munin-run asteriskstats

patrickod commented 13 years ago

output from munin-run asteriskstats config

graph_title Asterisk - Call Stats
graph_category Asterisk
graph_info Asterisk - Information on Calls.
graph_args --base 1000 --lower-limit 0
graph_period minute
active_calls.label active_calls
active_calls.type GAUGE
active_calls.draw LINE2
active_calls.info Active Calls
calls_per_min.label calls_per_min
calls_per_min.type DERIVE
calls_per_min.draw LINE2
calls_per_min.info Calls per minute
calls_per_min.min 0

multigraph asterisk_channels
graph_title Asterisk - Active Channels
graph_category Asterisk
graph_info Asterisk - Information on Active Channels.
graph_args --base 1000 --lower-limit 0
sip.label sip
sip.type GAUGE
sip.draw AREASTACK
iax2.label iax2
iax2.type GAUGE
iax2.draw AREASTACK
dahdi.label dahdi
dahdi.type GAUGE
dahdi.draw AREASTACK
misdn.label misdn
misdn.type GAUGE
misdn.draw AREASTACK
local.label local
local.type GAUGE
local.draw AREASTACK
mix.label mix
mix.type GAUGE
mix.draw LINE2
mix.label mix
mix.type GAUGE
mix.draw LINE2

multigraph asterisk_peers_sip
graph_title Asterisk - VoIP Peers - SIP
graph_category Asterisk
graph_info Asterisk - Information on SIP VoIP Peers.
graph_args --base 1000 --lower-limit 0
online.label online
online.type GAUGE
online.draw AREASTACK
unmonitored.label unmonitored
unmonitored.type GAUGE
unmonitored.draw AREASTACK
unreachable.label unreachable
unreachable.type GAUGE
unreachable.draw AREASTACK
lagged.label lagged
lagged.type GAUGE
lagged.draw AREASTACK
unknown.label unknown
unknown.type GAUGE
unknown.draw AREASTACK

multigraph asterisk_peers_iax2
graph_title Asterisk - VoIP Peers - IAX2
graph_category Asterisk
graph_info Asterisk - Information on IAX2 VoIP Peers.
graph_args --base 1000 --lower-limit 0
online.label online
online.type GAUGE
online.draw AREASTACK
unmonitored.label unmonitored
unmonitored.type GAUGE
unmonitored.draw AREASTACK
unreachable.label unreachable
unreachable.type GAUGE
unreachable.draw AREASTACK
lagged.label lagged
lagged.type GAUGE
lagged.draw AREASTACK
unknown.label unknown
unknown.type GAUGE
unknown.draw AREASTACK

multigraph asterisk_voip_codecs
graph_title Asterisk - VoIP Codecs for Active Channels
graph_category Asterisk
graph_info Asterisk - Codecs for Active VoIP Channels (SIP/IAX2)
graph_args --base 1000 --lower-limit 0
alaw.label alaw
alaw.type GAUGE
alaw.draw AREASTACK
ulaw.label ulaw
ulaw.type GAUGE
ulaw.draw AREASTACK
gsm.label gsm
gsm.type GAUGE
gsm.draw AREASTACK
g729.label g729
g729.type GAUGE
g729.draw AREASTACK
other.label other
other.type GAUGE
other.draw AREASTACK

multigraph asterisk_conferences
graph_title Asterisk - Conferences
graph_category Asterisk
graph_info Asterisk - Information on Meetme Conferences
graph_args --base 1000 --lower-limit 0
rooms.label rooms
rooms.type GAUGE
rooms.draw LINE2
rooms.info Active conference rooms.
users.label users
users.type GAUGE
users.draw LINE2
users.info Total number of users in conferences.

multigraph asterisk_voicemail
graph_title Asterisk - Voicemail
graph_category Asterisk
graph_info Asterisk - Information on Voicemail Accounts
graph_args --base 1000 --lower-limit 0
accounts.label accounts
accounts.type GAUGE
accounts.draw LINE2
accounts.info Number of voicemail accounts.
msg_avg.label msg_avg
msg_avg.type GAUGE
msg_avg.draw LINE2
msg_avg.info Average number of messages per voicemail account.
msg_max.label msg_max
msg_max.type GAUGE
msg_max.draw LINE2
msg_max.info Maximum number of messages in one voicemail account.
msg_total.label msg_total
msg_total.type GAUGE
msg_total.draw LINE2
msg_total.info Total number of messages in all voicemail accounts.

multigraph asterisk_trunks
graph_title Asterisk - Trunks
graph_category Asterisk
graph_info Asterisk - Active calls on trunks.
graph_args --base 1000 --lower-limit 0
PSTN.label PSTN
PSTN.type GAUGE
PSTN.draw AREASTACK
VoIP.label VoIP
VoIP.type GAUGE
VoIP.draw AREASTACK

and munin-run asteriskstats

  File "/etc/munin/plugins/asteriskstats", line 240, in <module>
    sys.exit(muninMain(MuninAsteriskPlugin))
  File "/usr/share/munin/plugins/pymunin/__init__.py", line 646, in muninMain
    ret = plugin.run()
  File "/usr/share/munin/plugins/pymunin/__init__.py", line 451, in run
    ret = self.fetch()
  File "/usr/share/munin/plugins/pymunin/__init__.py", line 429, in fetch
    self.retrieveVals()
  File "/etc/munin/plugins/asteriskstats", line 174, in retrieveVals
    self._amiuser, self._amipass)
  File "/usr/share/munin/plugins/pysysinfo/asterisk.py", line 71, in __init__
    self._initAsteriskVersion()
  File "/usr/share/munin/plugins/pysysinfo/asterisk.py", line 202, in _initAsteriskVersion
    version_str = self.getAsteriskVersion()
  File "/usr/share/munin/plugins/pysysinfo/asterisk.py", line 249, in getAsteriskVersion
    cmdresp = self.executeCommand(cmd)
  File "/usr/share/munin/plugins/pysysinfo/asterisk.py", line 237, in executeCommand
    'failed: %s' % command)
Exception: Execution of Asterisk Manager Interface Commandfailed: core show version```

for context I'm running python 2.7 and asterisk 1.6.2.9 on Debian
aouyar commented 13 years ago

Hi Patrick,

I've just installed Asterisk version 1.6.2.9-2ubuntu2.1 on Ubuntu. I will try to replicate the error and return to you soon.

Thanks for helping to improve PyMunin, Ali

aouyar commented 13 years ago

Modified asterisk.py file for debugging.

On Fri, Jul 29, 2011 at 9:10 AM, patrickod < reply@reply.github.com>wrote:

output from munin-run asteriskstats config '''multigraph asterisk_calls graph_title Asterisk - Call Stats graph_category Asterisk graph_info Asterisk - Information on Calls. graph_args --base 1000 --lower-limit 0 graph_period minute active_calls.label active_calls active_calls.type GAUGE active_calls.draw LINE2 active_calls.info Active Calls calls_per_min.label calls_per_min calls_per_min.type DERIVE calls_per_min.draw LINE2 calls_per_min.info Calls per minute calls_per_min.min 0

multigraph asterisk_channels graph_title Asterisk - Active Channels graph_category Asterisk graph_info Asterisk - Information on Active Channels. graph_args --base 1000 --lower-limit 0 sip.label sip sip.type GAUGE sip.draw AREASTACK iax2.label iax2 iax2.type GAUGE iax2.draw AREASTACK dahdi.label dahdi dahdi.type GAUGE dahdi.draw AREASTACK misdn.label misdn misdn.type GAUGE misdn.draw AREASTACK local.label local local.type GAUGE local.draw AREASTACK mix.label mix mix.type GAUGE mix.draw LINE2 mix.label mix mix.type GAUGE mix.draw LINE2

multigraph asterisk_peers_sip graph_title Asterisk - VoIP Peers - SIP graph_category Asterisk graph_info Asterisk - Information on SIP VoIP Peers. graph_args --base 1000 --lower-limit 0 online.label online online.type GAUGE online.draw AREASTACK unmonitored.label unmonitored unmonitored.type GAUGE unmonitored.draw AREASTACK unreachable.label unreachable unreachable.type GAUGE unreachable.draw AREASTACK lagged.label lagged lagged.type GAUGE lagged.draw AREASTACK unknown.label unknown unknown.type GAUGE unknown.draw AREASTACK

multigraph asterisk_peers_iax2 graph_title Asterisk - VoIP Peers - IAX2 graph_category Asterisk graph_info Asterisk - Information on IAX2 VoIP Peers. graph_args --base 1000 --lower-limit 0 online.label online online.type GAUGE online.draw AREASTACK unmonitored.label unmonitored unmonitored.type GAUGE unmonitored.draw AREASTACK unreachable.label unreachable unreachable.type GAUGE unreachable.draw AREASTACK lagged.label lagged lagged.type GAUGE lagged.draw AREASTACK unknown.label unknown unknown.type GAUGE unknown.draw AREASTACK

multigraph asterisk_voip_codecs graph_title Asterisk - VoIP Codecs for Active Channels graph_category Asterisk graph_info Asterisk - Codecs for Active VoIP Channels (SIP/IAX2) graph_args --base 1000 --lower-limit 0 alaw.label alaw alaw.type GAUGE alaw.draw AREASTACK ulaw.label ulaw ulaw.type GAUGE ulaw.draw AREASTACK gsm.label gsm gsm.type GAUGE gsm.draw AREASTACK g729.label g729 g729.type GAUGE g729.draw AREASTACK other.label other other.type GAUGE other.draw AREASTACK

multigraph asterisk_conferences graph_title Asterisk - Conferences graph_category Asterisk graph_info Asterisk - Information on Meetme Conferences graph_args --base 1000 --lower-limit 0 rooms.label rooms rooms.type GAUGE rooms.draw LINE2 rooms.info Active conference rooms. users.label users users.type GAUGE users.draw LINE2 users.info Total number of users in conferences.

multigraph asterisk_voicemail graph_title Asterisk - Voicemail graph_category Asterisk graph_info Asterisk - Information on Voicemail Accounts graph_args --base 1000 --lower-limit 0 accounts.label accounts accounts.type GAUGE accounts.draw LINE2 accounts.info Number of voicemail accounts. msg_avg.label msg_avg msg_avg.type GAUGE msg_avg.draw LINE2 msg_avg.info Average number of messages per voicemail account. msg_max.label msg_max msg_max.type GAUGE msg_max.draw LINE2 msg_max.info Maximum number of messages in one voicemail account. msg_total.label msg_total msg_total.type GAUGE msg_total.draw LINE2 msg_total.info Total number of messages in all voicemail accounts.

multigraph asterisk_trunks graph_title Asterisk - Trunks graph_category Asterisk graph_info Asterisk - Active calls on trunks. graph_args --base 1000 --lower-limit 0 PSTN.label PSTN PSTN.type GAUGE PSTN.draw AREASTACK VoIP.label VoIP VoIP.type GAUGE VoIP.draw AREASTACK '''

and munin-run asteriskstats '''Traceback (most recent call last): File "/etc/munin/plugins/asteriskstats", line 240, in sys.exit(muninMain(MuninAsteriskPlugin)) File "/usr/share/munin/plugins/pymunin/init.py", line 646, in muninMain ret = plugin.run() File "/usr/share/munin/plugins/pymunin/init.py", line 451, in run ret = self.fetch() File "/usr/share/munin/plugins/pymunin/init.py", line 429, in fetch self.retrieveVals() File "/etc/munin/plugins/asteriskstats", line 174, in retrieveVals self._amiuser, self._amipass) File "/usr/share/munin/plugins/pysysinfo/asterisk.py", line 71, in init self._initAsteriskVersion() File "/usr/share/munin/plugins/pysysinfo/asterisk.py", line 202, in _initAsteriskVersion version_str = self.getAsteriskVersion() File "/usr/share/munin/plugins/pysysinfo/asterisk.py", line 249, in getAsteriskVersion cmdresp = self.executeCommand(cmd) File "/usr/share/munin/plugins/pysysinfo/asterisk.py", line 237, in executeCommand 'failed: %s' % command) Exception: Execution of Asterisk Manager Interface Commandfailed: core show version'''

for context I'm running python 2.7 and asterisk 1.6.2.9 on Debian

Reply to this email directly or view it on GitHub: https://github.com/aouyar/PyMunin/issues/1#issuecomment-1679060

aouyar commented 13 years ago

Hi Patrick,

Everything works fine over here. Could you help me out with the debugging?

I've just sent you a new version of /usr/share/munin/plugins/pysysinfo/asterisk.py with some debugging enabled. Could you run the munin-run commands with this file in place.

Thanks

aouyar commented 13 years ago

I've managed to replicate the error, when the Asterisk manager user does not have the permissions necessary for executing the show CLI commands. I've committed a fix to improve error reporting in the Asterisk Plugin.

patrickod commented 13 years ago

Thanks for the help. Is there a list of permissions that the pymunin manager should be granted to ensure it works ?

aouyar commented 13 years ago

I've not done detailed testing with AMI permissions, but seems like you at least need read and write command permisions. I am out of office at the moment so I will not be able to do some real testing.