Script to check the memory usage in AIX

Hello Everyone,

I'm looking for a efficient script that monitors the memory usage on AIX and send email alerts when it reaches certain point.

Q) need to get alerts, when the memory usage exceed 90% on AIX?

or

Q) Need to get alerts when available free Memory is 1G or 10% etc

Any idea is highly appreciated...and helpful to me

Thanks,
Mahijeet

A full-featured monitoring tool would be the best approach, IMO.

A local monitoring script would be useless if the server reaches 100% memory usage and it's unable to monitor itself.

Take a look at the options offered by svmon . Maybe they're good enough for your particular needs.

1 Like

If you search this board for "memory" and "monitor(ing)" you will find dozens of threads with always th same outcome: it is impossible in a strict sense to do what you want. So, for the umpteenth time here, the reasons in short:

In AIX memory is managed by the kernel. Basically the memory not used for running programs is given to the filecache to speed disk I/O. If another program would start the used memory would not change, but this file cache would be diminished by the amount necessary for the program. On the other hand stopping a running program would not enlarge available memory because the kernel would give the regained memory to the file cache as soon as it becomes freed.

This process is being controlled by some kernel tuning parameters, i.e. "maxperm", "minperm", "maxclient", etc.. Have a look at the man page of "vmo" to get the details.

A common, reasonable tuning (taken from Jaqui Lynchs paper on tuning AIX 5.3) would be:

vmo -p -o minperm%=5
vmo -p -o minfree=960
vmo -p -o maxfree=1088
vmo -p -o lru_file_repage=0
vmo -p -o lru_poll_interval=10

which would in turn mean you never see numbers below 95% (100%-minperm%) memory used on todays majority of real-world systems.

There will surely come people to this thread and suggest this or that monitoring tool (mostly it will be "nmon"), but it won't matter which tool you use to get a meaningless number from the system - the number will be meaningless anyway, because: see above.

What you can do (and i suggest you do this, because this is proactive maintenance of a system) is: monitor the ratio of installed memory and the amount necessary for programs. There is the command

svmon -G

which will tell you that. It has been described oftenly here, for instance:this thread or this thread.

This will not "raise an alert", because these measurements are statistical in nature. You will have to maintain long-term statistics about (increasing) memory usage but this will make excellent base data over time to assess how the memory consumption of the system develops and which upgrades might be necessary when.

It is not very popular these times, but for the occasional(!) extraordinary memory need it makes sense to configure swap space: swapping is to be avoided like the plague if it happens regularly, but once in a time there is no problem with it. It will slow down the system, so you will have to decide how much swapping is allowable (for real-time systems the answer might be "0", while for other systems it might be considerably higher). Monitor with a "vmstat" to learn about what your system does over time. What you can learn from its output is discussed here and here.

I hope this helps.

bakunin

1 Like

Thanks much bakunin & verdepollo. Appreciate your input. sorry for the late reply.