Hi there. I have a project in mind, and I don't think it is to difficult a task. The only problem is my php and mysql knowledge is very basic, but I have been teaching my self over the last week or so and think I am getting the idea of what is going on.
What I am wanting to do it to create a web based graph that tracks the disc usage of a particular hard disk (my server raid storage).
So I have a way to get the daily usage of the disc into a text file by using a script that is called by launchd in my case or you could use cron.
#!/bin/sh
DATE_STR=date +%y%m%d-%H%M;
DF_OUT=df | grep ^/dev/disk0s2;
echo $DATE_STR $DF_OUT;
Which then ouputs the data to a text file as a line and then underneath it, it outputs the result of df for that specific drive. This then appends to the txt file every day so I end up with an out put that looks like.
01/19/10
Filesystem Size Used Avail Capacity Mounted on
/dev/disk1s3 3.4Ti 3.1Ti 312Gi 92% /Volumes/RAID4
01/20/10
Filesystem Size Used Avail Capacity Mounted on
/dev/disk1s3 3.4Ti 3.1Ti 344Gi 91% /Volumes/RAID4
01/21/10
Filesystem Size Used Avail Capacity Mounted on
/dev/disk1s3 3.4Ti 3.1Ti 298Gi 92% /Volumes/RAID4
01/22/10
Filesystem Size Used Avail Capacity Mounted on
/dev/disk2s3 3.4Ti 3.1Ti 288Gi 92% /Volumes/RAID2
01/22/10
Filesystem Size Used Avail Capacity Mounted on
/dev/disk2s3 3.4Ti 3.1Ti 286Gi 92% /Volumes/RAID2
01/23/10
Filesystem Size Used Avail Capacity Mounted on
/dev/disk2s3 3.4Ti 3.1Ti 285Gi 92% /Volumes/RAID2
01/24/10
Filesystem Size Used Avail Capacity Mounted on
/dev/disk2s3 3.4Ti 3.1Ti 285Gi 92% /Volumes/RAID2
The information I want from this is the available space "Avail" as it is the most accurate of all the information and the date it was produced. So I need some way to get that information out into a database I guess would be the best place to store it.
The next part I think will be easier which is creating a graph that will read the relevant information from the database.
So this is what I want to do. I should mention I am pulling the information from mac os x so unix/linux. Perhaps something like this already exists, if so please point me there if not any help or suggestions would be very helpful.
Thank you.