我需要在石墨中显示来自 sensu 中继的图表:
使用 netcat cmd 我可以在 Graphite 中看到一棵新树:
#echo "test.first 10 `date +%s`"| nc 127.0.0.1 2003
但是使用 sensu 中继,我只看到“listener.log”中的“MetricLineReceiver”,而在“creates.log”中什么也没有看到,而且我没有在 Graphite 中显示新树:
25/03/2015 14:40:30 :: MetricLineReceiver connection with 127.0.0.1:36388 established
25/03/2015 14:40:30 :: MetricLineReceiver connection with 127.0.0.1:36388 closed cleanly
我已经:“chown -R www-data:www-data /opt/graphite/storage/”
我粘贴了我的配置和日志,但如果您需要什么的话请告诉我。
python 管理.py syncdb:
# cd /opt/graphite/webapp/graphite && python manage.py syncdb
Creating tables ...
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)
carbon-cache.py start :
碳缓存启动:
# /opt/graphite/bin/carbon-cache.py start
Starting carbon-cache (instance a)
netstat :
开放端口 2003:
# netstat -naptu | grep 2003
tcp 0 0 0.0.0.0:2003 0.0.0.0:* LISTEN 28023/python
tcp 0 0 127.0.0.1:44534 127.0.0.1:2003 TIME_WAIT -
tcp 0 0 127.0.0.1:44492 127.0.0.1:2003 TIME_WAIT -
tcp 0 0 127.0.0.1:44525 127.0.0.1:2003 TIME_WAIT -
存储模式.conf:
# cat /opt/graphite/conf/storage-schemas.conf | grep -v '#'
[stats]
pattern = ^stats.*
retentions = 10:2160,60:10080,600:262974
[carbon]
pattern = ^carbon\.
retentions = 60:90d
[default_1min_for_1day]
pattern = .*
retentions = 10s:1d
carbon.conf :
# cat /opt/graphite/conf/carbon.conf | grep -v '#'
[cache]
LOCAL_DATA_DIR = /opt/graphite/storage/whisper/
ENABLE_LOGROTATION = True
USER = www-data
MAX_CACHE_SIZE = inf
MAX_UPDATES_PER_SECOND = 3000
MAX_CREATES_PER_MINUTE = 50
LINE_RECEIVER_INTERFACE = 0.0.0.0
LINE_RECEIVER_PORT = 2003
ENABLE_UDP_LISTENER = False
UDP_RECEIVER_INTERFACE = 0.0.0.0
UDP_RECEIVER_PORT = 2003
PICKLE_RECEIVER_INTERFACE = 0.0.0.0
PICKLE_RECEIVER_PORT = 2004
LOG_LISTENER_CONNECTIONS = True
USE_INSECURE_UNPICKLER = False
CACHE_QUERY_INTERFACE = 0.0.0.0
CACHE_QUERY_PORT = 7002
USE_FLOW_CONTROL = True
LOG_UPDATES = True
LOG_CACHE_HITS = True
LOG_CACHE_QUEUE_SORTS = True
CACHE_WRITE_STRATEGY = sorted
WHISPER_AUTOFLUSH = False
WHISPER_FALLOCATE_CREATE = True
[relay]
LINE_RECEIVER_INTERFACE = 0.0.0.0
LINE_RECEIVER_PORT = 2013
PICKLE_RECEIVER_INTERFACE = 0.0.0.0
PICKLE_RECEIVER_PORT = 2014
LOG_LISTENER_CONNECTIONS = True
RELAY_METHOD = rules
REPLICATION_FACTOR = 1
DESTINATIONS = 127.0.0.1:2004
MAX_DATAPOINTS_PER_MESSAGE = 500
MAX_QUEUE_SIZE = 10000
QUEUE_LOW_WATERMARK_PCT = 0.8
USE_FLOW_CONTROL = True
[aggregator]
LINE_RECEIVER_INTERFACE = 0.0.0.0
LINE_RECEIVER_PORT = 2023
PICKLE_RECEIVER_INTERFACE = 0.0.0.0
PICKLE_RECEIVER_PORT = 2024
LOG_LISTENER_CONNECTIONS = True
FORWARD_ALL = False
DESTINATIONS = 127.0.0.1:2004
REPLICATION_FACTOR = 1
MAX_QUEUE_SIZE = 10000
USE_FLOW_CONTROL = True
MAX_DATAPOINTS_PER_MESSAGE = 500
MAX_AGGREGATION_INTERVALS = 5
local_settings.py :
# cat local_settings.py | grep -v '#'
SECRET_KEY = 'xxxxxxxxxxxxxxxxx'
ALLOWED_HOSTS = [ 'xxxxxxxxxxxxxxxxx' ]
TIME_ZONE = 'Europe/Paris'
LOG_RENDERING_PERFORMANCE = True
LOG_CACHE_PERFORMANCE = True
LOG_METRIC_ACCESS = True
DEBUG = False
GRAPHITE_ROOT = '/opt/graphite'
metrics.json:
# cat /etc/sensu/conf.d/metrics.json
{
"checks": {
"vmstat_metrics": {
"type": "metric",
"handlers": ["graphite_line_tcp"],
"command": "/etc/sensu/plugins/vmstat-metrics.rb --scheme stats.:::name:::",
"interval": 60,
"subscribers": [ "xxxxxxxxxxxxxxxxx" ]
}
}
}
中继.json:
# cat /etc/sensu/conf.d/relay.json
{
"handlers": {
"graphite_line_tcp": {
"type": "tcp",
"socket": {
"host": "127.0.0.1",
"port": 2003
}
}
}
}
chown:
# ls -la /opt/graphite/storage/
total 100
drwxr-xr-x 6 www-data www-data 4096 mars 25 14:44 .
drwxr-xr-x 8 root root 4096 mars 25 12:57 ..
-rw-r--r-- 1 root root 5 mars 25 14:44 carbon-cache-a.pid
-rw-r--r-- 1 www-data www-data 69632 mars 25 13:20 graphite.db
-rw-r--r-- 1 www-data www-data 0 mars 25 13:03 index
drwxr-xr-x 2 www-data www-data 4096 mars 25 12:55 lists
drwxr-xr-x 4 www-data www-data 4096 mars 25 13:12 log
drwxr-xr-x 2 www-data www-data 4096 mars 25 12:55 rrd
drwxr-xr-x 4 www-data www-data 4096 mars 25 14:25 whisper
# ls -la /opt/graphite/storage/whisper/
total 16
drwxr-xr-x 4 www-data www-data 4096 mars 25 14:25 .
drwxr-xr-x 6 www-data www-data 4096 mars 25 14:44 ..
drwxr-xr-x 3 www-data www-data 4096 mars 25 13:13 carbon
drwxr-xr-x 2 www-data www-data 4096 mars 25 14:25 test
日志:
# tail -f /opt/graphite/storage/log/carbon-cache/carbon-cache-a/*
==> /opt/graphite/storage/log/carbon-cache/carbon-cache-a/console.log <==
25/03/2015 14:32:17 :: Log opened.
25/03/2015 14:32:17 :: twistd 15.0.0 (/usr/bin/python 2.7.3) starting up.
25/03/2015 14:32:17 :: reactor class: twisted.internet.epollreactor.EPollReactor.
25/03/2015 14:32:17 :: ServerFactory starting on 2003
25/03/2015 14:32:17 :: Starting factory <twisted.internet.protocol.ServerFactory instance at 0x2b0ccf8>
25/03/2015 14:32:17 :: ServerFactory starting on 2004
25/03/2015 14:32:17 :: Starting factory <twisted.internet.protocol.ServerFactory instance at 0x2b08b48>
25/03/2015 14:32:17 :: ServerFactory starting on 7002
25/03/2015 14:32:17 :: Starting factory <twisted.internet.protocol.ServerFactory instance at 0x2b084d0>
25/03/2015 14:32:17 :: set uid/gid 33/33
==> /opt/graphite/storage/log/carbon-cache/carbon-cache-a/creates.log <==
25/03/2015 13:13:56 :: creating database file /opt/graphite/storage/whisper/carbon/agents/testauto-558-a/updateOperations.wsp (archive=[(60, 129600)] xff=0.3 agg=average)
25/03/2015 13:20:45 :: new metric carbon.agents.testauto-558-a.avgUpdateTime matched schema carbon
25/03/2015 13:20:45 :: new metric carbon.agents.testauto-558-a.avgUpdateTime matched aggregation schema default_average
25/03/2015 13:20:45 :: creating database file /opt/graphite/storage/whisper/carbon/agents/testauto-558-a/avgUpdateTime.wsp (archive=[(60, 129600)] xff=0.3 agg=average)
25/03/2015 13:20:45 :: new metric carbon.agents.testauto-558-a.pointsPerUpdate matched schema carbon
25/03/2015 13:20:45 :: new metric carbon.agents.testauto-558-a.pointsPerUpdate matched aggregation schema default_average
25/03/2015 13:20:45 :: creating database file /opt/graphite/storage/whisper/carbon/agents/testauto-558-a/pointsPerUpdate.wsp (archive=[(60, 129600)] xff=0.3 agg=average)
25/03/2015 14:25:23 :: new metric test.first matched schema default_1min_for_1day
25/03/2015 14:25:23 :: new metric test.first matched aggregation schema default_average
25/03/2015 14:25:23 :: creating database file /opt/graphite/storage/whisper/test/first.wsp (archive=[(10, 8640)] xff=0.3 agg=average)
==> /opt/graphite/storage/log/carbon-cache/carbon-cache-a/listener.log <==
25/03/2015 14:40:01 :: MetricLineReceiver connection with 127.0.0.1:35806 established
25/03/2015 14:40:01 :: MetricLineReceiver connection with 127.0.0.1:35806 closed cleanly
25/03/2015 14:40:01 :: MetricLineReceiver connection with 127.0.0.1:35808 established
25/03/2015 14:40:01 :: MetricLineReceiver connection with 127.0.0.1:35808 closed cleanly
25/03/2015 14:40:19 :: MetricLineReceiver connection with 127.0.0.1:36181 established
25/03/2015 14:40:19 :: MetricLineReceiver connection with 127.0.0.1:36181 closed cleanly
25/03/2015 14:40:19 :: MetricLineReceiver connection with 127.0.0.1:36185 established
25/03/2015 14:40:19 :: MetricLineReceiver connection with 127.0.0.1:36185 closed cleanly
25/03/2015 14:40:30 :: MetricLineReceiver connection with 127.0.0.1:36388 established
25/03/2015 14:40:30 :: MetricLineReceiver connection with 127.0.0.1:36388 closed cleanly
==> /opt/graphite/storage/log/carbon-cache/carbon-cache-a/query.log <==
25/03/2015 14:12:32 :: [127.0.0.1:50253] cache query for "carbon.agents.testauto-558-a.avgUpdateTime" returned 0 values
25/03/2015 14:12:32 :: [127.0.0.1:50253] cache query for "carbon.agents.testauto-558-a.cpuUsage" returned 0 values
25/03/2015 14:12:32 :: [127.0.0.1:50253] cache query for "carbon.agents.testauto-558-a.blacklistMatches" returned 0 values
25/03/2015 14:12:32 :: [127.0.0.1:50253] cache query for "carbon.agents.testauto-558-a.committedPoints" returned 0 values
25/03/2015 14:13:07 :: 127.0.0.1:50240 disconnected
25/03/2015 14:15:11 :: 127.0.0.1:50253 disconnected
25/03/2015 14:15:16 :: 127.0.0.1:51951 disconnected
25/03/2015 14:25:44 :: 127.0.0.1:40517 connected
25/03/2015 14:25:44 :: [127.0.0.1:40517] cache query for "test.first" returned 0 values
25/03/2015 14:27:44 :: 127.0.0.1:40517 disconnected
==> /opt/graphite/storage/log/carbon-cache/carbon-cache-a/updates.log <==
25/03/2015 14:40:18 :: wrote 1 datapoints for carbon.agents.testauto-558-a.errors in 0.00007 seconds
25/03/2015 14:40:18 :: wrote 1 datapoints for carbon.agents.testauto-558-a.pointsPerUpdate in 0.00006 seconds
25/03/2015 14:40:18 :: wrote 1 datapoints for carbon.agents.testauto-558-a.cache.queries in 0.00007 seconds
25/03/2015 14:40:18 :: wrote 1 datapoints for carbon.agents.testauto-558-a.blacklistMatches in 0.00006 seconds
25/03/2015 14:40:18 :: wrote 1 datapoints for carbon.agents.testauto-558-a.cache.bulk_queries in 0.00007 seconds
25/03/2015 14:40:18 :: wrote 1 datapoints for carbon.agents.testauto-558-a.metricsReceived in 0.00007 seconds
25/03/2015 14:40:18 :: wrote 1 datapoints for carbon.agents.testauto-558-a.cache.size in 0.00007 seconds
25/03/2015 14:40:18 :: wrote 1 datapoints for carbon.agents.testauto-558-a.cache.queues in 0.00007 seconds
25/03/2015 14:40:18 :: wrote 1 datapoints for carbon.agents.testauto-558-a.memUsage in 0.00006 seconds
25/03/2015 14:40:18 :: wrote 1 datapoints for carbon.agents.testauto-558-a.updateOperations in 0.00007 seconds