From: | Andy Shellam <andy(dot)shellam-lists(at)mailnetwork(dot)co(dot)uk> |
---|---|
To: | Trula Thomas <trulathomas(at)yahoo(dot)com> |
Cc: | PgAdmin Support Mailing List <pgadmin-support(at)postgresql(dot)org> |
Subject: | Re: [ADMIN] Parse the DF file to table |
Date: | 2007-04-23 17:53:33 |
Message-ID: | 462CF29D.8000804@mailnetwork.co.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)somewhere(dot)com
> fi
> done
>
> Please help if you can.
>
> Thanks ~ Trula
>
> */Andy Shellam <andy(dot)shellam-lists(at)mailnetwork(dot)co(dot)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!
From | Date | Subject | |
---|---|---|---|
Next Message | Andy Shellam | 2007-04-23 17:57:06 | Re: Server not listening |
Previous Message | Dave Page | 2007-04-23 15:01:29 | Re: minor bug in DEFAULT |