Posts Tagged ‘Monitor’

Custom RHEL Memory Monitor – Part II

In the last post I described how to create a custom memory monitor using a Script Monitor.  The Script Monitor, while functional, may not be desirable as the "Value" returned does not fit into default Threshold/Alert configurations.  Which basically means the monitor can run, but cannot be Alerted upon.

Instead, by editing RedHatEnterpriseLinux.config, located on the SiS host (E:\SiteScope\templates.os dir), we can define the command being executed to determine the REAL "Physical memory used %" for RHEL systems.

Solution:

  • Open the RedHatEnterpriseLinux.config file, locate the following:

#
id=physicalMemory
command=/usr/bin/free -b
total=2
free=4
matchLine=Mem:
#

  • Replace that with the following:

#
id=physicalMemory
command=echo `free | grep - | awk '{ print $4 }'`" "`free | grep Mem
|awk '{ print $2 }'`
total=2
free=1
#

  • Restart SiteScope Server

This monitor will now show the correct Physical memory used % for RHEL systems.

Custom SiteScope Memory Monitor – Part 1

In certain environments, a custom memory monitor may be required to monitor Unix based hosts.  Why? A Unix System Admin might describe it as follows:

Unix/Linux will fill any free memory with disk buffers and caching, but that should not be counted as “used” memory, because if an application needs it, the kernel will give it up. The proper way to calculate memory usage is to pull the total used and subtract whatever amount of cache and buffers are being used.

echo 'free | grep - | awk '{ print $4 }''/'free | grep Mem |awk '{print $2 }'' *100 | bc -l

On the SiteScope host, create a 'CustomMemoryMonitor.sh' file in /SiteScope_Root/remote.script/ directory. This can be done using Notepad.

Insert the script above into your .sh file and save it.

In the SiteScope interface, create a Script Monitor directed at your Unix host with the following settings:

  • Script: USE COMMAND
  • Match expressions: /[0-9]{2}.[0-9]{2}/
  • Remote script Command File: (select your .sh file from dropdown)

From here you can adjust the Thresholds to Alert on the Status of the monitor (which is a 0-100 percentage of the actual Free Memory available).

Enjoy!

See Also: Custom Memory Monitor Part 2

Return top