Time schedule for E-Mail notification

Started by Lostavar, October 02, 2008, 10:15:03 PM

Previous topic - Next topic

Lostavar

Hello,

I have 2 questions regarding e-mail alerting:

1) Is it possible to send alerts using a time-schedule?
For example it want E-Mail notification Monday-Friday to person A, on Saturday and Sunday to person B.

2) How can I add values from different DCIs to one alert?
For example I have a threshold for percentage of disk usage. But in the alert message I want to see a) percentage used, b) absolutely used space (GB) and c) total amount of disk space.

Thanks in advance!!

Victor Kirhenshtein

Hi!

Quote from: Lostavar on October 02, 2008, 10:15:03 PM
1) Is it possible to send alerts using a time-schedule?
For example it want E-Mail notification Monday-Friday to person A, on Saturday and Sunday to person B.

Yes, you can create two rules with different e-mail actions, and use filtering script in each rule to match Monday-Friday or Saturday-Sunday. Script to match Monday-Friday will look like following:


sub main()
{
t = localtime();
return (t->wday >= 1) && (t->wday <= 5);
}


Best regards,
Victor

Victor Kirhenshtein

Quote from: Lostavar on October 02, 2008, 10:15:03 PM
2) How can I add values from different DCIs to one alert?
For example I have a threshold for percentage of disk usage. But in the alert message I want to see a) percentage used, b) absolutely used space (GB) and c) total amount of disk space.

There are no easy way to achieve that - only via scripting. In message text, you can use %[..] macro, which will be substituted by value returned by given script. To use script in such macro, you should create it in script library (Control Panel -> Script Library).
In the script, you can use FindDCIByName or FindDCIByDescription and GetDCIData functions to retrieve data of some other DCIs.

For example, script wchich will return total amount of disk space on root partition will look like this (assuming thet you have configured appropriate DCI):


GetDCIValue($node, FindDCIByName($node, "Disk.Total(/)"))


Best regards,
Victor

Victor Kirhenshtein

Quote from: Victor Kirhenshtein on October 02, 2008, 11:21:24 PM
Hi!

Quote from: Lostavar on October 02, 2008, 10:15:03 PM
1) Is it possible to send alerts using a time-schedule?
For example it want E-Mail notification Monday-Friday to person A, on Saturday and Sunday to person B.

Yes, you can create two rules with different e-mail actions, and use filtering script in each rule to match Monday-Friday or Saturday-Sunday. Script to match Monday-Friday will look like following:


sub main()
{
t = localtime();
return (t->wday >= 1) && (t->wday <= 5);
}


Best regards,
Victor


Just discovered that due to a bug attribute wday is not accessible. To fix it, replace file src/libnxsl/functions.cpp with attached one and recompile NetXMS server. If your server running on Windows, ask me and I'll post recompiled libnxsl.dll.

Best regards,
Victor

Lostavar

Hello Victor,

thanks for your quick response.
Regarding question/answer 2: Yes, my server is running on Windows. Please post libnxsl.dll.

Many thanks!!

Victor Kirhenshtein

Updated libnxsl.dll.

Best regards,
Victor