osquery操作系統(tǒng)監(jiān)控工具
osquery 是 SQL 驅(qū)動(dòng)的分析和監(jiān)控操作系統(tǒng)的工具,是操作系統(tǒng)分析框架,支持 OS X 和 Linux 系統(tǒng)。osquery 能幫助監(jiān)控和分析低水平的操作系統(tǒng),提供更直觀的性能監(jiān)控。
osquery 在操作系統(tǒng)中就像是一個(gè)高性能的關(guān)系數(shù)據(jù)庫(kù),允許你編寫(xiě)基于 SQL 的查詢(xún)語(yǔ)句來(lái)洞察操作系統(tǒng)的數(shù)據(jù)。使用 osquery,SQL 表代表如下抽象概念:
運(yùn)行時(shí)的進(jìn)程
加載內(nèi)核模塊
開(kāi)放網(wǎng)絡(luò)連接
SQL 表通過(guò)一個(gè)簡(jiǎn)單的可擴(kuò)展 API 實(shí)現(xiàn),各種表已經(jīng)存在并且還在不斷增加。
為了更好的理解 osquery,看看下面的 SQL 查詢(xún):
-------------------------------------------------------- -- get the name, pid and attached port of all processes -- which are listening on all interfaces -------------------------------------------------------- SELECT DISTINCT process.name, listening.port, process.pid FROM processes AS process JOIN listening_ports AS listening ON process.pid = listening.pid WHERE listening.address = '0.0.0.0';
-------------------------------------------------------- -- find every launchdaemon on an OS X host which -- * launches an executable when the operating -- system starts -- * keeps the executable running -- return the name of the launchdaemon and the full -- path (with arguments) of the executable to be ran. -------------------------------------------------------- SELECT name, program || program_arguments AS executable FROM launchd WHERE (run_at_load = 'true' AND keep_alive = 'true') AND (program != '' OR program_arguments != '');
這些查詢(xún)可以:
在特定條件下探索操作系統(tǒng)狀態(tài)
通過(guò)執(zhí)行調(diào)度程序來(lái)監(jiān)控操作系統(tǒng)的主機(jī)狀態(tài)
啟動(dòng)使用osquery api的自定義應(yīng)用程序
評(píng)論
圖片
表情
