chinese直男口爆体育生外卖, 99久久er热在这里只有精品99, 又色又爽又黄18禁美女裸身无遮挡, gogogo高清免费观看日本电视,私密按摩师高清版在线,人妻视频毛茸茸,91论坛 兴趣闲谈,欧美 亚洲 精品 8区,国产精品久久久久精品免费

0
  • 聊天消息
  • 系統(tǒng)消息
  • 評論與回復
登錄后你可以
  • 下載海量資料
  • 學習在線課程
  • 觀看技術視頻
  • 寫文章/發(fā)帖/加入社區(qū)
會員中心
創(chuàng)作中心

完善資料讓更多小伙伴認識你,還能領取20積分哦,立即完善>

3天內不再提示

Shell命令執(zhí)行可視化和告警工具

Linux愛好者 ? 來源:secist ? 作者:secist ? 2020-11-12 15:59 ? 次閱讀
加入交流群
微信小助手二維碼

掃碼添加小助手

加入工程師交流群

Sampler是一個用于shell命令執(zhí)行,可視化和告警的工具。其配置使用的是一個簡單的YAML文件。

1、為什么我需要它?

你可以直接從終端對任意動態(tài)進程進行采樣 – 觀察數(shù)據(jù)庫中的更改,監(jiān)控MQ動態(tài)消息(in-flight messages),觸發(fā)部署腳本并在完成后獲取通知。

如果有一種方法可以使用shell命令獲取指標(metric),那么可以使用Sampler立即對其進行可視化。

2、安裝

macOS

brewcaskinstallsampler

sudocurl-Lo/usr/local/bin/samplerhttps://github.com/sqshq/sampler/releases/download/v1.0.3/sampler-1.0.3-darwin-amd64 sudochmod+x/usr/local/bin/sampler

Linux

sudowgethttps://github.com/sqshq/sampler/releases/download/v1.0.3/sampler-1.0.3-linux-amd64-O/usr/local/bin/sampler sudochmod+x/usr/local/bin/sampler

注意:需要為Sampler安裝libasound2-dev系統(tǒng)庫用以播放觸發(fā)器聲音。通常庫已安裝在相應位置,但如果沒有 – 你可以使用你習慣的包管理器進行安裝,例如apt install libasound2-dev

Windows(實驗)

建議在高級控制臺模擬器下使用,如Cmder

Download .exe

3、使用

指定shell命令,Sampler會相應的速率執(zhí)行這些命令。輸出用于可視化。

使用Sampler基本上的三步過程:

在YAML配置文件中定義shell命令

運行sampler -c config.yml

在UI上調整組件大小和位置

市面早已有許多監(jiān)控系統(tǒng)

Sampler絕不是監(jiān)控系統(tǒng)的替代品,而是易于設置的開發(fā)工具。

如果spinning up和使用Grafana配置Prometheus是完全多余的任務,那么Sampler可能是正確的解決方案。沒有服務器,沒有數(shù)據(jù)庫,不需要部署 – 你指定了shell命令,它就可以工作了。

我監(jiān)控的每臺服務器上都需要安裝嗎?

不,你可以在本地運行Sampler,但仍然可以從多臺遠程計算機上收集遙測數(shù)據(jù)。任何可視化都可能具有init命令,你可以在其中ssh到遠程服務器。請參閱SSH example

4、組件

以下是每種組件類型的配置示例列表,其中包含與macOS兼容的采樣腳本。

Runchart

runcharts: -title:Searchengineresponsetime rate-ms:500#samplingrate,default=1000 scale:2#numberofdigitsaftersampledecimalpoint,default=1 legend: enabled:true#enablesitemlabels,default=true details:false#enablesitemstatistics:cur/min/max/dltvalues,default=true items: -label:GOOGLE sample:curl-o/dev/null-s-w'%{time_total}'https://www.google.com color:178#8-bitcolornumber,defaultoneischosenfromapre-definedpalette -label:YAHOO sample:curl-o/dev/null-s-w'%{time_total}'https://search.yahoo.com -label:BING sample:curl-o/dev/null-s-w'%{time_total}'https://www.bing.com

Sparkline

sparklines: -title:CPUusage rate-ms:200 scale:0 sample:ps-A-o%cpu|awk'{s+=$1}END{prints}' -title:Freememorypages rate-ms:200 scale:0 sample:memory_pressure|grep'Pagesfree'|awk'{print$3}'

Barchart

barcharts: -title:Localnetworkactivity rate-ms:500#samplingrate,default=1000 scale:0#numberofdigitsaftersampledecimalpoint,default=1 items: -label:UDPbytesin sample:nettop-Jbytes_in-l1-mudp|awk'{sum+=$4}END{printsum}' -label:UDPbytesout sample:nettop-Jbytes_out-l1-mudp|awk'{sum+=$4}END{printsum}' -label:TCPbytesin sample:nettop-Jbytes_in-l1-mtcp|awk'{sum+=$4}END{printsum}' -label:TCPbytesout sample:nettop-Jbytes_out-l1-mtcp|awk'{sum+=$4}END{printsum}'

Gauge

gauges: -title:Minuteprogress rate-ms:500#samplingrate,default=1000 scale:2#numberofdigitsaftersampledecimalpoint,default=1 percent-only:false#toggledisplayofthecurrentvalue,default=false color:178#8-bitcolornumber,defaultoneischosenfromapre-definedpalette cur: sample:date+%S#samplescriptforcurrentvalue max: sample:echo60#samplescriptformaxvalue min: sample:echo0#samplescriptforminvalue -title:Yearprogress cur: sample:date+%j max: sample:echo365 min: sample:echo0

Textbox

textboxes: -title:Localweather rate-ms:10000#samplingrate,default=1000 sample:curlwttr.in?0ATQF border:false#borderaroundtheitem,default=true color:178#8-bitcolornumber,defaultiswhite -title:Dockercontainersstats rate-ms:500 sample:dockerstats--no-stream--format"table{{.Name}} {{.CPUPerc}} {{.MemUsage}} {{.PIDs}}"

Asciibox

asciiboxes: -title:UTCtime rate-ms:500#samplingrate,default=1000 font:3d#fonttype,default=2d border:false#borderaroundtheitem,default=true color:43#8-bitcolornumber,defaultiswhite sample:envTZ=UTCdate+%r

5、額外功能

Triggers

觸發(fā)器允許執(zhí)行條件操作,如視覺/聲音告警或任意shell命令。以下示例說明了此概念。

Clock gauge,從開始的每分鐘顯示時間進度和當前時間

gauges: -title:MINUTEPROGRESS position:[[0,18],[80,0]] cur: sample:date+%S max: sample:echo60 min: sample:echo0 triggers: -title:CLOCKBELLEVERYMINUTE condition:'[$label=="cur"]&&[$cur-eq0]&&echo1||echo0'#expects"1"asTRUEindicator actions: terminal-bell:true#standardterminalbell,default=false sound:true#NASAquindartone,default=false visual:false#notificationwithcurrentvalueontopofthecomponentarea,default=false script:say-vsamantha`date+%I:%M%p`#anarbitraryscript,whichcanuse$cur,$prevand$labelvariables

索引擎延遲圖表,在延遲超過閾值時向用戶發(fā)出告警

runcharts: -title:SEARCHENGINERESPONSETIME(sec) rate-ms:200 items: -label:GOOGLE sample:curl-o/dev/null-s-w'%{time_total}'https://www.google.com -label:YAHOO sample:curl-o/dev/null-s-w'%{time_total}'https://search.yahoo.com triggers: -title:Latencythresholdexceeded condition:echo"$prev0.3"|bc-l#expects"1"asTRUEindicator actions: terminal-bell:true#standardterminalbell,default=false sound:true#NASAquindartone,default=false visual:true#visualnotificationontopofthecomponentarea,default=false script:'sayalert:${label}latencyexceeded${cur}second'#anarbitraryscript,whichcanuse$cur,$prevand$labelvariables

交互式 shell 支持

除了sample命令之外,還可以指定init命令(在采樣前僅執(zhí)行一次)和transform命令(后處理采樣命令輸出)。這包括交互式shell用例,例如僅建立與數(shù)據(jù)庫的連接一次,然后在交互式shell會話中執(zhí)行輪詢。

Basic mode

textboxes: -title:MongoDBpolling rate-ms:500 init:mongo--quiet--host=localhosttest#executesonlyoncetostarttheinteractivesession sample:Date.now();#executeswitharequiredrate,inscopeoftheinteractivesession transform:echoresult=$sample#executesinscopeoflocalsession,$samplevariableisavailablefortransformation

PTY mode

在某些情況下,交互式shell將無法工作,因為它的stdin不是終端。這種情況下我們可以使用PTY模式:

textboxes: -title:Neo4jpolling pty:true#enablespseudo-terminalmode,default=false init:cypher-shell-uneo4j-ppwd--formatplain sample:RETURNrand(); transform:echo"$sample"|tail-n1 -title:Toponaremoteserver pty:true#enablespseudo-terminalmode,default=false init:ssh-i~/user.pemec2-user@1.2.3.4 sample:top

init 命令逐步執(zhí)行

在開始采樣之前,還可以逐個執(zhí)行多個init命令。

textboxes: -title:Javaapplicationuptime multistep-init: -java-jarjmxterm-1.0.0-uber.jar -openhost:port#orlocalPID -beanjava.lang:type=Runtime sample:getUptime

變量

如果配置文件包含重復的模式,則可以將它們提取到變量部分。此外,還可以在啟動時使用-v/–variable標志指定變量,并且任意的系統(tǒng)環(huán)境變量也可以在腳本中使用。

variables: mongoconnection:mongo--quiet--host=localhosttest barcharts: -title:MongoDBdocumentsbystatus items: -label:IN_PROGRESS init:$mongoconnection sample:db.getCollection('events').find({status:'IN_PROGRESS'}).count() -label:SUCCESS init:$mongoconnection sample:db.getCollection('events').find({status:'SUCCESS'}).count() -label:FAIL init:$mongoconnection sample:db.getCollection('events').find({status:'FAIL'}).count()

顏色主題

theme:light#default=dark sparklines: -title:CPUusage sample:ps-A-o%cpu|awk'{s+=$1}END{prints}'

6、真實場景

數(shù)據(jù)庫

以下是不同的數(shù)據(jù)庫連接示例。建議使用交互式shell(init腳本)僅建立一次連接,然后在采樣期間重用即可。

MySQL

#prerequisite:installedmysqlshell variables: mysql_connection:mysql-uroot-s--databasemysql--skip-column-names sparklines: -title:MySQL(randomnumberexample) pty:true init:$mysql_connection sample:selectrand();

PostgreSQL

#prerequisite:installedpsqlshell variables: PGPASSWORD:pwd postgres_connection:psql-hlocalhost-Upostgres--no-align--tuples-only sparklines: -title:PostgreSQL(randomnumberexample) init:$postgres_connection sample:selectrandom();

MongoDB

#prerequisite:installedmongoshell variables: mongo_connection:mongo--quiet--host=localhosttest sparklines: -title:MongoDB(randomnumberexample) init:$mongo_connection sample:Math.random();

Neo4j

#prerequisite:installedcyphershell variables: neo4j_connection:cypher-shell-uneo4j-ppwd--formatplain sparklines: -title:Neo4j(randomnumberexample) pty:true init:$neo4j_connection sample:RETURNrand(); transform:echo"$sample"|tail-n1

Kafka

檢查kafka lag值,計算每個隊列l(wèi)ag值的和,高于閾值報警,多consumergroup,多topic。

variables: kafka_connection:$KAFKA_HOME/bin/kafka-consumer-groups--bootstrap-serverlocalhost:9092 runcharts: -title:Kafkalagperconsumergroup rate-ms:5000 scale:0 items: -label:A->B sample:$kafka_connection--groupgroup_a--describe|awk'NR>1{sum+=$5}END{printsum}' -label:B->C sample:$kafka_connection--groupgroup_b--describe|awk'NR>1{sum+=$5}END{printsum}' -label:C->D sample:$kafka_connection--groupgroup_c--describe|awk'NR>1{sum+=$5}END{printsum}'

Docker

Docker容器統(tǒng)計信息(CPU,MEM,O/I)

textboxes: -title:Dockercontainersstats sample:dockerstats--no-stream--format"table{{.Name}} {{.CPUPerc}} {{.MemPerc}} {{.MemUsage}} {{.NetIO}} {{.BlockIO}} {{.PIDs}}"

SSH

遠程服務器上的TOP命令

variables: sshconnection:ssh-i~/my-key-pair.pemec2-user@1.2.3.4 textboxes: -title:SSH pty:true init:$sshconnection sample:top

JMX

Java應用程序的正常運行示例

#prerequisite:download[jmxtermjarfile](https://docs.cyclopsgroup.org/jmxterm) textboxes: -title:Javaapplicationuptime multistep-init: -java-jarjmxterm-1.0.0-uber.jar -openhost:port#orlocalPID -beanjava.lang:type=Runtime sample:getUptime transform:echo$sample|tr-dc'0-9'|awk'{printf"%.1fmin",$1/1000/60}'

責任編輯:lq

聲明:本文內容及配圖由入駐作者撰寫或者入駐合作網(wǎng)站授權轉載。文章觀點僅代表作者本人,不代表電子發(fā)燒友網(wǎng)立場。文章及其配圖僅供工程師學習之用,如有內容侵權或者其他違規(guī)問題,請聯(lián)系本站處理。 舉報投訴
  • 數(shù)據(jù)庫

    關注

    7

    文章

    3980

    瀏覽量

    67450
  • 可視化
    +關注

    關注

    1

    文章

    1285

    瀏覽量

    22431
  • Shell
    +關注

    關注

    1

    文章

    373

    瀏覽量

    24939

原文標題:Shell 命令執(zhí)行可視化和告警工具

文章出處:【微信號:LinuxHub,微信公眾號:Linux愛好者】歡迎添加關注!文章轉載請注明出處。

收藏 人收藏
加入交流群
微信小助手二維碼

掃碼添加小助手

加入工程師交流群

    評論

    相關推薦
    熱點推薦

    如何使用協(xié)議分析儀進行數(shù)據(jù)分析與可視化

    使用協(xié)議分析儀進行數(shù)據(jù)分析與可視化,需結合數(shù)據(jù)捕獲、協(xié)議解碼、統(tǒng)計分析及可視化工具,將原始數(shù)據(jù)轉化為可解讀的圖表和報告。以下是詳細步驟及關鍵方法,涵蓋從數(shù)據(jù)采集到可視化的全流程:一、數(shù)據(jù)采集與預處理
    發(fā)表于 07-16 14:16

    VirtualLab Fusion應用:3D系統(tǒng)可視化

    描述和F-Theta透鏡的應用示例。 光學系統(tǒng)的3D-可視化 VirtualLab Fusion提供的工具可以實現(xiàn)光學系統(tǒng)的3D可視化,因此可以用于檢查元件的位置,以及快速了解系統(tǒng)內部的光傳播情況
    發(fā)表于 04-30 08:47

    可視化組態(tài)物聯(lián)網(wǎng)平臺是什么

    可視化含義:組態(tài)是一種用于構建復雜物聯(lián)網(wǎng)系統(tǒng)的工具,它提供了豐富的圖形組件和可視化元素,使得用戶可以通過簡單的拖拽操作來創(chuàng)建自定義的界面。可視化
    的頭像 發(fā)表于 04-21 10:40 ?563次閱讀

    VirtualLab Fusion應用:光學系統(tǒng)的3D可視化

    摘要 為了從根本上了解光學系統(tǒng)的特性,對其組件進行可視化并顯示光的傳播情況大有幫助。為此,VirtualLab Fusion 提供了顯示光學系統(tǒng)三維可視化工具。這些工具還可用于檢查
    發(fā)表于 04-02 08:42

    VirtualLab Fusion中的可視化設置

    摘要 VirtualLab Fusion中的全局選項對話框可以輕松定制軟件的外觀和感覺。還可以保存和加載全局選項文件,以便可以輕松地將偏好設置從一個設備轉移到另一個設備。本文檔說明了與可視化和結果
    發(fā)表于 02-25 08:51

    VirtualLab Fusion應用:光波導k域布局可視化(“神奇的圓環(huán)”)

    ,光可以在TIR(全反射)作用下傳播,并與光導表面上不同類型的光柵結構相結合,以耦合光進出。在VirtualLab Fusion中,k-Layout可視化工具提供了一種在k域中強大的圖解方法,用于分析
    發(fā)表于 02-21 08:53

    七款經(jīng)久不衰的數(shù)據(jù)可視化工具!

    數(shù)據(jù)量的激增,單純通過數(shù)字和文本來分析數(shù)據(jù)已不再高效。數(shù)據(jù)可視化則提供了一種直觀、互動性強的方式,幫助人們通過視覺元素,如柱狀圖、折線圖、餅圖、熱力圖等圖表形式,理解復雜的數(shù)據(jù)關系。 二、數(shù)據(jù)可視化工具
    發(fā)表于 01-19 15:24

    光學系統(tǒng)的3D可視化

    **摘要 ** 為了從根本上了解光學系統(tǒng)的特性,對其組件進行可視化并顯示光的傳播情況大有幫助。為此,VirtualLab Fusion 提供了顯示光學系統(tǒng)三維可視化工具。這些工具還可
    發(fā)表于 01-06 08:53

    什么是大屏數(shù)據(jù)可視化?特點有哪些?

    大屏數(shù)據(jù)可視化是指通過大屏幕展示大量數(shù)據(jù)和信息,以直觀、可視化的方式幫助用戶理解和分析數(shù)據(jù)。這種展示方式通常用于展示復雜的數(shù)據(jù)集、實時監(jiān)控系統(tǒng)、企業(yè)管理儀表盤等。以下是關于 大屏數(shù)據(jù)可視化 的詳細
    的頭像 發(fā)表于 12-16 16:59 ?906次閱讀

    智慧能源可視化監(jiān)管平臺——助力可視化能源數(shù)據(jù)管理

    博達可視化大屏設計平臺在智慧能源領域的價值體現(xiàn)在實時監(jiān)控、數(shù)據(jù)可視化、決策支持和效率提升等方面。借助該平臺,企業(yè)可以輕松搭建智慧能源類可視化大屏,更加精確和高效地管理生產和生活,實現(xiàn)能源的可持續(xù)發(fā)展。
    的頭像 發(fā)表于 11-29 10:00 ?1191次閱讀
    智慧能源<b class='flag-5'>可視化</b>監(jiān)管平臺——助力<b class='flag-5'>可視化</b>能源數(shù)據(jù)管理

    智慧樓宇可視化的優(yōu)點

    智慧樓宇可視化是指通過數(shù)據(jù)可視化技術來展示和分析樓宇的各種數(shù)據(jù),為樓宇管理者和用戶提供直觀、清晰的信息展示和決策支持。以下是智慧樓宇可視化的優(yōu)點,詳細介紹其在樓宇管理和運營中的重要作用: 1.實時
    的頭像 發(fā)表于 11-19 14:25 ?620次閱讀

    智慧園區(qū)數(shù)據(jù)可視化優(yōu)勢體現(xiàn)在哪些地方

    智慧園區(qū)數(shù)據(jù)可視化是當今數(shù)字化時代的重要工具,為園區(qū)管理者和決策者提供了強大的分析和展示數(shù)據(jù)的能力。以下是智慧園區(qū)數(shù)據(jù)可視化的應用優(yōu)勢,詳細介紹: 1.信息呈現(xiàn)清晰直觀:智慧園區(qū)數(shù)據(jù)可視化
    的頭像 發(fā)表于 11-15 10:30 ?668次閱讀
    智慧園區(qū)數(shù)據(jù)<b class='flag-5'>可視化</b>優(yōu)勢體現(xiàn)在哪些地方

    毫米波演示可視化工具

    電子發(fā)燒友網(wǎng)站提供《毫米波演示可視化工具.pdf》資料免費下載
    發(fā)表于 11-13 14:24 ?0次下載
    毫米波演示<b class='flag-5'>可視化工具</b>

    Linux系統(tǒng)中shell命令解析

    shell是Linux系統(tǒng)的用戶界面,提供了用戶與內核交互的一種接口,它接收用戶輸入的命令并到送到內核去執(zhí)行,因此也被稱為Linux的命令解釋器。
    的頭像 發(fā)表于 11-05 15:40 ?1200次閱讀