Email notifications plugin revisited

Want to share your OpenWrt / Gargoyle knowledge? Implemented a new feature? Let us know here.

Moderator: Moderators

rseiler
Posts: 197
Joined: Sun Dec 15, 2013 12:31 am

Re: Email notifications plugin revisited

Post by rseiler »

I was wondering if anyone knows of a hack to only include what's happened today in the system log as opposed to all of it every time.

For busy logs this isn't really an issue since you'll only be getting a portion of today's data anyway, but otherwise the report is highly redundant relative to recent days.

logread itself doesn't support doing this, but maybe passing its output through something clever before it's then output to work.tmp?

dpint
Posts: 32
Joined: Fri Oct 31, 2014 10:48 am

Re: Email notifications plugin revisited

Post by dpint »

rseiler wrote:I was wondering if anyone knows of a hack to only include what's happened today in the system log as opposed to all of it every time.

For busy logs this isn't really an issue since you'll only be getting a portion of today's data anyway, but otherwise the report is highly redundant relative to recent days.

logread itself doesn't support doing this, but maybe passing its output through something clever before it's then output to work.tmp?


You can use following email.sh script to achieve that:

https://paste.fedoraproject.org/482000/21722514/raw/

rseiler
Posts: 197
Joined: Sun Dec 15, 2013 12:31 am

Re: Email notifications plugin revisited

Post by rseiler »

Thanks, that works.

But I noticed a little twist in the new script, due to changes in the Bandwidth section, too.

That report no longer includes today's bandwidth use, just the previous X days. That works out really well if you have the report set for midnight (that happened to be a previous request of mine), but not so well if it's set to go off earlier.

And, of course, being set to midnight would nullify the new log feature.

dpint
Posts: 32
Joined: Fri Oct 31, 2014 10:48 am

Re: Email notifications plugin revisited

Post by dpint »

rseiler wrote:Thanks, that works.

But I noticed a little twist in the new script, due to changes in the Bandwidth section, too.

That report no longer includes today's bandwidth use, just the previous X days. That works out really well if you have the report set for midnight (that happened to be a previous request of mine), but not so well if it's set to go off earlier.

And, of course, being set to midnight would nullify the new log feature.


I think this should fix this issue:
https://paste.fedoraproject.org/485726/79595718/raw/

The main reason for change in bandwidth code is that I noticed that download and upload lines don't always represent identical time intervals... The new code prevents this issue by matching them.

rseiler
Posts: 197
Joined: Sun Dec 15, 2013 12:31 am

Re: Email notifications plugin revisited

Post by rseiler »

Thanks, that works great.

I noticed this month though that the syslog has stopped being included. I think it's because of this change in the log:

Wed Nov 30 21:46:59
Thu Dec 1 01:46:59

Since the day only has one digit now, two spaces are used before it, and I think that throws off this line:

Code: Select all

today=$(date | cut -c 1-10)

Adding this to it makes it work again, but let's see what happens in a week:

Code: Select all

today=$(date | tr -s ' ' | cut -c 1-10)

sefas
Posts: 9
Joined: Mon Jan 27, 2014 9:43 am

Re: Email notifications plugin revisited

Post by sefas »

dpint

gargoyle firmware 1.9.2 email.ipk update please

error code:

Code: Select all

root@Gargoyle:~# opkg install /tmp/email.ipk
ERROR: Dependency ip of package plugin-gargoyle-email-notifications cannot be found, try updating your package lists

cerberii
Posts: 2
Joined: Wed Feb 22, 2017 5:31 pm

Re: Email notifications plugin revisited

Post by cerberii »

Hi,

Could someone tell me how this looks, does it make a page on the web gui? Any Screenshots? Also what are the options? Thx


rseiler
Posts: 197
Joined: Sun Dec 15, 2013 12:31 am

Re: Email notifications plugin revisited

Post by rseiler »

Has anyone thought about a way to not only include daily BW totals but the daily breakdown by hosts? Or maybe you have a separate script that does it?

I've looked at the BW section of this script, as well as bandwidth_distribution.sh (which drives the BW Distribution page, the bottom of which is what I'm thinking about), and...well, I'm just hoping that someone's already done it.

iamlost
Posts: 13
Joined: Mon Mar 20, 2017 5:39 pm
Location: Australia

Re: Email notifications plugin revisited

Post by iamlost »

Hi
Gargoyle 1.8.1 email 1.0.1

I have changed the permissions on "plugin root usr lib gargoyle email_sh" from 644 to 744 and the email now sends. Previously the test email would send but not the schedule email.

After the permissions change the scheduled emails now send to the correct email address

Replace the with / for the directory in the ""
Linksys wrt1200ac - gargoyle 1.12.0

Post Reply