Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
Check RAM usage as a percentage
1.0
2013-02-22
- Nagios 2.x
- Nagios 3.x
- Nagios XI
MIT
47539
File | Description |
---|---|
check_ram_usage.php | add this file to your plugins directory and write a command for it. |
Queries via snmp and returns the memory usage as a percentage.
usage syntax:
# php check_ram_usage.php hostname port community warning critical
example:
# php check_ram_usage.php 10.123.2.13 161 readcom 85 95
where:
hostname: valid address to your machine
port: snmp port
community: snmp read community
warning: warning level (expressed as % without the % symbol)
critical: critical level (expressed as % without the % symbol)
usage syntax:
# php check_ram_usage.php hostname port community warning critical
example:
# php check_ram_usage.php 10.123.2.13 161 readcom 85 95
where:
hostname: valid address to your machine
port: snmp port
community: snmp read community
warning: warning level (expressed as % without the % symbol)
critical: critical level (expressed as % without the % symbol)
Reviews (1)
bychrisman, January 20, 2015
Hi maybe I'm wrong but your script returns not the RAM used it returns the RAM free.
Your script queries two values:
$total_ram with OID .1.3.6.1.4.1.2021.4.5.0
$total_ram_free with OID .1.3.6.1.4.1.2021.4.6.0
but OID .1.3.6.1.4.1.2021.4.6.0 is not the used RAM on my linux boxes it's the memAvailReal.0
I changed your script a bit and turned "$total_ram_used" to "$total_ram_free" and added a line before "$percentage_ram_used":
$total_ram_used = $total_ram - $total_ram_free;
cheers chris
Your script queries two values:
$total_ram with OID .1.3.6.1.4.1.2021.4.5.0
$total_ram_free with OID .1.3.6.1.4.1.2021.4.6.0
but OID .1.3.6.1.4.1.2021.4.6.0 is not the used RAM on my linux boxes it's the memAvailReal.0
I changed your script a bit and turned "$total_ram_used" to "$total_ram_free" and added a line before "$percentage_ram_used":
$total_ram_used = $total_ram - $total_ram_free;
cheers chris