Skip to content

gxovano/asterisk-zabbix

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dependency:          
python 2.6+     
python-all-dev     
Zabbix 2.4+    
asterisk 1.8+    
argparse 1.2.1+    
pexpect 3.3+    
posix-ipc 0.9.9+    
wsgiref 0.1.2+    

** Install zabbix agent**

```
#!python

aptitude install zabbix-agent
```


**Install python modules:**

```
#!python

aptitude install python-pip python-all-dev
pip install argparse pexpect posix-ipc wsgiref

```
**get asterisk-zabbix**

```
#!python
cd /etc/zabbix/
git clone https://[email protected]/SimakinK/asterisk-zabbix.git
cd asterisk-zabbix-py
```
**Edit settings.py**

```
#!python
# coding=utf-8
HOST = "localhost"
PORT = "5038"
USERNAME = "zabbix" 
PASSWORD = "zabbixpasswordami"
DEFAULT_TIMEOUT = 3
AMI_VERSION = "1.3"
```
Use "telnet localhost 5038" for get AMI version

Modify /etc/asterisk/manager.conf and include this block.


```
#!python
[zabbix] ; username from settings.py
secret=zabbixpasswordami ; password from settings.py
deny=0.0.0.0/0.0.0.0
permit=127.0.0.1/255.255.255.0
read = system,call,log,verbose,agent,user,config,dtmf,reporting,cdr,dialplan
write = system,call,agent,user,command,reporting,message
allowmultiplelogin = yes
displayconnects = no
writetimeout = 100
```
Please change the password, and then restart asterisk.

Add the following lines to your Zabbix Agent config. (zabbix_agentd.conf)
```
#!python
Include=/etc/zabbix/asterisk-zabbix-py/userparameter_asterisk.conf
```
Restart your Zabbix agent.    

#Usage

Available commands:
    
channel - CoreShowChannels    
member - SIP member    
peer - SIP peers    
queue - SIP queue    
registry - SIP registrations    

Parameters 

```
#!python

 ./run.py <command> -a  Discovery.
 ./run.py <command> -f <field_name> -p <param>                 Return the param of the field
 ./run.py <command> -f <field_name> -p <param> -r <regex>      Regular expression for field value. (Return group 1)
 ./run.py <command> -v Verbose
```


Examples:


```
#!python

sudo -u zabbix /etc/zabbix/asterisk-zabbix-py/run.py registry -a  Return all SIP Registrations 
sudo -u zabbix /etc/zabbix/asterisk-zabbix-py/run.py iax2 -a  Return all IAX2 Peers
sudo -u zabbix /etc/zabbix/asterisk-zabbix-py/run.py iax2 -a  f Status -r "(\d+)" -p 101   Return Qualify user 101
sudo -u zabbix /etc/zabbix/asterisk-zabbix-py/run.py iax2 -a  f Status -r "(\w+)" -p 101   Return Status user 101
sudo -u zabbix /etc/zabbix/asterisk-zabbix-py/run.py peer -a  Return all SIP Peers 
sudo -u zabbix /etc/zabbix/asterisk-zabbix-py/run.py peer -f Address-IP -p 101 Return ip address peer 101 
sudo -u zabbix /etc/zabbix/asterisk-zabbix-py/run.py peer -f Status -r "(\d+)" -p 101   Return Qualify user 101
sudo -u zabbix /etc/zabbix/asterisk-zabbix-py/run.py peer -f Status -r "(\w+)" -p 101   Return Status user 101
```

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%