i'm trying to find a way to monitor the CPU/Memory status of a solaris station using vmstat. I like to write a small script to periodically run vmstat and store the output. Can anyone show me how (preferrably in C++ if possible)? Thanks in advance.
Why C++ to do something that a shell script seems better suited to ?
No reason really, i'm just not familiar with shell script. Shell script is also find if you already have one that i can use?
I have no script available but that would be trivial to write a oneliner called from the crontab to achieve that.
and that's why i was saying i'm not familiar at all with shell script. It is not trivial to me.
It would help if you describe better your requirements.
"Periodically run vmstat"
EDITOR=vi crontab -e
...
<when> <what>
with "when" being something depending on the sampling interval you are looking for and "what" being:
"run vmstat and store the output":
vmstat options > outputfile.timestamp
There are many free and commercial tools that would do a better job to collect and display that data though.
I'm looking at crontab now to see how it works. Thanks a lot for pointing that out.