-
Notifications
You must be signed in to change notification settings - Fork 130
Plugin: Server alert
Send a SMS whenever your service (eg. Web server, Mail server, Internet connection) is down.
This tool uses fsockopen
function to scan running service port.
Note: Make sure your firewall doesn't block the port scan
IMPORTANT: You need php-cli (http://www.php-cli.com/) to use this plugin.
Alert Name : The name for your alert, it can be anything
Host : Hostname/IP address of your server (it can be local or remote)
Service Port : The number of running service port, eq: 80 for webserver, 25 for smtp/mail, etc.
Connect Timeout : The connection timeout, in seconds.
Phone Number : Recipient of the alert message
Respond Message : The alert message
Status : Alert status (false if the alert get the service is down)
You want to know if your internet connection is down. Off course the computer running Kalkun must be able to connect to the internet first. For example you define www.google.com as a Host to test the internet connection. It's better to define the closest Host from you to the internet to reduce latency.
Next, run the daemon, it uses cron (it's run on *nix environment) to execute the script in every certain time.
Before that, config application/plugins/server_alert/daemon_engine.php
first. Change $uri value
to your kalkun-uri.
For example to run the script every minute launch:
crontab -e
Edit as such
* * * * * /usr/bin/php /var/www/html/kalkun/application/plugins/server_alert/daemon_engine.php
-
/usr/bin/php
is your php-cli program, change it if you use other path. -
/var/www/html/kalkun
is the location of your kalkun source.
More about cron : https://help.ubuntu.com/community/CronHowto
If you have many alerts, determining cron time interval is critical, this is to avoid other instances execute before current instance finishes execution. To determine cron time interval, you can find it at the bottom of plugin dashboard in Kalkun. It shows the total time interval for your alert in seconds.
For example, if it reports 600 seconds. It's same as 5 minutes. Then your cron is like this:
*/5 * * * * /usr/bin/php /var/www/html/kalkun/application/plugins/server_alert/daemon_engine.php
Next, if the alert gets that the service is down, the alert status becomes false
. This is to avoid send the alert SMS repeatedly.
To enable it again, go to Plugin -> Server Alert
, there is Release state
button to renable the alert.
Note : MS Windows user might want to try cron for Windows (http://cronw.sourceforge.net/)