Asterik IP-PBX Statistics (SIP/IAX2 protocols)

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

leearcher
Posts: 8
Joined: Tue Oct 06, 2009 10:11 am

Post by leearcher »

Has anyone managed to get it return the exact correct results and not incorrect channel numbers?
Pengu1n
Posts: 24
Joined: Fri Nov 30, 2007 2:07 am
Location: Lithuania, Vilnius
Contact:

Post by Pengu1n »

we updated asx-stats to version 0.3.0
as i see python script works correctly without hanging like old version but:
1. graps still empty, without any data
i researched this problem and found interesting thing: no matter what type of data query is creating, rrd file's name is hostname_core_uptime_XXXX.rrd for all asterisk data sources
another strange tihng i found in data source debug (IAX channels):
Data Source Debug

/usr/local/rrdtool-1.3.6/bin/rrdtool create \
/var/www/rra/asterisk_pbx_cs_core_uptime_3047.rrd \
--step 60 \
DS:iax2_peers_total:GAUGE:120:0:100 \
DS:iax2_peers_online:GAUGE:120:0:100 \
DS:sip_peers_total:GAUGE:120:0:100 \
DS:sip_peers_online:GAUGE:120:0:100 \
DS:iax2_channels:GAUGE:120:0:100 \
DS:iax2_users:GAUGE:120:0:100 \
DS:sip_users:GAUGE:120:0:100 \
DS:sip_channels:GAUGE:120:0:100 \
DS:group_channels:GAUGE:120:0:100 \
DS:agents_loggedin:GAUGE:120:0:100 \
DS:agents_loggedout:GAUGE:120:0:100 \
DS:voicemails:GAUGE:120:0:100 \
DS:core_threads:GAUGE:120:0:100 \
DS:core_uptime:ABSOLUTE:120:0:100 \
RRA:AVERAGE:0.5:1:500 \
RRA:AVERAGE:0.5:1:600 \
RRA:AVERAGE:0.5:6:700 \
RRA:AVERAGE:0.5:24:775 \
RRA:AVERAGE:0.5:288:797 \
RRA:MAX:0.5:1:500 \
RRA:MAX:0.5:1:600 \
RRA:MAX:0.5:6:700 \
RRA:MAX:0.5:24:775 \
RRA:MAX:0.5:288:797 \
as i can understand here's to much DS lines

2. there is a mistake in asterisk agents online/offline monitoring algorithm
mon1:/var/www/scripts# ./asx-stats.py sip.ras.lt agents.loggedin -v
action: command
command: agent show


Response: Follows
Privilege: Command
5600 (CS_KL0) not logged in (musiconhold is 'default')
5601 (CS_KL1) not logged in (musiconhold is 'default')
5602 (CS_KL2) available at '5602@sippool' (musiconhold is 'default')
5603 (CS_KL3) not logged in (musiconhold is 'default')
5604 (CS_KL4) not logged in (musiconhold is 'default')
5605 (CS_KL5) not logged in (musiconhold is 'default')
5606 (CS_KL6) logged in on Local/5606@sippool-9b1e,1 is idle (musiconhold is 'default')
5607 (CS_KL7) not logged in (musiconhold is 'default')
5608 (CS_KN1) not logged in (musiconhold is 'default')
5609 (CS_KN2) not logged in (musiconhold is 'default')
5690 (CS_KL8) logged in on SIP/5690-083551d8 talking to OOH323/192.168.200.10-2885 (musiconhold is 'default')
5691 (CS_KL9) not logged in (musiconhold is 'default')
5692 (CS_KL10) not logged in (musiconhold is 'default')
13 agents configured [3 online , 10 offline]

action: logoff

1
in this situation 3 agents are online but script returns result 1



itconnection wrote:asx-stats was moved to http://www.itconnection.ru/ru/solutions/asx-stats/
New version is available: asx-stats 0.3.0
Bug with too many python processes was fixed.
Configuration file's syntax was changed, you need to create a new configuration file.
Cacti templates was changed too, but the script is compatible with old templates.
socain
Posts: 12
Joined: Tue Jul 24, 2007 8:49 am
Location: Florida, USA

Post by socain »

I was able to get everything to work except group.channels (PSTN Channels) at first. I'm running Asterisk Bus. Edition, so maybe it's works differently in open source version, but for an incoming/outgoing PSTN call I had to set a group variable. This would allow it to show up in the "group show channels" CLI command. Otherwise it would always return 0. With the below settings I can now graph in-use zap channels through AMI.

Example:
[incoming]
exten => s,1,Set(GROUP()=zap-incoming)
exten => s,n,Dial(blah blah)

[outgoing]
exten => _9.,1,Set(GROUP()=zap-outgoing)
exten => _9.,n,Dial(blah blah)

Just thought I would share...
socain
Posts: 12
Joined: Tue Jul 24, 2007 8:49 am
Location: Florida, USA

Also...script error

Post by socain »

Also I found an error in the script (group channels section) that may affect other channel queries too. The scripts runs the command "group show channels" and if only 1 zap channel is in use the AMI return is "1 active channel" (without the "s" on the end of channels.

The script searches for:

Code: Select all

if re.compile("active channels").search(i):
so "1 active channel" would never match and return data. I had to change the line to:

Code: Select all

if re.compile("active channel").search(i):

This will match a line with channel or channels...If I find that it affects other channel queries too I will post back but I was most concerned with seeing zap channels in use.
bourneisp
Posts: 3
Joined: Mon Apr 19, 2010 9:43 pm

Templates

Post by bourneisp »

I am having an issues installing the templates and am receving the error message Error: XML: Hash version does not exist.

I am currently running an older version of cacti which i have inherirted and am quite new to adding addtional functionality to cacti.

Current version is
+--------+
| cacti |
+--------+
| 0.8.6j |
+--------+

My has versuion array looks to be valid what am i missing here.

$hash_version_codes = array(
"0.8.4" => "0000",
"0.8.5" => "0001",
"0.8.5a" => "0002",
"0.8.6" => "0003",
"0.8.6a" => "0004",
"0.8.6b" => "0005",
"0.8.6c" => "0006",
"0.8.6d" => "0007",
"0.8.6e" => "0008",
"0.8.6f" => "0009",
"0.8.6g" => "0010",
"0.8.6h" => "0011",
"0.8.6i" => "0012",
"0.8.6j" => "0013"
);
tricky_1972
Posts: 2
Joined: Thu May 27, 2010 11:47 am

Error: XML: Hash version does not exist

Post by tricky_1972 »

You are running an older version of Cacti, this template is made for a newer version and therefore when it checks the hash number against what your version knows about it spits back: Error: XML: Hash version does not exist, you can "fix" this by changing the hash number in the template, this means changing every occurrence of the hash number, this can be quite a task for some templates that are 10 to 20 pages long! , best bet then is to use regex to search and replace the hash number

Regex example:

Search: (hash_\d*?)19
Replace: ${1}17

Where 19 in the search statement is the hash # to replace and 17 is the # to replace it with (your hash number for your version of Cacti). I use EditPad Pro for this its free (look for the search tab at the top and hit the Show Search Panel.

Warning: Changing the Hash number will not necessarily fix all the problems only the "Error: XML: Hash version does not exist", this may in fact cause other problems that you will have to troubleshoot, there is a reason for the hash value, it's to keep newbs from trying to install templates that were designed for updated versions on older versions and then complaining when they didn't work, which I kinda agree with, my problem is that so often they will update the template for the new version of Cacti but not Leave the old version of the template around for those with older versions of Cacti, Doh!
mattjfrank
Posts: 1
Joined: Thu Jun 03, 2010 7:43 pm

not graphing

Post by mattjfrank »

Hi i recently set this up on one of my servers we use cacti to graph the router, system stats and 3 switches but we cannot seem to get it to graph trixbox asterisk data.

I'm not exactly sure what's wrong with it. The script outputs data, the rrds get updated but the graphs contain all nans and no data.

ANy help would be appreciated.
bourneisp
Posts: 3
Joined: Mon Apr 19, 2010 9:43 pm

Re: Error: XML: Hash version does not exist

Post by bourneisp »

tricky_1972 wrote:You are running an older version of Cacti, this template is made for a newer version and therefore when it checks the hash number against what your version knows about it spits back: Error: XML: Hash version does not exist, you can "fix" this by changing the hash number in the template, this means changing every occurrence of the hash number, this can be quite a task for some templates that are 10 to 20 pages long! , best bet then is to use regex to search and replace the hash number

Regex example:

Search: (hash_\d*?)19
Replace: ${1}17

Where 19 in the search statement is the hash # to replace and 17 is the # to replace it with (your hash number for your version of Cacti). I use EditPad Pro for this its free (look for the search tab at the top and hit the Show Search Panel.

Warning: Changing the Hash number will not necessarily fix all the problems only the "Error: XML: Hash version does not exist", this may in fact cause other problems that you will have to troubleshoot, there is a reason for the hash value, it's to keep newbs from trying to install templates that were designed for updated versions on older versions and then complaining when they didn't work, which I kinda agree with, my problem is that so often they will update the template for the new version of Cacti but not Leave the old version of the template around for those with older versions of Cacti, Doh!

I have now updated my installs and am now coming across a new issue.

+ Running data query [10].
+ Found type = '4 '[script query].
+ Could not find data query XML file at 'path_cacti/resource/script_queries/asx-stats.xml'
+ Error parsing XML file into an array.
+ Could not find data query XML file at 'path_cacti/resource/script_queries/asx-stats.xml'
+ Could not find data query XML file at 'path_cacti/resource/script_queries/asx-stats.xml'
+ Could not find data query XML file at 'path_cacti/resource/script_queries/asx-stats.xml'
bourneisp
Posts: 3
Joined: Mon Apr 19, 2010 9:43 pm

Post by bourneisp »

I had to do a code fix on this, I am not exactly the greatest PHP code but i found adding a line at around line 80 as follows to fix the above issue.

thing is code looks to be right so not sure if it is an xml issues that needs to be looked at in the plugin.

My other queries seem to contiunue to work.

$xml_file_path = db_fetch_cell("select xml_path from snmp_query where id=$snmp_query_id");
$xml_file_path = str_replace("<path_cacti>", $config["base_path"], $xml_file_path);
$xml_file_path = str_replace("path_cacti",$config["base_path"], $xml_file_path);
Brandoo
Posts: 3
Joined: Thu Mar 16, 2006 9:47 pm

Post by Brandoo »

I've had problems when manager.conf was updated and the user I'd configured for cacti was no longer valid.

When trying to login, asx-stat.py just sits there, and sits there.

Skimmed over the thread but can't see this mentioned so here is my solution:

Change

Code: Select all

def login(host, port, username, password):
    sock.connect((host, port))
    return query("action: login\r\nusername: " + username + "\r\nsecret: " + password + "\r\nevents: off\r\n\r\n")
to

Code: Select all

def login(host, port, username, password):
    sock.connect((host, port))
    mesg = query("action: login\r\nusername: " + username + "\r\nsecret: " + password + "\r\nevents: off\r\n\r\n")
    if "Authentication failed" in mesg:
        print "Error: Unable to Authenticate with AMI"
        sys.exit()
    else:
        return mesg
I've also added an option to return stats for calls if anyone is interested in knowing details on incoming and outgoing calls.[/code]
User avatar
goba2000
Posts: 2
Joined: Wed Sep 15, 2010 6:59 am
Contact:

Linux 2.6.30-std-def-alt15

Post by goba2000 »

Добрый день!

Спасибо что сделали и выложили Asterik IP-PBX Statistics.
Немного помучавшись, прибегнув к советам бородатых гуру линукса, я смог прикрутить этот мониторинг к своему Asterisk-у.

Есть пара вопросов, если поможете, буду благодарен, да думаю и другим пригодиться:

1) Есть график cacti_graph_template_asterisk_sip_channels. Как я понял, он отражает количество активных SIP каналов. Вопрос. Информация снимается 1 раз в 5 минут. Это число активных каналов в текущий момент (момент съема информации) или это число активных каналов за последние 5 минут?

2) Есть график cacti_graph_template_asterisk_zap_channels. Я так понял, что этот график рисует общее число ZAP или DAHDI каналов. А почему нет графика числа активных ZAP или DAHDI каналов? Он, мне кажется был бы более интересен. Если у како есть такой график, сможете поделиться?

3) Что означают графики cacti_graph_template_asterisk_heartbeat , cacti_graph_template_asterisk_threads я вообще не понял (очевидно в силу низкой квалификации). Кто знает, расскажите плиз. тест

Спасибо.
Last edited by goba2000 on Sun Oct 24, 2010 1:43 pm, edited 1 time in total.
User avatar
goba2000
Posts: 2
Joined: Wed Sep 15, 2010 6:59 am
Contact:

?

Post by goba2000 »

Неужели никто не ответит, а?
vfstaboy
Posts: 1
Joined: Tue Oct 19, 2010 3:18 pm

Re: Asterik IP-PBX Statistics (SIP/IAX2 protocols)

Post by vfstaboy »

Hello, is there or will there be support for ssl encryption when communicating with AMI on port 5039? I tried switching the port but I get "[Errno 104] Connection reset by peer". I can use "openssl s_client -connect hostname:5039" just fine from a commandline so I know ssl is working on the Asterisk server.

-George
rmoura
Posts: 4
Joined: Thu Jan 06, 2011 1:23 pm

Re: Asterik IP-PBX Statistics (SIP/IAX2 protocols)

Post by rmoura »

Hy,

I lost tons of hours trying to figure out what is going on without success, so if someone could help, i'll appreciate it.

asx-stats.py 0.3 has been installed as the instructions.

when i try in command line:

su cacti -c "/usr/share/cacti/scripts/asx-stats.py tcp:192.168.1.2 --get iax2.peers.total asterisk"
or
/usr/share/cacti/scripts/asx-stats.py tcp:192.168.1.2 iax2.peers.total

i get results, and the same with all the other keys, but when cacti trys it always get :

Code: Select all

1/06/2011 06:59:22 PM - CMDPHP: Poller[0] Host[6] DS[122] CMD: /usr/share/cacti/scripts/asx-stats.py tcp:192.168.1.2 --get iax2.peers.total asterisk, output: U
01/06/2011 06:59:23 PM - CMDPHP: Poller[0] Host[6] DS[121] WARNING: Result from CMD not valid.  Partial Result: U
01/06/2011 06:59:23 PM - CMDPHP: Poller[0] Host[6] DS[121] CMD: /usr/share/cacti/scripts/asx-stats.py tcp:192.168.1.2 --get iax2.channels asterisk, output: U
01/06/2011 06:59:23 PM - CMDPHP: Poller[0] Host[6] DS[120] WARNING: Result from CMD not valid.  Partial Result: U
01/06/2011 06:59:23 PM - CMDPHP: Poller[0] Host[6] DS[120] CMD: /usr/share/cacti/scripts/asx-stats.py tcp:192.168.1.2 --get core.uptime asterisk, output: U
01/06/2011 06:59:23 PM - CMDPHP: Poller[0] Host[6] DS[124] WARNING: Result from CMD not valid.  Partial Result: U
01/06/2011 06:59:23 PM - CMDPHP: Poller[0] Host[6] DS[124] CMD: /usr/share/cacti/scripts/asx-stats.py tcp:192.168.1.2 --get group.channels asterisk, output: U
01/06/2011 06:59:23 PM - CMDPHP: Poller[0] Host[6] DS[125] WARNING: Result from CMD not valid.  Partial Result: U
01/06/2011 06:59:23 PM - CMDPHP: Poller[0] Host[6] DS[125] CMD: /usr/share/cacti/scripts/asx-stats.py tcp:192.168.1.2 --get sip.channels asterisk, output: U
01/06/2011 06:59:23 PM - CMDPHP: Poller[0] Host[6] DS[126] WARNING: Result from CMD not valid.  Partial Result: U
01/06/2011 06:59:23 PM - CMDPHP: Poller[0] Host[6] DS[126] CMD: /usr/share/cacti/scripts/asx-stats.py tcp:192.168.1.2 --get sip.peers.total asterisk, output: U
01/06/2011 06:59:23 PM - CMDPHP: Poller[0] Host[6] DS[126] WARNING: Result from CMD not valid.  Partial Result: U
01/06/2011 06:59:23 PM - CMDPHP: Poller[0] Host[6] DS[126] CMD: /usr/share/cacti/scripts/asx-stats.py tcp:192.168.1.2 --get sip.peers.online asterisk, output: U
01/06/2011 06:59:23 PM - CMDPHP: Poller[0] Host[6] DS[127] WARNING: Result from CMD not valid.  Partial Result: U
01/06/2011 06:59:23 PM - CMDPHP: Poller[0] Host[6] DS[127] CMD: /usr/share/cacti/scripts/asx-stats.py tcp:192.168.1.2 --get sip.users asterisk, output: U
01/06/2011 06:59:23 PM - CMDPHP: Poller[0] Host[6] DS[128] WARNING: Result from CMD not valid.  Partial Result: U
01/06/2011 06:59:23 PM - CMDPHP: Poller[0] Host[6] DS[128] CMD: /usr/share/cacti/scripts/asx-stats.py tcp:192.168.1.2 --get core.threads asterisk, output: U
01/06/2011 06:59:23 PM - CMDPHP: Poller[0] Host[6] DS[129] WARNING: Result from CMD not valid.  Partial Result: U
01/06/2011 06:59:23 PM - CMDPHP: Poller[0] Host[6] DS[129] CMD: /usr/share/cacti/scripts/asx-stats.py tcp:192.168.1.2 --get voicemails asterisk, output: U

coul anyone help?

All the graphs are empty....
mwolff
Posts: 1
Joined: Sun Apr 10, 2011 1:21 pm

Re: Asterik IP-PBX Statistics (SIP/IAX2 protocols)

Post by mwolff »

Hello,

I have installed the last version and well configured manager.conf on my asterisk 1.8 server. But when i test the connection, i have this : 111 Connection refused.
The pb is that i do not see connection on my asterisk !

What can i do ?

Thanks

Matt
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest