1

I want to find load average of system for last one hour.

I could find the command:uptime 07:05:05 up 1151 days, 20:06, 2 users, load average: 0.01, 0.10, 0.29

Where average number of jobs in the run queue over the last 1, 5 and 15 minutes.

I want above load average for last one hour. Could anyone tell the way to do so? After that i will display output using Java

mockinterface
  • 14,452
  • 5
  • 28
  • 49

1 Answers1

2

An easy solution would be to install the sysstat package. I am not sure whether Solaris is supported but the sources can be found at the download page, so you can try and compile it on your target distribution.

$ yum install sysstat

The command you are after is sar -q, it will display the historical queue size and load average for the time-spans you are after. Like this:

05:53:13 AM   runq-sz  plist-sz   ldavg-1   ldavg-5  ldavg-15   blocked
05:53:14 AM         0       200      5.00      4.00      3.00         0
05:53:15 AM         0       200      5.00      4.00      3.00         0
...

Where ldavg-1, ldavg-5, etc are the load averages for preceding 1 and 5 minutes respectively.

You also mentioned that you'd prefer to display the data yourself. In that case you will need to process the binary data stored in the /var/log/sa directory with the sadf tool - it can produce JSON or XML that you can consume in java.

mockinterface
  • 14,452
  • 5
  • 28
  • 49
  • `sar` is provided as part of Solaris already. In Solaris 10 and earlier, it's in the `SUNWaccu` package on the OS install media. In Solaris 11 & later it's available from the IPS package repository in the `system/accounting/legacy-accounting` package. – alanc Jan 30 '14 at 16:18