Memory utilization in %(Percentage) in Sun Solaris?

Anavarathan

I would like to get the memory utilization in sun solaris system in % percentage format.

vmstat 1 1 | tail -1 | awk 'a=`/usr/sbin/prtconf|fgrep Memory|awk '{print $3*1024}'{ print 100-($5/$a)*100}'                                      

Getting below error:

awk: syntax error near line 1
awk: bailing out near line 1

Also, please suggest if any alternative possible for this query?

GracefulRestart

Using Solaris awk (which would not have the -v switch or allow setting variables), and using your original query to start with, you can do:

Percentage of free memory:

a=$(/usr/sbin/prtconf | /usr/bin/awk '/Memory/ {print $3*1024}'); vmstat 1 1 | tail -1 | awk "{print (\$5/$a)*100}"

Percentage of used memory:

a=$(/usr/sbin/prtconf | /usr/bin/awk '/Memory/ {print $3*1024}'); vmstat 1 1 | tail -1 | awk "{print 100-(\$5/$a)*100}"

Assign the variable in shell first, then execute the vmstat query using shell variable substitution. This requires using the double quotes in the awk and making sure to escape the awk variable. You also do not need to use fgrep and awk together, awk can do both.

Tested on my Opensolaris I have available, so YMMV.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to get the Percentage of memory utilization using WMIC in batch script?

From Dev

Spring boot memory utilization

From Dev

Git is failing on Sun Solaris 10

From Dev

How to Get Task Manager Network Utilization Percentage

From Dev

crontab -e issue on sun solaris fresh installation

From Dev

Sed command not working in sun solaris machine

From Dev

CPU, memory utilization in Ubuntu 20.04 top pane?

From Dev

CUDA Profiler: Calculate memory and compute utilization

From Dev

TensorFlow: how to log GPU memory (VRAM) utilization?

From Dev

CPU, memory utilization in Ubuntu 20.04 top pane?

From Dev

Solaris 10: Virtual Memory Exhausted

From Dev

Percentage with used memory in Bosun

From Dev

How can I get numbers of CPU of Sun Solaris by command?

From Dev

What is the procedure to check the apache version in a sun solaris machine?

From Dev

How can I create a compressed tar in sun solaris?

From Dev

syntax error near unexpected token `((' in Sun Solaris Unix

From Dev

sed to remove leading comment on crontab with Sun Solaris 10

From Dev

Command to display free memory in percentage

From Dev

Current memory usage of process at runtime on Solaris

From Dev

What is the maximum memory (RAM) limit for Solaris 11?

From Dev

Memory usage and space disk on Solaris 11

From Dev

Is the memory percentage shown in 'top' the actual memory used?

From Java

Where to find the CPU and memory utilization on New Relic for an AWS lambda?

From Java

how to stop an EC2 instance after checking the memory utilization

From Dev

Why memory warnings with 4 MB utilization and 320 MB free?

From Dev

Export SQL Server info about disk, cpu and memory utilization

From Dev

CPU and memory utilization discrepancies for ejabberd and Riak clusters on AWS

From Dev

Export SQL Server info about disk, cpu and memory utilization

From Dev

Cloudwatch Custom Metric - Memory Utilization --from-cron not working

Related Related

  1. 1

    How to get the Percentage of memory utilization using WMIC in batch script?

  2. 2

    Spring boot memory utilization

  3. 3

    Git is failing on Sun Solaris 10

  4. 4

    How to Get Task Manager Network Utilization Percentage

  5. 5

    crontab -e issue on sun solaris fresh installation

  6. 6

    Sed command not working in sun solaris machine

  7. 7

    CPU, memory utilization in Ubuntu 20.04 top pane?

  8. 8

    CUDA Profiler: Calculate memory and compute utilization

  9. 9

    TensorFlow: how to log GPU memory (VRAM) utilization?

  10. 10

    CPU, memory utilization in Ubuntu 20.04 top pane?

  11. 11

    Solaris 10: Virtual Memory Exhausted

  12. 12

    Percentage with used memory in Bosun

  13. 13

    How can I get numbers of CPU of Sun Solaris by command?

  14. 14

    What is the procedure to check the apache version in a sun solaris machine?

  15. 15

    How can I create a compressed tar in sun solaris?

  16. 16

    syntax error near unexpected token `((' in Sun Solaris Unix

  17. 17

    sed to remove leading comment on crontab with Sun Solaris 10

  18. 18

    Command to display free memory in percentage

  19. 19

    Current memory usage of process at runtime on Solaris

  20. 20

    What is the maximum memory (RAM) limit for Solaris 11?

  21. 21

    Memory usage and space disk on Solaris 11

  22. 22

    Is the memory percentage shown in 'top' the actual memory used?

  23. 23

    Where to find the CPU and memory utilization on New Relic for an AWS lambda?

  24. 24

    how to stop an EC2 instance after checking the memory utilization

  25. 25

    Why memory warnings with 4 MB utilization and 320 MB free?

  26. 26

    Export SQL Server info about disk, cpu and memory utilization

  27. 27

    CPU and memory utilization discrepancies for ejabberd and Riak clusters on AWS

  28. 28

    Export SQL Server info about disk, cpu and memory utilization

  29. 29

    Cloudwatch Custom Metric - Memory Utilization --from-cron not working

HotTag

Archive