Customize lve-stats-2 notifications

Navigation:  LVE-Stats 2 > Configuration >

Customize lve-stats-2 notifications

Previous pageReturn to chapter overviewNext page

Jinja2 is used as a template engine for the notifications.

 

The templates for notifications are located in /usr/share/lve/emails/LOCALE, where LOCALE - is the directory with localization name (language codes are formed according to ISO 639-1 and ISO 639-2). By default the templates for English are set: /usr/share/lve/emails/en_US.

 

/usr/share/lve/emails/en_US contains the following templates:

 

admin_notify.html  admin_notify.txt for administrator;

reseller_notify.html  reseller_notify.txt for reseller;

user_notify.txt for user.

 

The notification is formed as Multipart content type [RFC1341(MIME)]. The plain text is taken from the .txt files, html version - from the .html template. In case when only one template is present (.txt or .html) the notification is sent as a Non-multipart content type notification. It is better to use Multipart content type notifications because when a mail client can not display an html-format message, then it will be displayed as plain text version.

 

To localize notifications copy standard templates into directory with the proper locale name and translate the template. Also you can customize the main template making proper changes into it.

 

The list of variables that can be used in the template:

 

Variable

Example

Description

TONAME

“Customer”

Notification receiver user name. Taken from profile in the control panel, by default - “Customer” for user, “Administrator” for administrator, “Reseller” for reseller.

TOMAIL

[email protected]

Notification receiver email address.

DOMAIN

“wordpress.test247.cloudlinux.com”

Main domain. Available only for user.

LOCALE

“en_US”

Locale in which the notification is sent. Available only for user.

RESELLER

“root”

User reseller. Available only for user.

PERIOD

“12 hours”

Verification and notification sending period.

LOGIN

“wordpress”

User login in the system.

ID

500

User ID in the system.

lPMem lEP PMemF lVMem anyF IOf VMemF lCPU aIOPS aEP aPMem IOPSf lIO lIOPS aIO EPf aCPU aVMem NprocF aNproc lNproc CPUf'


See description in lveinfo --help output. Available only for users

STATS_HTML


html table with the list of users that exceeded limits. Available for administrator and reseller.

STATS


ascii - table with the list of users that exceeded limits. Available only for admins and resellers.

 

Sender’s email address by default is administrator email address from control panel settings ([email protected]{hostn_name} if there is no email in the control panel).

 

It can be changed with NOTIFY_FROM_EMAIL option in the config /etc/sysconfig/lvestats.config/StatsNotifier.cfg

 

For example:

 

[email protected]

 

To apply changes restart lve-stats service:

 

service lvestats restart

 

for CloudLinux 7

 

systemctl restart lvestats.service

 

Default subject is “Hosting account resources exceeded”.  It can be changed for each template (and for localized templates as well). To change subject, in the very beginning of the file (no blank lines allowed in the beginning of the template) add the field Subject:, leave two blank lines after it and add template body.

 

Customized subjects can be taken only from the templates with the resolution *.txt (admin_notify.txt, reseller_notify.txt, user_notify.txt). Changes apply without lvestats restart.

 

For backward compatibility the subject can be also changed with the key NOTIFY_FROM_SUBJECT in the config /etc/sysconfig/lvestats.config/StatsNotifier.cfg

 

Customized subjects have higher priority than the key NOTIFY_FROM_SUBJECT.

 

Example for the file user_notify.txt

 

Subject: Customized subject example

 

 

Dear {{TONAME}},

 

Your {{DOMAIN}} web hosting account exceeded one or more of its resources within the last {{PERIOD}}.

{% if epf %}Exceeded the maximum of {{lep}} concurrent website connections. Your website was not available {{epf}} times because of this problem.

{% endif %}{% if pmemf %}Exceeded the physical memory limit of {{lpmem}}KB. Your website was not available {{pmemf}} times because of this problem.

{% endif %}{% if vmemf %}Exceeded the virtual memory limit of {{lvmem}}KB. Your website was not available {{vmemf}} times because of this problem.

{% endif %}{% if nprocf %}Exceeded the number of processes limit of {{lnproc}}. Your website was not available {{nprocf}} times because of this problem.

{% endif %}{% if cpuf %}You reached limit of {{lcpu}} of total server CPU usage {{cpuf}} times. Your website was forced to load slower to reduce its CPU usage.

{% endif %}{% if iof %}You reached limit of {{lio}}KB/s disk io rate {{iof}} times. The disk io speed for your account was slowed as a result of this problem.

{% endif %}{% if iopsf %}You reached limit of {{liops}} I/O operations {{iopsf}} times. The disk io speed for your account was slowed as a result of this problem.

{% endif %}

 

 

To view full details about your web hosting account's 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.

http://{{DOMAIN}}:2083

 

If your account is regularly exceeding it's 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.

Sincerely,

 

Your Friendly Web Hosting Support Team