Easy way to have each Pi send me a daily system status report?

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
G'day.

I wonder what is the easiest way from the command line (as I run some of
my Pi's without a GUI) to have a Pi send me a daily system status
report?

I don't need anything detailed. Just the equivalent of a snapshot of
'top -o %CPU' emailed/tweeted/or in some way communicated to me, so I'll
notice it from my desktop or mobile devices.

I know how to use cron. I'm just not sure how to generate and send the
report without a lot of hassle and configuration, like setting up an
email sever. My Unix command line-fu is very weak after a couple decades
on GUI OSes.

Any and all wisdom bestowed upon me is appreciated :-)

Regards,
 Jamie Kahn Genet

--  
If you're not part of the solution, you're part of the precipitate.

Re: Easy way to have each Pi send me a daily system status report?
On Wed, 14 Dec 2016 06:43:02 +1300, Jamie Kahn Genet wrote:

Quoted text here. Click to load it
One way is to write the report to stdout and let crontab send it to you:
crond defaults to sending anything written to stdout or stderr to the  
user the cron job is running under, but by setting the MAILTO variable in  
the controlling crontab you can override that and send the report to any  
valid user on the RPi.

See "man 5 crontab" and look at the MAILTO  variable.

I think that crond is limited to sending the script output to users on  
the local system, so if you'd prefer to mail the report to some other  
system, just install one of the command line mail clients, e.g. mailx,  
and call it within the cron job script to mail the report file to  
wherever it should go.  

There is a choice of Raspbian packages: mailx is included in the  
mailutils, heirloom-mailx and bsd-mailx packages, so either of the  
commands

   sudo apt-get install heirloom-mailx
or  
   sudo apt-get install bsd-mailx

should do the trick. mailx can be configured to send mail through any  
mail server via an SMTP connection.


--  
martin@   | Martin Gregorie
gregorie. | Essex, UK
We've slightly trimmed the long signature. Click to see the full one.
Re: Easy way to have each Pi send me a daily system status report?
On Wed, 14 Dec 2016 06:43:02 +1300
snipped-for-privacy@wizardling.geek.nz (Jamie Kahn Genet) wrote:

Quoted text here. Click to load it

See section 8 here:
www.binarytides.com/linux-mailx-command/


Easy way to have each Pi send me a daily system status report?

14 Dec 16 06:43, you wrote to all:
 JG> I wonder what is the easiest way from the command line (as I run some
 JG> of my Pi's without a GUI) to have a Pi send me a daily system
 JG> status report?

I would suggest ssmtp over the mailx and a full blown MTA like exim etc.

 $ sudo apt-cache search ssmtp
extsmail - enables the robust sending of e-mail to external commands

sudo apt-get install ssmtp

Can support SSL mail servers too if needed..

I use it in place of exim and a full MTA setup to send alerts from my BASH  
scripts on various boxes.

Rick


... Ding Dong the Witch is DEAD! I Made America Great Again! President Trump!

Re: Easy way to have each Pi send me a daily system status report?

Quoted text here. Click to load it

So how many ex-Goldman Saches employees has Trump hired for his
adminstration, now? :-)

--  
If you're not part of the solution, you're part of the precipitate.

Re: Easy way to have each Pi send me a daily system status report?
On 16/12/16 16:31, Jamie Kahn Genet wrote:
Quoted text here. Click to load it

I have no idea. Do tell.


Re: Easy way to have each Pi send me a daily system status report?

Quoted text here. Click to load it

So it's not that you actually care about Trump. It was just a blind
hatred of Clinton?

Or is it both blind adoration of Trump and blind hatred of Clinton? Was
there any intellectual involvement at all?

--  
If you're not part of the solution, you're part of the precipitate.

Re: Easy way to have each Pi send me a daily system status report?
On Sat, 17 Dec 2016 09:59:26 +1300
snipped-for-privacy@wizardling.geek.nz (Jamie Kahn Genet) wrote:

Quoted text here. Click to load it

    US politics, intellectual involvement - I'm experiencing cognitive
dissonance.

--  
Steve O'Hara-Smith                          |   Directable Mirror Arrays
C:>WIN                                      | A better way to focus the sun
We've slightly trimmed the long signature. Click to see the full one.
Re: Easy way to have each Pi send me a daily system status report?

Quoted text here. Click to load it

That's certainly been hammered home this year.
--  
If you're not part of the solution, you're part of the precipitate.

Re: Easy way to have each Pi send me a daily system status report?
On Fri, 16 Dec 2016 20:59:26 -0000, Jamie Kahn Genet  

Quoted text here. Click to load it
Please; it's not pi related.

--  
Bah, and indeed, Humbug

Re: Easy way to have each Pi send me a daily system status report?

Quoted text here. Click to load it

I agree. So it probably shouldn't be introduced to a thread that has
nothing to do with politics, within a group that has nothing to do with
politics, inside the body of one's post :-)

But if it is, then I say it's fair game for a deservedly mocking reply.

--  
If you're not part of the solution, you're part of the precipitate.

Re: Easy way to have each Pi send me a daily system status report?
On 13/12/2016 17:43, Jamie Kahn Genet wrote:
Quoted text here. Click to load it
You can generate a snapshot with a cron job such as
# /usr/bin/top -b -n1 -o %CPU

You can use ssmtp or msmtp to relay cron job output via gmail.
http://msmtp.sourceforge.net/
https://www.cyberciti.biz/tips/linux-use-gmail-as-a-smarthost.html

I use postfix (set as a localhost) and popa3d so I can get mail directly  
from the Pi.


--  

Chris Elvidge, England

Site Timeline