Re: [ADMIN] Parse the DF file to table - Mailing list pgadmin-support

From Andy Shellam
Subject Re: [ADMIN] Parse the DF file to table
Date
Msg-id 462CF29D.8000804@mailnetwork.co.uk
Whole thread Raw
List pgadmin-support
Firstly, I think this is a little in-depth for a mailing list, and 
reading the manual will certainly help you out :)

Secondly, what exactly are you trying to do?  As all I can see your 
script doing is reading the amount of disk space used on each device, 
and if it's greater than 90% used, e-mail an alert.

What out of this are you trying to capture into your database?  And how 
can you summarise it by day, week, month?

Andy.

Trula Thomas wrote:
> Hi Andy, if you could help me with this task I would really appreciate.
>
> Task:
> 1) Create table in psql
> 2) Write shell cript to get the disk space
>   a) Run DF into file
>   b) Parse the DF file to table
> 3) Create the report bae on SQL that allows summary by day, week or month.
>
> I have the shell cript :
> #!/bin/sh
> df -H | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 }' 
> | while read output;
> do
>   echo $output
>   usep=$(echo $output | awk '{ print $1}' | cut -d'%' -f1  )
>   partition=$(echo $output | awk '{ print $2 }' )
>   if [ $usep -ge 90 ]; then
>     echo "Running out of space \"$partition ($usep%)\" on $(hostname) 
> as on $(date)" |
>      mail -s "Alert: Almost out of disk space $usep%" you@somewhere.com
>   fi
> done
>
> Please help if you can.
>
> Thanks ~ Trula
>
> */Andy Shellam <andy.shellam-lists@mailnetwork.co.uk>/* wrote:
>
>     I think you need to provide more information on what you're trying to
>     do, and the version of PostgreSQL you're using, which environment etc.
>
>     If you're talking about reading a comma-delimited or tab-delimited
>     text
>     file, then see the COPY FROM command.
>     http://www.postgresql.org/docs/8.2/static/sql-copy.html
>
>     Andy.
>
>     Trula Thomas wrote:
>     > Hello, please show me how to parse the disk file to table.
>     > Thank you in advance.
>     > Trula
>     >
>     >
>     ------------------------------------------------------------------------
>     > Ahhh...imagining that irresistible "new car" smell?
>     > Check out new cars at Yahoo! Autos.
>     >
>     >
>
>
> ------------------------------------------------------------------------
> Ahhh...imagining that irresistible "new car" smell?
> Check out new cars at Yahoo! Autos. 
>
<http://us.rd.yahoo.com/evt=48245/*http://autos.yahoo.com/new_cars.html;_ylc=X3oDMTE1YW1jcXJ2BF9TAzk3MTA3MDc2BHNlYwNtYWlsdGFncwRzbGsDbmV3LWNhcnM->

> !DSPAM:37,462bf80789291630450605! 



pgadmin-support by date:

Previous
From: Dave Page
Date:
Subject: Re: minor bug in DEFAULT
Next
From: Andy Shellam
Date:
Subject: Re: Server not listening