How to monitor Asterisk trunks with PRTG

How to monitor Asterisk trunks with PRTG

Create shell script


Add the content to the script

var1=$(/usr/sbin/asterisk -rx "sip show peers" |grep trunk_name |awk '{print $6}'| sed 2,2d)
var2=$(echo $data | awk '{print $2}')
if [ "$var1" == OK ]
echo "0:200:running"
if [ $serviceIsRunning == false ]
echo "2:404:UNREACHABLE"

Save the script and make it executable

chmod +x

Try to run it


Go to the PRTG, and add the SSH Script sensor to the device

In the „Script” field choose and SAVE

! Make sure your PRTG Server has access to Asterisk Server, if not, add root username and password
to the credentials in the BASIC DEVICE SETTINGS

Screenshot from 2016-05-31 18-10-05

How to install LAMP Server CentOS 6

sudo yum install httpd
sudo /usr/bin/mysql_secure_installation
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
Remove anonymous users? [Y/n] y                                            
 ... Success!
Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
... Success!

By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!
sudo yum install php php-mysql
sudo chkconfig httpd on sudo chkconfig mysqld on
sudo service httpd restart
yum install mysql mysql-server -y
service mysqld start