zabbix3.2监控
自動化運維框架
運維標準流程監控管理容量管理、關聯關系、任務管理、自動部署、分布式集群、傳統集群、機器管理安全控制災難管理自動化監控
?
監控評估數據采集主動式數據采集: client、公共插件、自定義腳本被動式服務狀態: 服務狀態、程序狀態、用戶訪問質量第三方信息 公司內相關系統 數據處理復雜計算閾值判斷智能分析 報警與聯動報警策略聯動處理報警跟蹤問題管理 API
?
?通常監控方式
通過snmp監控(nms/agent)v1、v2明文傳輸,不安全(非敏感文件),v3認證也很薄弱(目前不流行)通過snmp get 、get-next、get-bulk等采集數據。但是如何存儲這些數據?如使用snmptrap實現主動監控,風險很大有些不支持安裝agent的需要用到,最優是安裝agent,都沒的話ssh方式Catci(php開發)工具能幫助 1、采集數據 (依賴snmp,不需要客戶端安裝agent,本身不是監控工具) 2、保存數據 3、展示數據 4、數據分析及告警。但是告警功能一般。也可以使用rrd輪轉數據庫,rrd繪圖,rrdtool也是個強大的工具(通過插件也能實現告警)Nagios(強大報警工具,也是獨立的監控功能)加強告警功能(閾值),是個強大的告警工具,實現告警狀態切換功能(郵件,msn,短信)不適合分析展示數據,趨勢分析。 能分析依賴關系。不保存數據,只關心狀態轉換。需要額外插件配置保存相關數據。獨立的監控工具,在監控端安裝agent也可實現很好的監控主動監控。節點數大于200多,估計要延時Agent+控制端架構 實現可靠監控,管理功能更加強大(路由器沒法裝哦)上述2種都是不適合大規模監控,一般結合使用Zabbix可以說是nagios和cacti整合,自動發現監控設備 支持分布式監控。為中小規模提供完整的解決方案
monitoring with snmp --> network device
monitoring with zabbix agent --> servers with zabbix agent
monitoring with ping or port check --> servers without zabbix agent
支持的平臺
solaris、mac、windows、hp-ux、freebsd、unix、openbsd
ssh腳本(需要賬號)
?
監控系統(MS)的功能
Data gatheringData storage VisualisationAlerting?
zabbix的監控功能
zabbix agent cpu/mem/network/disk/service/log/file/other(win性能計數器) snmp agent ipmi agent agentless monitoring web monitoring response time/download speed/response code/content/web scenarios/https and http database monitoring internal check calculated monitoring custom cammand monitoring?
支持的通知方法手段
email sms jabber chat message command execution
zabbix架構
邏輯架構
zabbix常用術語
?
?
?
?
?
?
?
?
?
?
監控步驟,定義一次完整的監控
?
1、確定zabbix監控對象,即添加主機節點 手動添加/自動發現 host-->組成hostgroup 2、定義item(item key) item-->組成application,多臺主機監控同一指標時,定義成模板 3、定義grahp --->組成screen 展示,graph自定義整合成graph等 4、trigger定義閾值 -->產生event(discovery也產生event) 定義數據指標(依賴關系,zabbix僅運行在triger上定義依賴關系,nagios可以主機級別) 5、actions (action condition operations(sms/remote command) )?
?
zabbix3.2通過模板監控mysql
1、zabbix-GUI鏈接Template App MySQL模板2、zabbix-agent端zabbix_agentd.conf 加入UserParameter后重啟zabbix-agent
UserParameter=mysql.status[*],/usr/local/mysql/bin/mysql -uroot -prootabcd -h127.0.0.1 -e "show global status" | awk '/$1\>/ {print $$2}'
UserParameter=mysql.ping,/usr/local/mysql/bin/mysqladmin -uroot -prootabcd -h 127.0.0.1 ping | grep -c alive
UserParameter=mysql.version,/usr/local/mysql/bin/mysql -V
?
zabbix3.2監控nginx status
1、開啟nginx status| location /status {stub_status on;access_log off;allow 127.0.0.1;allow 192.168.0.80; deny all; } | # curl http://192.168.0.80/status Active connections: 7 server accepts handled requests ?67 67 136 Reading: 0 Writing: 1 Waiting: 6 |
| Active connections:對后端發起的活動連接數,即正在處理的活動連接數 在訪問效率很高,請求很快被處理完畢的情況下,Waiting 數比較多是正常的。如果 reading + writing 數較多,則說明并發訪問量很大,正在處理過程中 | |
2、zabbix-agent端zabbix_agentd.conf 加入UserParameter后重啟zabbix-agent
UserParameter=Nginx.active[*],/usr/bin/curl -s "http://$1:$2/status" | awk '/^Active/ {print $NF}'
UserParameter=Nginx.accepts[*],/usr/bin/curl -s "http://$1:$2/status" | awk 'NR==3 {print $$1}'
UserParameter=Nginx.handled[*],/usr/bin/curl -s "http://$1:$2/status" | awk 'NR==3 {print $$2}'
UserParameter=Nginx.requests[*],/usr/bin/curl -s "http://$1:$2/status" | awk 'NR==3 {print $$3}'
UserParameter=Nginx.reading[*],/usr/bin/curl -s "http://$1:$2/status" | grep 'Reading' | cut -d " " -f2
UserParameter=Nginx.writing[*],/usr/bin/curl -s "http://$1:$2/status" | grep 'Writing' | cut -d " " -f4
UserParameter=Nginx.waiting[*],/usr/bin/curl -s "http://$1:$2/status" | grep 'Waiting' | cut -d " " -f6
3、在主機節點上添加item(示例)
Name:?? ?Nginx.active
Key:?? ? Nginx.active[{HOST.IP},80]?? ?
Applications:Nginx Status
?
zabbix agent 類型所有 key
| log[file,<regexp>,<encoding>,<maxlines>,<mode>,<output>] ?監控日志文件 | ? | ? |
| logrt[file_pattern,<regexp>,<encoding>,<maxlines>,<mode>,<output>] ?監控輪轉日志文件 | ? | ? |
| net.dns[<ip>,zone,<type>,<timeout>,<count>] ?檢測DNS服務是否開啟 | ? | ? |
| net.dns.record[<ip>,zone,<type>,<timeout>,<count>] ?獲取DNS查詢數據 | ? | ? |
| net.if.collisions[if] ?Out-of-window collision | ? | ? |
| net.if.discovery?列出網卡,通常用于低級別的discovery | ? | ? |
| net.if.in[if,<mode>] ??統計網卡進流量 | ? | ? |
| net.if.out[if,<mode>] ??統計網卡出流量 | ? | ? |
| net.if.total[if,<mode>] ?統計網卡進出流量和 | ? | ? |
| ? | ? | ? |
| net.tcp.listen[port] ?檢測端口是否可用 | ? | ? |
| net.tcp.port[<ip>,port]??檢測TCP端口是否可用 | ? | ? |
| net.tcp.service[service,<ip>,<port>] ?檢測服務是否開啟,端口是否可用 | ? | ? |
| net.tcp.service.perf[service,<ip>,<port>]? 檢測服務性能 | ? | ? |
| net.udp.listen[port] ?檢測UDP端口是否可用 | ? | ? |
| proc.mem[<name>,<user>,<mode>,<cmdline>] ?用戶進程內存消耗 | ? | ? |
| proc.num[<name>,<user>,<state>,<cmdline>] ?某用戶某些狀態的進程數量 | ? | ? |
| sensor[device,sensor,<mode>] ?讀取硬件傳感器 | ? | ? |
| system.boottime?系統啟動的時間戳 | ? | ? |
| system.cpu.intr?設備中斷數 | ? | ? |
| system.cpu.load[<cpu>,<mode>] ?CPU負載 | ? | ? |
| system.cpu.num[<type>] ?CPU數量 | ? | ? |
| system.cpu.switches?CPU上下文切換次數 | ? | ? |
| system.cpu.util[<cpu>,<type>,<mode>] ?CPU使用率 | ? | ? |
| system.hostname[<type>] ?返回主機名 | ? | ? |
| system.hw.chassis[<info>] ?返回機架信息 | ? | ? |
| system.hw.cpu[<cpu>,<info>] ?返回CPU信息 | ? | ? |
| system.hw.devices[<type>]?列出PCI或者USB | ? | ? |
| system.hw.macaddr[<interface>,<format>]? 列出MAC地址 | ? | ? |
| system.localtime[<type>] ?系統時間 | ? | ? |
| system.run[command,<mode>] ?在指定的主機上運行命令(EnableRemoteCommands=1 ) | ? | ? |
| system.stat[resource,<type>] ?虛擬內存狀態 | ? | ? |
| system.sw.arch ?返回軟件信息 | ? | ? |
| system.sw.os[<info>] ?返回系統信息 | ? | ? |
| system.sw.packages[<package>,<manager>,<format>] ?已安裝軟件列表 | ? | ? |
| system.swap.in[<device>,<type>] ?磁盤到內存 | ? | ? |
| system.swap.out[<device>,<type>] ?內存到磁盤 | ? | ? |
| system.swap.size[<device>,<type>] ?交換分區大小 | ? | ? |
| system.uname ?返回主機相應信息 | ? | ? |
| system.uptime ?系統運行時常(s) | ? | ? |
| system.users.num ?登陸用戶數 | ? | ? |
| vfs.dev.read[<device>,<type>,<mode>] ?磁盤讀取狀態 | ? | ? |
| vfs.dev.write[<device>,<type>,<mode>] ?磁盤寫入狀態 | ? | ? |
| vfs.file.cksum[file] ?計算文件校驗 | ? | ? |
| vfs.file.contents[file,<encoding>] ?獲取文件內容 | ? | ? |
| vfs.file.exists[file] ?檢測文件是否存在 | ? | ? |
| vfs.file.md5sum[file] ?文件MD5校驗碼 | ? | ? |
| vfs.file.regexp[file,regexp,<encoding>,<start line>,<end line>,<output>] ?文件中搜索字符串,返回行 | ? | ? |
| vfs.file.regmatch[file,regexp,<encoding>,<start line>,<end line>]? 文件中搜索字符串,1找到,0未找到 | ? | ? |
| vfs.file.size[file?文件大小 | ? | ? |
| vfs.fs.discovery ?列出掛載的文件系統 | ? | ? |
| vfs.fs.inode[fs,<mode>] ?文件系統inode數量 | ? | ? |
| vfs.fs.size[fs,<mode>] ??文件系統空間 | ? | ? |
| vm.memory.size[<mode>] ?內存大小 | ? | ? |
| web.page.get[host,<path>,<port>] ?獲取網頁內容 | ? | ? |
| web.page.perf[host,<path>,<port>]? 獲取完全加載網頁耗時 | ? | ? |
| web.page.regexp[host,<path>,<port>,<regexp>,<length>,<output>]??? 在網頁中搜索字符串 | ? | ? |
| vfs.file.time[file,<mode>] 文件時間 | ? | ? |
| ? | ? | ? |
?
?
zabbix Simple checks 基本檢測
zabbix Simple checks 基本檢測 Simple checks 通常用來檢查遠程未安裝代理或者客戶端的服務。使用 simple checks,被監控客戶端無需安裝 zabbix agent 客戶端,zabbix server 直接使用 simple checks 來收據數據,一基本上都是用來檢測遠程服務器某端口是否在 監聽#yum install fping #grep FpingLocation /usr/local/zabbix/etc/zabbix_server.conf FpingLocation=/usr/sbin/fping # chown root:zabbix /usr/sbin/fping # chmod 4710 /usr/sbin/fping| ?icmpping[<target>,<packets>,<interval>,<size>,<timeout>]? ?檢測是否支持icmpping | ? |
| ?icmppingloss[<target>,<packets>,<interval>,<size>,<timeout>] ?返回丟包率 | ? |
| ?icmppingsec[<target>,<packets>,<interval>,<size>,<timeout>,<mode>] ?返回響應時間 | ? |
| ?net.tcp.service[service,<ip>,<port>] 檢測服務是否運行并且接受tcp連接 | ? |
| ?net.tcp.service.perf[service,<ip>,<port>] ?檢測服務性能 | ? |
| ? | ? |
?
轉載于:https://www.cnblogs.com/gtms/p/6880460.html
總結
以上是生活随笔為你收集整理的zabbix3.2监控的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 产品经理在早期如何快速学习?
- 下一篇: 蓝牙耳机连接手机教程(如何使用蓝牙耳机连