ispconfig alerting

Discussion in 'HOWTO-Related Questions' started by dxh, Mar 3, 2010.

  1. dxh

    dxh New Member

    Does anyone know how I can set up email alerts from ispconfig?
    For example if apache stops, could I be alerted via email?
    Thanks for reading
     
  2. BorderAmigos

    BorderAmigos New Member

    Both monit and webmin have this capability and can monitor your services. If you don't want to use those you could try this hack for ISPConfig 3.

    EDIT: (I had to kill monit and webmin then stop apache2 to test this, it worked.)

    In /usr/local/ispconfig/server/mods-available/monitor_core_module.inc.php

    Find this code...
    Code:
                    $state = 'error'; // because service is down
                }
            }
    
    
            /*
            Insert the data into the database
            */
            $sql = "INSERT INTO monitor_data (server_id, type, created, data, state) " .
    
    Then add the following code and adjust it to your liking.
    Code:
                    $state = 'error'; // because service is down
                }
            }
    
    // Begin hack --------------------------
    if ($state=='error')
    {
    	$server_error="";
    	$server_error.= ($data['webserver'] == 0) ? 'Web Server Down! ' : '';
    	$server_error.= ($data['ftpserver'] == 0) ? 'FTP Server Down! ' : '';
    	$server_error.= ($data['smtpserver'] == 0) ? 'SMTP Server Down! ' : '';
    	$server_error.= ($data['pop3server'] == 0) ? 'POP3 Server Down! ' : '';
    	$server_error.= ($data['imapserver'] == 0) ? 'IMAP Server Down! ' : '';
    	$server_error.= ($data['bindserver'] == 0) ? 'DNS Server Down! ' : '';
    	$server_error.= ($data['mysqlserver'] == 0) ? 'MySQL Server Down! ' : '';
    	mail([email protected]','Server Down',$server_error);
    }
    // End hack ----------------------------
    
            /*
            Insert the data into the database
            */
            $sql = "INSERT INTO monitor_data (server_id, type, created, data, state) " .
    
    This would probably re-send the email every minute as ISPConfig 3 does it's cron so someone may want to improve on it.
     
    Last edited: Mar 4, 2010
  3. dxh

    dxh New Member

    Thanks. Testing now

    Thanks for the help. I will test this out.
     

Share This Page