Xiaopei's DokuWiki

These are the good times in your life,
so put on a smile and it'll be alright

User Tools

Site Tools


it:statsd

Table of Contents

statsd

grafana

grafana 2.1 已支持 influxdb 0.91)

influxdb

  • 注意 0.9 的 API 与以前不一样!0.9 文档:
  • deb 包安装后默认没有验证限制(root, root)
# SHOW MEASUREMENTS shows ALL Measurements IN the system.
SHOW MEASUREMENTS
$ http localhost:8086/query q=="select * from cpu_load_short" db==mydb

结合 Lynx,示例如下:

## nodejs
statsd.increment('hehe.int');
statsd.timing('hehe.some_service.task.time', 500);
statsd.gauge('hehe.gauge.one', 100);
statsd.set('hehe.set.one', 10);
 
## shell
$ http localhost:8086/query q=="show measurements" db==mydb
{
    "results": [
        {
            "series": [
                {
                    "columns": [
                        "name"
                    ],
                    "name": "measurements",
                    "values": [
                        [
                            "hehe.gauge.one.gauge"
                        ],
                        [
                            "hehe.int.counter"
                        ],
                        [
                            "hehe.set.one"
                        ],
                        [
                            "hehe.set.one_count"
                        ],
                        [
                            "hehe.some_service.task.time.timer.count"
                        ],
                        [
                            "hehe.some_service.task.time.timer.count_90"
                        ],
                        [
                            "hehe.some_service.task.time.timer.count_ps"
                        ],
                        [
                            "hehe.some_service.task.time.timer.lower"
                        ],
                        [
                            "hehe.some_service.task.time.timer.mean"
                        ],
                        [
                            "hehe.some_service.task.time.timer.mean_90"
                        ],
                        [
                            "hehe.some_service.task.time.timer.median"
                        ],
                        [
                            "hehe.some_service.task.time.timer.std"
                        ],
                        [
                            "hehe.some_service.task.time.timer.sum"
                        ],
                        [
                            "hehe.some_service.task.time.timer.sum_90"
                        ],
                        [
                            "hehe.some_service.task.time.timer.sum_squares"
                        ],
                        [
                            "hehe.some_service.task.time.timer.sum_squares_90"
                        ],
                        [
                            "hehe.some_service.task.time.timer.upper"
                        ],
                        [
                            "hehe.some_service.task.time.timer.upper_90"
                        ],
# end
 
# 如果 measurement 名中有 .,则必须用 "" 双引号括起来
$ http localhost:8086/query q=='select * from "user.login.post.failed.counter"' db==mydb
{
    "results": [
        {
            "series": [
                {
                    "columns": [
                        "time",
                        "value"
                    ],
                    "name": "user.login.post.failed.counter",
                    "values": [
                        [
                            "2015-05-20T04:22:01.963048125Z",
                            1
                        ]
                    ]
                }
            ]
        }
    ]
}
 
 
# 用 regexp 正则
$ http localhost:8086/query q=='select * from /user\.login\.post.*/' db==mydb
{
    "results": [
        {
            "series": [
                {
                    "columns": [
                        "time",
                        "value"
                    ],
                    "name": "user.login.post.attempted.counter",
                    "values": [
                        [
                            "2015-05-20T04:22:01.963046342Z",
                            1
                        ]
                    ]
                },
                {
                    "columns": [
                        "time",
                        "value"
                    ],
                    "name": "user.login.post.failed.counter",
                    "values": [
                        [
                            "2015-05-20T04:22:01.963048125Z",
                            1
                        ]
                    ]
                }
            ]
        }
    ]
}

libs

it/statsd.txt · Last modified: 2015/11/26 17:08 by admin