• Grafana看板里有几个项目内容是空,麻烦老师帮忙看下

    Total request的查询语句:
    SELECT sum("count") FROM "jmeter_xy" WHERE "transaction" =~ /^$request$/ AND "statut" = 'all' AND $timeFilter GROUP BY time($aggregation) fill(null)

    Failed request的查询语句:
    SELECT sum("count") FROM "jmeter_xy" WHERE ("transaction" =~ /^$request$/ AND "statut" = 'ko') AND $timeFilter GROUP BY time($aggregation) fill(null)

    Passed request的查询语句:
    SELECT sum("count") FROM "jmeter_xy" WHERE ("transaction" =~ /^$request$/ AND "statut" = 'ok') AND $timeFilter GROUP BY time($aggregation) fill(null)

  • 第一个自选股的名字过长时会把状态挤掉
    名字长度正常时:

    名字长度过长时:

  • 课间作业

    1、使用Idea自带工具统计单元测试覆盖率

    2、使用maven jacoco进行代码覆盖率统计

    mvn clean test -Dmaven.test.failure.ignore=true verify

  • shell三剑客实战练习

    1、统计当前访问量最高的ip地址,取前3个

    netstat -tnp | awk '{print$5}' | awk -F: '{print$1}' | grep -v -i '^[a-z].*'| sort | uniq -c | sort -nr | head -3
    或者
    netstat -tnp | grep ":22" | awk '{print $5}' | awk -F: '{print $1}' | sort | uniq -c |sort -nr | head -3

    结果

    2 111.194.244.232
    1 221.218.215.55
    1 218.13.15.114

    2、找出log中的404 500的报错 考察严谨性

    cat 1206.log |awk '$9~/404|500/'| awk '{print$9}' | sort | uniq -c | sort -nr

    结果

    10549 404
    101 500

    3、 找出访问 /topics/xxxxx,以及访问topics/nnnn/replies的 接口的请求分别有多少。
    预期结果:topics nnnn topics/replies dddd

    cat 1206.log | grep -E " /topics/[0-9]{1,}" \
    | awk '{print $7}' \
    | sed 's#?.*##g' \
    | sed 's#/topics/[0-9]*$#/topics/numbers#g' \
    | sed 's#/topics/[0-9]*/replies/[0-9]*/.*$#/topics/replies/replies#g' \
    | sort |uniq -c | sort -nr \
    | grep -E "numbers|replies"

    结果

    12163 /topics/numbers
    9758 /topics/replies/replies

    4、 课后作业

    cat 1206.log \
    | awk '{print $7}' \
    | sed 's#?.*##g' \
    | sed -E 's#/([a-z0-9]+-)*[a-z0-9]+\.(jpg|png|jpeg|gif)(\![a-z0-9]+)*#/.(jpg|png|jpeg|gif)#g' \
    | sed -E 's#\-[0-9]+\x[0-9]+\.(jpg|png|jpeg|gif)(\![a-z0-9]+)*#/.(jpg|png|jpeg|gif)#g' \
    | sed -E 's#/[0-9]+##g' \
    | sort | uniq -c | sort -nr | head -10

    结果

    39064 /cable
    12310 /topics
    4861 /topics/replies/edit
    3975 /topics/replies/reply_suggest
    2295 /uploads/photo/.(jpg|png|jpeg|gif)
    2045 /
    1423 /.(jpg|png|jpeg|gif)
    1422 /photo/.(jpg|png|jpeg|gif)
    1366 /_img/uploads/photo/.(jpg|png|jpeg|gif)
    1008 /uploads/user/avatar/.(jpg|png|jpeg|gif)