延續[Day19 - Splunk] Nagios and Splunk integration - 2/4,本文分享Splunk透過「Splunk for Nagios」App與Nagios進行整合之實作經驗
[Lab Information]
主機硬體規格如下:
OS: Rat Hat Enterprise Linux 6.2 64 bit
Linux Kernel: 2.6.32
CPU Type: Intel Xeon CPU E5-2620 2.00GHz
CPU Core: 8
Memory: 16GB
此實作範例已事先安裝Nagios及Splunk forwarder於同一台主機上,主機資訊如下:
Universal Forwarder version: 5.0.4
OS root password: 12345678
IP: 192.168.0.102
Splunk Forwarder admin password: changeme
Package directory: /root/plugin
Splunk Forwarder directory: /opt/splunkforwarder
Nagios directory: /usr/local/nagios
Splunk Server主機資訊如下:
Splunk version: 5.0.4
OS root password: 12345678
IP: 192.168.0.101
Splunk Web admin password: changeme
Package directory: /root/plugin
Splunk Web directory: /opt/splunk
[Download Splunk for Nagios App]
請先至splunk>apps下載「Splunk for Nagios」App,點此進下載頁面
點選右上角『Download』,將出現「License Agreements」的彈跳視窗,勾選『I agree』並按下『Download』即可開始下載
[Install App on Splunk Web]
安裝「Splunk for Nagios」App步驟可參閱如下:
[Create Index on Splunk Web]
接下來將於Splunk Indexer建立Index,可參閱下列步驟:
[Enable Receiving input on the Index Server]
此部分可參閱[Day17 - Splunk] Install Forwarder on RHEL platform進行設定
[Configure Forwarder connection on the Forwarder Server]
使用帳號:root登入Splunk Forwarder,並使用su command切換至使用者:splunk
su - splunk
執行下列步驟:
'# 以下皆為使用者:splunk進行操作 #'
#IP: 192.168.0.102為Splunk Forwarder IP,請自行更換
splunk add monitor /usr/local/nagios/var/nagios.log -sourcetype nagios -hostname 192.168.0.102
splunk add monitor /usr/local/nagios/var/host-perfdata -sourcetype nagioshostperf -hostname 192.168.0.102
splunk add monitor /usr/local/nagios/var/service-perfdata -sourcetype nagiosserviceperf -hostname 192.168.0.102
編輯檔案:/opt/splunkforwarder/etc/apps/search/local/inputs.conf,於每個區塊加入『index = nagios』,如下圖示:
重新啓動Splunk即可
splunk restart
下一篇文章將延續此議題,分享在Splunk Server觀看被監控的主機狀態及相關資訊
[Reference]
Splunk for Nagios
How do I configure a Splunk Forwarder on Linux
Nagios integration