prometheus監控實戰( 二 )


文章插圖

prometheus監控實戰

文章插圖
4、配置grafana并查看
  • 導入監控模板在grafan導入監控windows和linux模板,Windows模板編號:10467 , Linux模板編號:11074 , 具體操作如下圖
    prometheus監控實戰

    文章插圖
    prometheus監控實戰

    文章插圖
    prometheus監控實戰

    文章插圖
  • ?查看linux面板
    prometheus監控實戰

    文章插圖
    prometheus監控實戰

    文章插圖
  • ?查看windows面板
    prometheus監控實戰

    文章插圖
    prometheus監控實戰

    文章插圖
  • 第三節、部署日志平臺3.1、安裝服務端1、安裝
    tar -xvf loki.tar.gzcd loki/啟動
    nohup ./loki-linux-amd64 -config.file=config.yaml 1> ./log/loki.log & 2> ./log/loki_error.log &ss -tunlp | grep 3100tcp    LISTEN     0      128    [::]:3100               [::]:*                   users:(("loki-linux-amd6",pid=8422,fd=10))2、配置grafana
    prometheus監控實戰

    文章插圖
    prometheus監控實戰

    文章插圖
    prometheus監控實戰

    文章插圖
    prometheus監控實戰

    文章插圖
    prometheus監控實戰

    文章插圖
    3.2、部署logstashtar -xvf logstash-7.16.2.tarcd logstash-7.16.2/bin/logstash-plugin install file:///bankapp/logstash/plugin/logstash-codec-plain.zipbin/logstash-plugin install file:///bankapp/logstash/plugin/logstash-output-loki.zipvi pipelines/log_collect.confinput{   beats {       port => 10515   }}input{   http {       host => "0.0.0.0"       port => 10516       type => "healthcheck"   }}filter {    grok{          match => {               "message" => ".*\[INFO\] \[(?<funcname>(.*?)):.*"          }    }    grok {        match => ["message", "%{TIMESTAMP_ISO8601:logdate}"]    }    if [appname] == "switch" {        date {            match => ["logdate", "yyyy-MM-dd HH:mm:ss.SSS"]            target => "@timestamp"  ## 榛樿target灝辨槸"@timestamp        }    }else {        date {            match => ["logdate", "yyyy-MM-dd'T'HH:mm:ss.SSS"]            target => "@timestamp"  ## 榛樿target灝辨槸"@timestamp        }    }    mutate {        remove_field => ["tags"]        remove_field => ["offset"]        remove_field => ["logdate"]    }}output {    if [type] == "healthcheck" {    }else{        loki {            url => "http://192.168.10.10:3100/loki/api/v1/push"            batch_size => 112640 #112.64 kilobytes            retries => 5            min_delay => 3            max_delay => 500            message_field => "message"        }    }

    推薦閱讀