Asterik IP-PBX Statistics (SIP/IAX2 protocols)
Moderators: Developers, Moderators
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):
2. there is a mistake in asterisk agents online/offline monitoring algorithm
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):
as i can understand here's to much DS linesData 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 \
2. there is a mistake in asterisk agents online/offline monitoring algorithm
in this situation 3 agents are online but script returns result 1mon1:/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
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.
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...
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...
Code: Select all
Also...script error
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:
so "1 active channel" would never match and return data. I had to change the line to:
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.
The script searches for:
Code: Select all
if re.compile("active channels").search(i):
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.
Templates
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"
);
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"
);
-
- Posts: 2
- Joined: Thu May 27, 2010 11:47 am
Error: XML: Hash version does not exist
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!
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!
-
- Posts: 1
- Joined: Thu Jun 03, 2010 7:43 pm
not graphing
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.
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.
Re: Error: XML: Hash version does not exist
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'
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);
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);
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
to
I've also added an option to return stats for calls if anyone is interested in knowing details on incoming and outgoing calls.[/code]
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")
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
Linux 2.6.30-std-def-alt15
Добрый день!
СпаÑибо что Ñделали и выложили 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 Ñ Ð²Ð¾Ð¾Ð±Ñ‰Ðµ не понÑл (очевидно в Ñилу низкой квалификации). Кто знает, раÑÑкажите плиз. тест
СпаÑибо.
СпаÑибо что Ñделали и выложили 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.
?
Ðеужели никто не ответит, а?
Re: Asterik IP-PBX Statistics (SIP/IAX2 protocols)
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
-George
Re: Asterik IP-PBX Statistics (SIP/IAX2 protocols)
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 :
coul anyone help?
All the graphs are empty....
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....
Re: Asterik IP-PBX Statistics (SIP/IAX2 protocols)
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
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
Who is online
Users browsing this forum: No registered users and 1 guest