Tag: nrpe agent

  • การติดตั้ง NRPE บน Ubuntu 14.04

    เพื่อไม่ให้เสียเวลามาเริ่มกันเลยครับ

    วิธีการติดตั้ง Nrpe บน Ubuntu 14.04

    1) ทำการติดตั้งโปรแกรม nrpe (มองว่าเป็น server ให้ nagios มาเรียกเพื่อดึงค่า) ดังนี้

    sudo apt-get install -y nagios-nrpe-server

    2) ทำการแก้ config /etc/nagios/nrpe.cfg เพื่อใส่ชื่อเครื่องที่อนุญาตให้มาดึงค่าได้ ดังนี้

    sudo nano /etc/nagios/nrpe.cfg
    ...
    
    #
    # NOTE: This option is ignored if NRPE is running under either inetd or xinetd
    
    allowed_hosts=127.0.0.1,monitor

    3) จากนั้นทำการ Restart nrpe ดังนี้

    sudo /etc/init.d/nagios-nrpe-server restart

    4) ให้กลับไปดูใน web nagios จะพบว่ามีการแสดงข้อมูลในส่วนของ nrpe (ในกรณีที่สร้าง service nrpe เรียบร้อยแล้ว)

    ยกตัวอย่างวิธีการเพิ่ม Plugin ให้กับ nrpe บน Ubuntu 14.04

    plugin ที่ให้มายังไม่มีในส่วนของการ monitor memory โดยให้สร้างใน path /usr/lib/nagios/plugins/ และทำการสร้าง command เพิ่มเติมในไฟล์ /etc/nagios/nrpe.cfg ประมาณนี้

    cd /usr/lib/nagios/plugins
    sudo wget http://ftp.psu.ac.th/pub/psu-monitor/check_mem.sh
    sudo chmod ugo+x check_mem.sh
    sudo nano /etc/nagios/nrpe.cfg
    ...
    
    command[check_zombie_procs]=/usr/lib/nagios/plugins/check_procs -w 5 -c 10 -s Z
    command[check_total_procs]=/usr/lib/nagios/plugins/check_procs -w 150 -c 200 
    command[check_mem]=/usr/lib/nagios/plugins/check_mem.sh 85 95