If you want an example, I used this to get the max RAM used in the last year 
from all Virtual machines, take the max spike, and find the new value to be 70% 
of that.  We recovered a few hundred GB of overallocated RAM this way and were 
able to place a few GB to machines that were a little low.  Replace "sitename" 
with your site.


#!/bin/bash
ramtotal=0
for host in $( echo -e "GET hosts\nFilter: host_groups >= linux\nColumns: 
host_name host_address state host_groups\n" | /usr/bin/nc localhost 6557 | cut 
-d ';' -f1-4); do
        name=`echo $host | cut -d ';' -f1`
        ip=`echo $host | cut -d ';' -f2`
        state=`echo $host | cut -d ';' -f3`
        tags=`echo $host | cut -d ';' -f4`
        #/var/pnp4nagios/perfdata/$hostname/Memory_used_memused.rrd
        if [ -e 
/omd/sites/sitename/var/pnp4nagios/perfdata/$name/Memory_used_memused.rrd ]; 
then
                maxram=$(for mem in $(rrdtool fetch 
/omd/sites/sitename/var/pnp4nagios/perfdata/$name/Memory_used_memused.rrd MAX 
-s -31536000 | grep -v '\-nan' | awk '{ print $2 }'); do echo $mem; done | sort 
-gr | head -n1)
                installedram=$(echo -e "GET services\nFilter: host_name = 
$name\nFilter: description = Memory used\nColumns: perf_data\n" | /usr/bin/nc 
localhost 6557 | cut -d ';' -f5 | awk '{ print $1 }')
                maxram=`echo $maxram | awk '{printf "%.2f",$1}'`
                recram=$(echo $maxram/.7 | bc -l)
                ramchange=$(echo $recram-$installedram | bc -l)
                ramtotal=$(echo $ramtotal+$ramchange | bc -l)
                echo -e "$name\tRamChange: $ramchange\tRunning total: $ramtotal"
        fi
done

-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Smith, Cathy
Sent: Sunday, April 19, 2015 3:47 PM
To: [email protected]
Subject: [omd-users] how to output data from check_mk

Is there a way to output the performance data from OMD check_mk via a script?  
I've been asked to look into integrating the data captured by check_mk into 
another reporting system.

Thank you for your assistance.


Cathy

---
Cathy L. Smith
IT Engineer, CISSP

Pacific Northwest National Laboratory
Operated by Battelle for the
U.S. Department of Energy

Phone:      509.375.2687
Fax:        509.375.2330
Email:      [email protected]


_______________________________________________
omd-users mailing list
[email protected]
http://lists.mathias-kettner.de/mailman/listinfo/omd-users


---------------------------------------------------------------------------
The information transmitted in this e-mail and in any replies and forwards are 
for the sole use of the above individual(s) or entities and may contain 
proprietary, privileged and/or highly confidential information. Any 
unauthorized dissemination, review, distribution or copying of these 
communications is strictly prohibited. If this e-mail has been transmitted to 
you in error, please notify and return the original message to the sender 
immediately at the above listed address. Thank you for your cooperation.

_______________________________________________
omd-users mailing list
[email protected]
http://lists.mathias-kettner.de/mailman/listinfo/omd-users

Reply via email to