Sign inSign up

yehudayefet/memcached-stats

By yehudayefet

•Updated about 8 years ago

This docker image is intended for end users that want to push Memcached Statistics to Elasticsearch.

Image
0

100K+

yehudayefet/memcached-stats repository overview

This docker image is intended for end users that want to push Memcached Statistics to Elasticsearch. These statistics can be plotted, graphed, and added to dashboards for real-time stats in Kibana (for example).

##Requirements:

  • Memcached instance
  • Elasticsearch Instance

Docker image is expecting the following Environment Variables to be set during startup: $MEMCACHED_HOST $MEMCACHED_PORT $ES_HOST $ES_HOST

For kubernetes deployments, it is helpful to run this container as a CronJob that executes every 1 minute:

apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: memcached-stats
spec:
  schedule: "*/1 * * * *"
  jobTemplate:
    spec:
      template:
        spec:
          containers:
          - name: memcached-stats
            image: yehudayefet/memcached-stats
            env:
             - name: MEMCACHED_HOST
               value: "name-of-memcached-service.default.svc.cluster.local"
             - name: MEMCACHED_PORT
               value: "6379"
             - name: ES_HOST
               value: "name-of-elasticsearch-logging-service.kube-system.svc.cluster.local"
             - name: ES_PORT
               value: "9200"
          restartPolicy: OnFailure

##Adding Field Types and Time Field in Elasticsearch:

Note: this long one liner will add types to all memcached fields in the index. This should be run before the container is executed.

curl -X DELETE "http://[your_elasticsearch_ip]:9200/memcached" && \
JSON_DATA="{\"mappings\": {\"stats\": {\"properties\": {\"time\": {\"type\": \"date\",\"format\": \"epoch_second\"},\"accepting_conns\": {\"type\": \"long\"},\"auth_cmds\": {\"type\": \"long\"},\"auth_errors\": {\"type\": \"long\"},\"bytes\": {\"type\": \"long\"},\"bytes_read\": {\"type\": \"long\"},\"bytes_written\": {\"type\": \"long\"},\"cas_hits\": {\"type\": \"long\"},\"cas_misses\": {\"type\": \"long\"},\"cmd_flush\": {\"type\": \"long\"},\"cmd_get\": {\"type\": \"long\"},\"cmd_set\": {\"type\": \"long\"},\"cmd_touch\": {\"type\": \"long\"},\"conn_yields\": {\"type\": \"long\"},\"connection_structures\": {\"type\": \"long\"},\"crawler_items_checked\": {\"type\": \"long\"},\"crawler_reclaimed\": {\"type\": \"long\"},\"curr_connections\": {\"type\": \"long\"},\"curr_items\": {\"type\": \"long\"},\"decr_hits\": {\"type\": \"long\"},\"decr_misses\": {\"type\": \"long\"},\"delete_hits\": {\"type\": \"long\"},\"delete_misses\": {\"type\": \"long\"},\"evicted_unfetched\": {\"type\": \"long\"},\"evictions\": {\"type\": \"long\"},\"expired_unfetched\": {\"type\": \"long\"},\"get_expired\": {\"type\": \"long\"},\"get_flushed\": {\"type\": \"long\"},\"get_hits\": {\"type\": \"long\"},\"get_misses\": {\"type\": \"long\"},\"hash_bytes\": {\"type\": \"long\"},\"hash_is_expanding\": {\"type\": \"long\"},\"hash_power_level\": {\"type\": \"long\"},\"incr_hits\": {\"type\": \"long\"},\"incr_misses\": {\"type\": \"long\"},\"limit_maxbytes\": {\"type\": \"long\"},\"listen_disabled_num\": {\"type\": \"long\"},\"log_watcher_sent\": {\"type\": \"long\"},\"log_watcher_skipped\": {\"type\": \"long\"},\"log_worker_dropped\": {\"type\": \"long\"},\"log_worker_written\": {\"type\": \"long\"},\"lrutail_reflocked\": {\"type\": \"long\"},\"malloc_fails\": {\"type\": \"long\"},\"pid\": {\"type\": \"long\"},\"pointer_size\": {\"type\": \"long\"},\"reclaimed\": {\"type\": \"long\"},\"reserved_fds\": {\"type\": \"long\"},\"rusage_system\": {\"type\": \"float\"},\"rusage_user\": {\"type\": \"float\"},\"threads\": {\"type\": \"long\"},\"time_in_listen_disabled_us\": {\"type\": \"long\"},\"total_connections\": {\"type\": \"long\"},\"total_items\": {\"type\": \"long\"},\"touch_hits\": {\"type\": \"long\"},\"touch_misses\": {\"type\": \"long\"},\"uptime\": {\"type\": \"long\"}}}}}"  && \
curl -X PUT -H "Content-Type: application/json" -H "Cache-Control: no-cache" -d "$JSON_DATA" "http://[your_elasticsearch_ip]:9200/memcached"

Tag summary

Content type

Image

Digest

Size

20.8 MB

Last updated

about 8 years ago

docker pull yehudayefet/memcached-stats