Thanks Marcus, I changed the minimum number of faults to 1 and now I am getting a more realistic representation of the real problems.
Announcement
Collapse
No announcement yet.
email notifactions
Collapse
X
-
It took me almost all of the 14 day free trial period to work out how these notifications worked and their subsequent eMail notices
I agree, there is a complete lack of (easily found) documentation but it is there
The first thing to be aware of is that all the items being monitored are classed as processes; CPU, Memory, IO, and NPROC
The first slightly misleading item is the NPROC
As per my reply #8
The Memory is not the actual memory in RAM, but the number of 4KB pages
This just means you need to remember to either multiply or divide by 4, depending on what you are trying to achieve
However, I had severe problems trying to work out where to find the cause of an account reporting Excessive Account Resources
Once I had all these settings within LVE I then transferred them to LFD, and this resolved the issue
I now receive an hourly eMail from LVE (if an account exceeds a resource) followed by one from LFD explaining the actual cause
Comment
-
Sure. Here is the code that I am using. It needs to be tweaked a bit to send to the account holders, as for now we have it sent only to admin. But it gives a much better report than the useless one CloudLinux is doing...
Its PHP code, and needs to run via cron with whatever frequency you want.
Code://--------------- $email_from = "[URL]admin@mycompany.com[/URL]"; $email_cc = ""; [URL]//admin@mycompany.com[/URL]"; // Leave blank if not needed. $email_subject = "Hosting account resources exceeded"; $lveinfo_period = 24; // Number of hours for the lveinfo to report. //--------------- //================================================================================================== $lveinfo_cmd = /usr/sbin/lveinfo --period=".$lveinfo_period.h" --by-fault="any" --display-username --csv --limit=999; // lveinfo --period="2h" --by-fault="any" --display-username --limit=999 // Get list of users who have had faults or exceeded limits. exec($lveinfo_cmd, $lve_cmd_output); array_shift($lve_cmd_output); // Remove 1st line of output array, since it is just header info. // For each user in the list… foreach ($lve_cmd_output as $line) { //echo "$line "; // Put the line into usable variables. list($ID,$aCPU,$mCPU,$lCPU,$aEP,$mEP,$lEP,$aVMem,$mVMem,$lVMem,$VMemF,$EPf,$aPMem,$mPMem,$lPMem,$aNproc,$mNproc,$lNproc,$PMemF,$NprocF,$aIO,$mIO,$lIO) = explode(",", $line); //echo "$ID,$aCPU,$mCPU,$lCPU,$aEP,$mEP,$lEP,$aVMem,$mVMem,$lVMem,$VMemF,$EPf,$aPMem,$mPMem,$lPMem,$aNproc,$mNproc,$lNproc,$PMemF,$NprocF,$aIO,$mIO,$lIO "; $message = "** ATTENTION ** Your "".$ID."" web hosting account exceeded one or more of its resource limits within the last ".$lveinfo_period." hours: "; // Determine what had a fault and/or exceeded a limit and make a message for user. // CPU if ( $mCPU >= $lCPU ) { $message = $message . "- Exceeded the CPU limit of $lCPU% of total server CPU. Your website was forced to load slower to reduce its CPU usage. "; } // Concurrent Connections if ( $EPf >> 0 ) { $message = $message . "- Exceeded the maximum of $lEP concurrent website connections. Your website was not available $EPf times because of this problem. "; } // Virtual Memory if ( $VMemF >> 0 ) { $message = $message . "- Exceeded the ".displayFileSize($lVMem)." virtual memory limit. Your website was not available $VMemF times because of this problem. "; } // Physical Memory if ( $PMemF >> 0 ) { $message = $message . "- Exceeded the ".displayFileSize($lPMem)." physical memory limit. Your website was not available $PMemF times because of this problem. "; } // Number of Processes if ( $NprocF >> 0 ) { $message = $message . "- Exceeded the maximum of $mNproc total account processes. Your website was not available $NprocF times because of this problem. "; } // Disk IO if ( $mIO >> $lIO ) { $message = $message . "- Exceeded the maximum disk io rate. You used ".displayFileSize($mIO)." of ".displayFileSize($lIO).". The disk io speed for your account was slowed as a result of this problem. "; } // // Number of Inodes // // Get users contact email(s) from cpanel account info. $cpanel_account_info = file("/var/cpanel/users/".$ID); array_shift($cpanel_account_info); // Remove 1st two lines. array_shift($cpanel_account_info); foreach ($cpanel_account_info as $line) { if (strpos($line,CONTACTEMAIL=) !== false) { // Does the string contain first contact email? $values = explode("=", $line); $CONTACTEMAIL = rtrim($values[1] ;) ; } elseif (strpos($line,CONTACTEMAIL2=) !== false) { // Does the string contain second contact email? $values = explode("=", $line); $CONTACTEMAIL2 = rtrim($values[1] ;) ; } elseif (strpos($line,DNS=) !== false) { $values = explode("=", $line); $WEBSITE = rtrim($values[1] ;) ; } elseif (strpos($line,OWNER=) !== false) { $values = explode("=", $line); $RESELLER = rtrim($values[1] ;) ; } } // Only send emails to our direct customers... not resellers accounts. if ($RESELLER == "hostvaul" ;) { // Add some helpful instructions for more info. $message = $message . " To view full details about your web hosting accounts resource usage, including the time of each incident listed above, please click the link below and log into your cpanel hosting control panel, then click the "Resource Usage" link under the "Logs and Statistics" section. "; $message = $message . " [URL]http://".$WEBSITE."/cpanel [/URL]"; $message = $message. "If your account is regularly exceeding its available resources, please consider upgrading to a higher level hosting plan that includes more resources. If you have any questions or need help with anything, just reply to this email and let us know. "; $message = $message. "Sincerely, The My Company Support Team "; $message = $message. "------------ My Company - [URL]http://www.mycompany.com Our[/URL] customers sleep better. "; // Send user the notification. $email_to = $CONTACTEMAIL; if (rtrim($CONTACTEMAIL2) != "" ;) { $email_to = $email_to.",".$CONTACTEMAIL2; } // For testing. $message = $message . "------------------------------------------ "; $message = $message . "Email to: ".$email_to." "; $email_to = "[URL]admin@mydomain.com[/URL]"; // End of testing. $headers = "From: ".$email_from; if (rtrim($send_cc) != "" ;) { $headers = $headers. " " ."CC: ".$email_cc; } mail($email_to,$email_subject,$message,$headers); echo $message; } } function displayFileSize($size,$unit="" ;) { if( (!$unit && $size >= 1<<30) || $unit == "GB" ;) return number_format($size/(1<<30))."GB"; if( (!$unit && $size >= 1<<20) || $unit == "MB" ;) return number_format($size/(1<<20))."MB"; if( (!$unit && $size >= 1<<10) || $unit == "KB" ;) return number_format($size/(1<<10))."KB"; return number_format($size)." bytes"; } ?>
Comment
-
These notifications are most stupid thing any progeammer ever introduce...I just had server overload with your stupid notifications to resellerss end users...one reseller had 4 accounts with bots and while LVM worked perfektly to limit server resource abuse from users and reseller but than it abuse it it self by sending few thousand emails and mail in queue there was about 10000 emails...what I dont get it how it can send such huge number of emails when it was configure to send notification every 1 hour ...also why I as server owner cant disable sending notifications to resellers users???You should set this feature completly optional since it is completly useless...now I have set "Minimum number of Faults to notify end user" to 1+ nice amount of ziros and if this doesnt work I will remove it completly and maybe even move to Centos .
Comment
-
20 minutes after I empty mail queue ..142 records and 230 already sent ...372 emails for 20 minutes.. https://s25.postimg.org/wur1jkian/Screenshot_32.png
Comment
-
What do you have in settings for notifications? Unless you set it to email once a minute -- I dont see how that could have happened. It is either a bug, or you have set settings to send notifications very often. The defaults are once every 12 hours.
Comment
Comment