Cd Chen's Services

ba ba ba la~~

使 Fedora 的 Cyrus-IMAP 支援 SNMP

由於長期使用 Cyrus-IMAP 作為我自己的 IMAP 伺服器,對於 Cyrus-IMAP 相當好感。最近突然想把 Cyrus-IMAP 與 SNMP 整合在一起,這樣我就可以透過 Zenoss 來監控 Cyrus-IMAP 的狀態。

挖了許多資料,甚至抓了 Cyrus-IMAP 的 source code,原來 Fedora 內建的 Cyrus-IMAP 已經整合了 net-snmpCyrus-IMAPcyrus-master 預設可以透過 AgentX 傳送 SNMP 訊息給用戶端。因此,理論上透過 SNMP 都可以直接取得 cyrus-master 傳來的資料。但怎麼實做,都不成功。最後才發現,問題出在 net-snmp 上!!

根據 man page 來看,snmpd 提供了一個名為 -x 的參數,用來指定 AgentX 的位址:

       -x ADDRESS
               Listens for AgentX connections on the specified address  rather
               than  the default "/var/agentx/master".  The address can either
               be a Unix domain socket path,  or  the  address  of  a  network
               interface.   The  format is the same as the format of listening
               addresses described below.

man page 中特別說明了,AgentX 預設值為 /var/agentx/master 路徑,但若直接啟動 snmpd 服務,卻不會產生 /var/agentx/master 這個 Unix-Domain Socket 檔案,才造成 cyrus-master 無法與 AgentX 通訊。

要解決這個方法,說穿了很簡單,只需要修改 /etc/sysconfig/snmpd

# snmpd command line options 
# OPTIONS="-Lsd -Lf /dev/null -p /var/run/snmpd.pid -a"
OPTIONS="-x /var/agentx/master"

強迫指定 -x 參數,然後重新啟動 snmpdcyrus-imapd 兩個服務即可。

這篇內容的 Trackback 網址:

http://www.cdchen.idv.tw/trackback/993