A simple example of nagios monitoring scripts for virtual machines via the COLLECTD tool

Source: Internet
Author: User



After installing the COLLECTD tool on the host, you can  such as cpu,memery,if-traffic of the virtual machine on the host by using the COLLECTD tool. Monitoring of these data can be achieved through Nagios monitoring scripts.



The following is a simple monitoring virtual machine memory script:


#!/bin/bash#desc:to check memory about vm instancestate_ok=0state_warning=1state_ Critical=2state_unknown=3collectd_home=/usr/local/collectdcollectd_ctl= $COLLECTD _home/bin/collectdctlvmname=$ 1function usage () {        msg= "$0 : use to  Check vm memery usage for nagios "        echo   "****************************************************"          echo -e  "\033[1;94m${msg}\033[0m"         echo -e  " Usage: "        echo -e "         $0 [-w warning_value -c critical_value] vm_name "         echo -e  "       $0 vmname "          echo  "****************************************************"}if [ $# -eq  0 ];then        usage         exit 1fimem_used= ' $COLLECTD _ctl getval  $vmname/virt-$vmname/memory-rss |  awk -f  "="   ' {print $2} '  | awk  ' {printf ("%.1f\n", $0/1024/1024)} ' Data= ' mem=$ mem_used "if [ -z  $mem _used ];thenecho " unkown: fail to find vm_ instance! " exit  $STATE _unknownelseecho  "OK - USED : ${MEM_USED}MB | ${DATA}MB" exit  $STATE _OKFI





This article from "Month Child" blog, declined reprint!



A simple example of nagios monitoring scripts for virtual machines via the COLLECTD tool


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.