Re: Parsing SAR output with PHP.
| From: | Martin Wickman | Date: | Fri, 11 Jan 2002 09:08:58 +0000 |
| Subject: | Re: Parsing SAR output with PHP. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-80176@lists.php.net to get a copy of this message | ||
Austin Gonyou wrote:
The real question I suppose is how could I parse this type of output into something I could use to make a graph. Example:12:20:00 PM CPU %user %nice %system %idle 12:30:00 PM all 2.17 0.79 0.77 96.27
Problem is I'm not sure how to go about breaking up the rows to allow them to be inserted into the db. Thanks in advance for any ideas.I guess fields are separated with tabs? Then just use split, as in: list($time,$cpu,$ser,$nice,$ststem, $idle)= split ("\t", $line); Then build your INSERT sql clause. Graph building is then a simple matter of passing the data as arrays to your php graph system.