Template not expanding variables

Post Reply
Michael-Inet
Junior Member
Posts: 2
Joined: 11 Mar 2014, 16:35
Location: Austin
Contact:

Template not expanding variables

Post by Michael-Inet »

Hi All,

I modified the email template usertracking.txt to include load averages. A simple cut and paste from the appropriate section of loadalert.txt. The variables aren't replaced?

I get as an email:

Code: Select all

lfd on {snip}: Excessive processes running under user {snip}
 From: root@{snip}
 To: root@{snip}
 
Time:          Tue Mar 11 10:41:29 2014 -0500
Account:       {snip}
Process Count: 32 (Not killed)

Load:
1 Min Load Avg:          [loadavg1]
5 Min Load Avg:          [loadavg5]
15 Min Load Avg:         [loadavg15]
Running/Total Processes: [totprocs]

Process Information:
{snip}
Any reason the load average replacements don't work?

Thanks,
Michael

Reference:

Modified, /usr/local/csf/tpl/usertracking.txt - for user process tracking alert emails

Code: Select all

root@server1 [/usr/local/csf/tpl]# cat usertracking.txt
From: root
To: root
Subject: lfd on [hostname]: Excessive processes running under user [user]

Time:          [time]
Account:       [user]
Process Count: [count]

Load:
1 Min Load Avg:          [loadavg1]
5 Min Load Avg:          [loadavg5]
15 Min Load Avg:         [loadavg15]
Running/Total Processes: [totprocs]

Process Information:

[text]

Original, /usr/local/csf/tpl/loadalert.txt - for high load average alert emails

Code: Select all

root@server1 [/usr/local/csf/tpl]# cat loadalert.txt
From: root
To: root
Subject: lfd on [hostname]: High [loadavg] minute load average alert - [reportload]
MIME-Version: 1.0
Content-Type: multipart/mixed;
 boundary="------------[boundary]"

This is a multi-part message in MIME format.
--------------[boundary]
Content-Type: text/plain;
Content-Transfer-Encoding: 7bit

Time:                    [time]
1 Min Load Avg:          [loadavg1]
5 Min Load Avg:          [loadavg5]
15 Min Load Avg:         [loadavg15]
Running/Total Processes: [totprocs]

--------------[boundary]
Content-Type: text/plain;
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="ps.txt"

Output from ps:
[processlist]

--------------[boundary]
Content-Type: text/plain;
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="vmstat.txt"

Output from vmstat:
[vmstat]

--------------[boundary]
Content-Type: text/html;
 name="apachestatus.html"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="apachestatus.html"

[apache]

--------------[boundary]--
ForumAdmin
Moderator
Posts: 1524
Joined: 01 Oct 2008, 09:24

Re: Template not expanding variables

Post by ForumAdmin »

Only the variables listed in the specific default template are available for that template. You cannot mix variables from other templates.
Michael-Inet
Junior Member
Posts: 2
Joined: 11 Mar 2014, 16:35
Location: Austin
Contact:

Re: Template not expanding variables

Post by Michael-Inet »

Well, that's not fun. Feature request? e.g. access to all variables from any template?

Or is there a way to add Bash commands? Being able to add a simple 'uptime' would accomplish the same goal of determining if the number of processes running at the trigger point are actually excessive.

Best,
Michael
AdamPD
Junior Member
Posts: 2
Joined: 29 Oct 2014, 17:55

Re: Template not expanding variables

Post by AdamPD »

Is there no way to add additional variables to other templates?
I Was looking into changing the account modification template today, so I could see which IP changed the account passwords.
Would be handy to be able to add a generic set of variables to templates like ip/time etc.
Post Reply