[Linux]Having a daily report of servers by mail

Last update on October 29, 2008 06:26 AM by jak58
Published by jak58

[Linux]Having a daily report of servers by mail






The monitoring and administration of Linux systems is a very difficult task when there is large number of interconnected servers, system resources and updates to each of them it,must continually monitored.

The following script creates a daily report intended to be sent by mail to the administrator.

Report content: Hard disk status and updates necessary (for Debian based system).
For other systems you must adapt to the existing systems management packages.

#!/bin/bash
apt-get update
( 
        echo To: receiver@domain.ext
        echo From: system@domain.net
 if [ "$( df -h | grep hda1 | cut -c40-42)" -ge "80" ]; then echo Subject: Reporting of `date +%e\ %B\ %Y` : LOW DISK SPACE
 else echo Subject: Daily reporting of `date +%e\ %B\ %Y` for `hostname`
 fi
        echo Reporting of `hostname`
        echo Disk used :
        echo 
        df -h
        echo
        echo Server charge :
        echo
        uptime
        echo
        echo Necessary updates
        echo
        apt-get -s upgrade
) | /var/qmail/bin/qmail-inject -fsenderr@domaine.ext receiver@domaine.ext

The above script will display a warning in the message if the hda1 disc has a filling rate greater than 80%. The messaging system used for sending in the example is qmail, but any other similar command (eg / usr / sbin / sendmail) can be used.

To make the script executable:

chmod +x /home/user/script/dailyreport.sh


Finally, creating an entry in the crontab will send daily by mail message (e.g. below 5:00 am):

crontab –e


Insert the following command line:

00 5 * * * /home/user/script/dailyreport.sh > /dev/null 2>&1
Best answers for « Having a daily report of servers by mail » in :
Server Response: Error 554 -Relay Access denied Show Server Response: Error 554 -Relay Access denied Issue Solution Issue Below error message appears on your screen before your connection: Error 554 - Access Denied Relay Solution This may be due to the use of outgoing server...
The purpose of having a server for your company Show The purpose of having a server for your company The purpose of having a server in your company? The functionality of an enterprise server Mail server File Server Dynamic web server Security Telephony/fax/printing server You...
Google Mail - Send and receive emails with Gmail ShowGoogle Mail - Send and receive emails with Gmail Send and Receive mails Everyone who subscribes to an Internet service provider can create one or more email addresses. At first glance, it is not necessary to use an external service...
Gmail (Google mail) ShowGmail (Google mail) Gmail, the official mailbox for Google, is the acronym for Google Mail. Gmail is a free web mail services enabling its users to send and receive messages in its tailored approach. Gmail has been design to provide an...
Free alternatives for Microsoft Outlook ShowFree alternatives for Microsoft Outlook Outlook is a mail client allowing you to your read and send email by connecting to the server on which your account exists. This is done either by accessing your account via POP (Post Office...
Download Scribes Report Builder ShowScribes Report Builder is a report generator for databases Firebird, Interbase, PostGre-Sql, Sybase, SqlLite, Mysql, Oracle, Microsoft Access, Microsoft SQL Server, Excel databases, text files or the ODBC connections. Its main features are: -...
Download Exchange Server Toolbox ShowExchange Server Toolbox is an application that generates all your emails that come via STMP service of the Exchange Server. Advantage It backup all your outgoing and incoming emails automatically. It process similarly to MS Outlook. Exchange...
Club-Internet - Internet service providers ShowIncoming mail server POP Server: pop3.club-internet.fr IMAP Server: imap.club-internet.fr Outgoing mail server SMTP Server: mail.club-internet.fr Domain name servers Primary DNS: 194.117.200.10 Secondary DNS: 194.117.200.15
NOOS - Internet service providers ShowIncoming mail server POP server: pop.noos.fr IMAP server: imap.noos.fr Outgoing mail server SMTP server: mail.noos.fr Domain name servers Primary DNS: 212.198.0.91 Secondary DNS: 212.198.2.5
Intranet - Installing a mail server ShowIntroduction to installation The most commonly used e-mail server in Linux is Sendmail; however, as it is very hard to configure, we will use Qmail, an alternative e-mail server, instead. Qmail is made up of a group of programs that work with...