I need to monitor average CPU and memory usage for a Solaris server. How can I automate the process using scripts to monitor daily CPU and memory usage and give it as an average over a month?
You can use sar for the same.
Here is Cool Solutions which I found , this is a Collection of tools and scripts to monitor and record various resources (CPU, Memory, Processes, Disk and Network) over time on Linux. View graphs in HTML
munin is a comprehensive and flexible system for monitoring and graphing all kinds of details about a unix system, including CPU utilisation, memory usage, swap space, disk utilisation, network bandwidth and much more. It can monitor one system or many. It can produce HTML reports with clickable links to detailed graphs over time.
All the data is recorded in rrdtool format, which is pretty much the de-facto standard for system monitoring data.
There are many pre-written modules to cover all the basics, plus extras like monitoring particular applications (mail sent/received, squid proxy, nfs server or client details, web server usage, etc etc etc)
There is also a well-documented "API" for writing your own scripts in the language of your choice - many of the included and contrib monitors are written in bash, perl, and/or python.
Finally, there is a huge, searchable archive of scripts that other people have written.