Integrating bash with sql.
Hi Guys,
I m just curious to know whether it is possible to store the output of a shell command to a database . My main aim is to use a full capacity of sql language to analyze the output generated by shell script. for example. by storing the 5 instances of of top at different interval we can simply predict lot of things like. Which process has Maximum cpu utilization, Which user has maximum processes running. I think writing a scripts for doing these tasks will require lot of overheads and file creation. I hope i have clear my point .Please reply if any further clarification is required. |
Sure it's possible, you might want to look at something lightweight like sqlite which basically pretends to be a full sql database but is actually just a small file, which makes using it really simple. You can just pipe SQL commands into the sqlite program directly. e.g. "echo select * from mytable | sqlite mydb.sql". This is also pretty trivial with other proper DB's like mysql or postgresql.
Alternatively why not use a proper program to do this? It's not GPL software, but Splunk is an amazingly good tool for doing exactly what you want, running arbitrary commands and reading any log data and then hacking about the output to provide all osrts of graphs and data baout the logs. |
Quote:
|
All times are GMT -5. The time now is 07:28 AM. |