Permalink
Browse files

Inital Commit

  • Loading branch information...
1 parent 89ee249 commit 8cdc3aa9e4269a3a6911977e01706c573cebcfd5 @kumarnitin kumarnitin committed Jun 8, 2012
Showing with 33,021 additions and 0 deletions.
  1. BIN design/redislive.png
  2. +8 −0 redislive.sublime-project
  3. +896 −0 redislive.sublime-workspace
  4. BIN src/.DS_Store
  5. 0 src/__init__.py
  6. BIN src/api/.DS_Store
  7. 0 src/api/__init__.py
  8. BIN src/api/controller/.DS_Store
  9. +120 −0 src/api/controller/BaseController.py
  10. +9 −0 src/api/controller/BaseStaticFileHandler.py
  11. +52 −0 src/api/controller/CommandsController.py
  12. +86 −0 src/api/controller/InfoController.py
  13. +34 −0 src/api/controller/KeySpaceController.py
  14. +18 −0 src/api/controller/KeysController.py
  15. +52 −0 src/api/controller/MemoryController.py
  16. +38 −0 src/api/controller/ReadWriteController.py
  17. +24 −0 src/api/controller/ServerListController.py
  18. +36 −0 src/api/controller/TopCommandsController.py
  19. +36 −0 src/api/controller/TopKeysController.py
  20. 0 src/api/controller/__init__.py
  21. +39 −0 src/api/util/RDP.py
  22. 0 src/api/util/__init__.py
  23. +4 −0 src/config.ini
  24. 0 src/dataprovider/__init__.py
  25. +278 −0 src/dataprovider/redisprovider.py
  26. +189 −0 src/dataprovider/sqliteprovider.py
  27. BIN src/db/redislive.sqlite
  28. BIN src/dump.rdb
  29. +34 −0 src/main.py
  30. +32 −0 src/redis_fill_data.py
  31. +32 −0 src/redis_fill_data2.py
  32. +198 −0 src/redis_monitor.py
  33. BIN src/www/.DS_Store
  34. BIN src/www/images/logo.png
  35. +364 −0 src/www/index.html
  36. BIN src/www/js/.DS_Store
  37. +128 −0 src/www/js/app.js
  38. BIN src/www/js/libs/.DS_Store
  39. BIN src/www/js/libs/backbone/.DS_Store
  40. +38 −0 src/www/js/libs/backbone/backbone-min.js
  41. +34 −0 src/www/js/libs/bootstrap/.gitignore
  42. +176 −0 src/www/js/libs/bootstrap/LICENSE
  43. +63 −0 src/www/js/libs/bootstrap/Makefile
  44. +122 −0 src/www/js/libs/bootstrap/README.md
  45. BIN src/www/js/libs/bootstrap/docs/assets/bootstrap.zip
  46. +686 −0 src/www/js/libs/bootstrap/docs/assets/css/bootstrap-responsive.css
  47. +3,990 −0 src/www/js/libs/bootstrap/docs/assets/css/bootstrap.css
  48. +845 −0 src/www/js/libs/bootstrap/docs/assets/css/docs.css
  49. BIN src/www/js/libs/bootstrap/docs/assets/ico/apple-touch-icon-114-precomposed.png
  50. BIN src/www/js/libs/bootstrap/docs/assets/ico/apple-touch-icon-57-precomposed.png
  51. BIN src/www/js/libs/bootstrap/docs/assets/ico/apple-touch-icon-72-precomposed.png
  52. BIN src/www/js/libs/bootstrap/docs/assets/ico/favicon.ico
  53. BIN src/www/js/libs/bootstrap/docs/assets/img/bird.png
  54. BIN src/www/js/libs/bootstrap/docs/assets/img/bootstrap-mdo-sfmoma-01.jpg
  55. BIN src/www/js/libs/bootstrap/docs/assets/img/bootstrap-mdo-sfmoma-02.jpg
  56. BIN src/www/js/libs/bootstrap/docs/assets/img/bootstrap-mdo-sfmoma-03.jpg
  57. BIN src/www/js/libs/bootstrap/docs/assets/img/browsers.png
  58. BIN src/www/js/libs/bootstrap/docs/assets/img/example-sites/fleetio.png
  59. BIN src/www/js/libs/bootstrap/docs/assets/img/example-sites/jshint.png
  60. BIN src/www/js/libs/bootstrap/docs/assets/img/example-sites/kippt.png
  61. BIN src/www/js/libs/bootstrap/docs/assets/img/example-sites/soundready.png
  62. BIN src/www/js/libs/bootstrap/docs/assets/img/examples/bootstrap-example-fluid.jpg
  63. BIN src/www/js/libs/bootstrap/docs/assets/img/examples/bootstrap-example-hero.jpg
  64. BIN src/www/js/libs/bootstrap/docs/assets/img/examples/bootstrap-example-starter.jpg
  65. BIN src/www/js/libs/bootstrap/docs/assets/img/github-16px.png
  66. BIN src/www/js/libs/bootstrap/docs/assets/img/glyphicons-halflings-white.png
  67. BIN src/www/js/libs/bootstrap/docs/assets/img/glyphicons-halflings.png
  68. BIN src/www/js/libs/bootstrap/docs/assets/img/glyphicons/glyphicons_009_magic.png
  69. BIN src/www/js/libs/bootstrap/docs/assets/img/glyphicons/glyphicons_042_group.png
  70. BIN src/www/js/libs/bootstrap/docs/assets/img/glyphicons/glyphicons_079_podium.png
  71. BIN src/www/js/libs/bootstrap/docs/assets/img/glyphicons/glyphicons_082_roundabout.png
  72. BIN src/www/js/libs/bootstrap/docs/assets/img/glyphicons/glyphicons_155_show_thumbnails.png
  73. BIN src/www/js/libs/bootstrap/docs/assets/img/glyphicons/glyphicons_163_iphone.png
  74. BIN src/www/js/libs/bootstrap/docs/assets/img/glyphicons/glyphicons_214_resize_small.png
  75. BIN src/www/js/libs/bootstrap/docs/assets/img/glyphicons/glyphicons_266_book_open.png
  76. BIN src/www/js/libs/bootstrap/docs/assets/img/grid-18px-masked.png
  77. BIN src/www/js/libs/bootstrap/docs/assets/img/icon-css3.png
  78. BIN src/www/js/libs/bootstrap/docs/assets/img/icon-github.png
  79. BIN src/www/js/libs/bootstrap/docs/assets/img/icon-html5.png
  80. BIN src/www/js/libs/bootstrap/docs/assets/img/icon-twitter.png
  81. BIN src/www/js/libs/bootstrap/docs/assets/img/less-logo-large.png
  82. BIN src/www/js/libs/bootstrap/docs/assets/img/less-small.png
  83. BIN src/www/js/libs/bootstrap/docs/assets/img/responsive-illustrations.png
  84. +106 −0 src/www/js/libs/bootstrap/docs/assets/js/README.md
  85. +180 −0 src/www/js/libs/bootstrap/docs/assets/js/application.js
  86. +94 −0 src/www/js/libs/bootstrap/docs/assets/js/bootstrap-alert.js
  87. +100 −0 src/www/js/libs/bootstrap/docs/assets/js/bootstrap-button.js
  88. +161 −0 src/www/js/libs/bootstrap/docs/assets/js/bootstrap-carousel.js
  89. +138 −0 src/www/js/libs/bootstrap/docs/assets/js/bootstrap-collapse.js
  90. +92 −0 src/www/js/libs/bootstrap/docs/assets/js/bootstrap-dropdown.js
  91. +210 −0 src/www/js/libs/bootstrap/docs/assets/js/bootstrap-modal.js
  92. +95 −0 src/www/js/libs/bootstrap/docs/assets/js/bootstrap-popover.js
  93. +125 −0 src/www/js/libs/bootstrap/docs/assets/js/bootstrap-scrollspy.js
  94. +130 −0 src/www/js/libs/bootstrap/docs/assets/js/bootstrap-tab.js
  95. +270 −0 src/www/js/libs/bootstrap/docs/assets/js/bootstrap-tooltip.js
  96. +51 −0 src/www/js/libs/bootstrap/docs/assets/js/bootstrap-transition.js
  97. +271 −0 src/www/js/libs/bootstrap/docs/assets/js/bootstrap-typeahead.js
  98. +1,726 −0 src/www/js/libs/bootstrap/docs/assets/js/bootstrap.js
  99. +6 −0 src/www/js/libs/bootstrap/docs/assets/js/bootstrap.min.js
  100. +30 −0 src/www/js/libs/bootstrap/docs/assets/js/google-code-prettify/prettify.css
  101. +28 −0 src/www/js/libs/bootstrap/docs/assets/js/google-code-prettify/prettify.js
  102. +9,252 −0 src/www/js/libs/bootstrap/docs/assets/js/jquery.js
  103. +1,688 −0 src/www/js/libs/bootstrap/docs/base-css.html
  104. +1,942 −0 src/www/js/libs/bootstrap/docs/components.html
  105. +437 −0 src/www/js/libs/bootstrap/docs/download.html
  106. +145 −0 src/www/js/libs/bootstrap/docs/examples.html
  107. +151 −0 src/www/js/libs/bootstrap/docs/examples/fluid.html
  108. +108 −0 src/www/js/libs/bootstrap/docs/examples/hero.html
  109. +78 −0 src/www/js/libs/bootstrap/docs/examples/starter-template.html
  110. +256 −0 src/www/js/libs/bootstrap/docs/index.html
  111. +1,493 −0 src/www/js/libs/bootstrap/docs/javascript.html
  112. +790 −0 src/www/js/libs/bootstrap/docs/less.html
  113. +673 −0 src/www/js/libs/bootstrap/docs/scaffolding.html
  114. +132 −0 src/www/js/libs/bootstrap/docs/templates/layout.mustache
  115. +1,574 −0 src/www/js/libs/bootstrap/docs/templates/pages/base-css.mustache
  116. +1,828 −0 src/www/js/libs/bootstrap/docs/templates/pages/components.mustache
Sorry, we could not display the entire diff because it was too big.
View
BIN design/redislive.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
8 redislive.sublime-project
@@ -0,0 +1,8 @@
+{
+ "folders":
+ [
+ {
+ "path": "src"
+ }
+ ]
+}
View
896 redislive.sublime-workspace
@@ -0,0 +1,896 @@
+{
+ "auto_complete":
+ {
+ "selected_items":
+ [
+ [
+ "tim",
+ "timePeriodsKey"
+ ],
+ [
+ "memo",
+ "memory"
+ ],
+ [
+ "key",
+ "keyname"
+ ],
+ [
+ "to",
+ "TopKeysController (class)"
+ ],
+ [
+ "re",
+ "render"
+ ],
+ [
+ "lo",
+ "log"
+ ],
+ [
+ "en",
+ "enableTimer"
+ ],
+ [
+ "up",
+ "UpdateModel"
+ ],
+ [
+ "u",
+ "UpdateModel"
+ ],
+ [
+ "ti",
+ "timedelta (class)"
+ ],
+ [
+ "redis",
+ "redisClient"
+ ],
+ [
+ "mi",
+ "minutes"
+ ],
+ [
+ "da",
+ "days (variable)"
+ ],
+ [
+ "min",
+ "minute"
+ ],
+ [
+ "gro",
+ "groupBy"
+ ],
+ [
+ "memory",
+ "memoryData"
+ ],
+ [
+ "get",
+ "get_argument"
+ ],
+ [
+ "red",
+ "redisInfo"
+ ],
+ [
+ "ser",
+ "serverList"
+ ],
+ [
+ "st",
+ "stop (function)"
+ ],
+ [
+ "mon",
+ "monitor"
+ ],
+ [
+ "sock",
+ "sockets"
+ ],
+ [
+ "redi",
+ "redisServer"
+ ],
+ [
+ "cur",
+ "current_current"
+ ],
+ [
+ "cu",
+ "current_max"
+ ],
+ [
+ "curr",
+ "current_item"
+ ],
+ [
+ "datetime",
+ "datetime"
+ ],
+ [
+ "char",
+ "chartData"
+ ],
+ [
+ "add",
+ "addRows"
+ ],
+ [
+ "time",
+ "timeofday"
+ ],
+ [
+ "data",
+ "dataTable"
+ ],
+ [
+ "from",
+ "fromDate"
+ ],
+ [
+ "sa",
+ "SaveMonitorCommand (function)"
+ ],
+ [
+ "tr",
+ "try Try/Except"
+ ],
+ [
+ "date",
+ "datetime (class)"
+ ],
+ [
+ "if",
+ "ifmain if __name__ == '__main__'"
+ ],
+ [
+ "fun",
+ "function"
+ ],
+ [
+ "mod",
+ "memory-widget-template"
+ ],
+ [
+ "mode",
+ "memory-widget-placeholder"
+ ],
+ [
+ "v",
+ "View"
+ ],
+ [
+ "i",
+ "initialize"
+ ],
+ [
+ "m",
+ "Model"
+ ],
+ [
+ "inf",
+ "InfoHandler"
+ ],
+ [
+ "r",
+ "redisHost"
+ ],
+ [
+ "rand",
+ "randomnumber"
+ ],
+ [
+ "info",
+ "info-widget-template"
+ ],
+ [
+ "ta",
+ "table-bordered"
+ ],
+ [
+ "table",
+ "table-condensed"
+ ],
+ [
+ "view",
+ "viewHolder"
+ ],
+ [
+ "fn",
+ "function"
+ ]
+ ]
+ },
+ "buffers":
+ [
+ {
+ "file": "src/main.py",
+ "settings":
+ {
+ "buffer_size": 1279,
+ "line_ending": "Unix"
+ }
+ },
+ {
+ "file": "src/dataprovider/redisprovider.py",
+ "settings":
+ {
+ "buffer_size": 6999,
+ "line_ending": "Unix"
+ }
+ }
+ ],
+ "build_system": "Packages/Python/Python.sublime-build",
+ "command_palette":
+ {
+ "height": 94.0,
+ "selected_items":
+ [
+ [
+ "close",
+ "Project: Close"
+ ],
+ [
+ "project",
+ "Project: Close"
+ ],
+ [
+ "browse",
+ "Preferences: Browse Packages"
+ ],
+ [
+ "forma",
+ "Format: Javascript"
+ ],
+ [
+ "remove",
+ "Package Control: Remove Package"
+ ],
+ [
+ "install",
+ "Package Control: Install Package"
+ ],
+ [
+ "form",
+ "Format: Javascript"
+ ],
+ [
+ "install page",
+ "Package Control: Install Package"
+ ],
+ [
+ "instal",
+ "Package Control: Install Package"
+ ],
+ [
+ "ind",
+ "Preferences: Key Bindings - Default"
+ ],
+ [
+ "snip",
+ "Snippet: Function"
+ ],
+ [
+ "insta",
+ "Package Control: Install Package"
+ ],
+ [
+ "for",
+ "Format: Javascript"
+ ],
+ [
+ "format",
+ "Format: Javascript"
+ ],
+ [
+ "Snippet: ",
+ "Snippet: <?php echo $this->… ?>"
+ ],
+ [
+ "package",
+ "Preferences: Browse Packages"
+ ],
+ [
+ "Fetch",
+ "Fetch"
+ ],
+ [
+ "fetch",
+ "Fetch: Manage remote files"
+ ],
+ [
+ "Fetc",
+ "Fetch: Manage remote files"
+ ],
+ [
+ "Fet",
+ "Fetch"
+ ],
+ [
+ "fet",
+ "Fetch"
+ ],
+ [
+ "fetc",
+ "Fetch: Manage remote files"
+ ],
+ [
+ "jsh",
+ "JSHint"
+ ],
+ [
+ "plug",
+ "Package Control: Upgrade/Overwrite All Packages"
+ ],
+ [
+ "prefer",
+ "Preferences: Settings - Default"
+ ],
+ [
+ "install pa",
+ "Package Control: Install Package"
+ ],
+ [
+ "html",
+ "Tidy HTML"
+ ]
+ ],
+ "width": 561.0
+ },
+ "console":
+ {
+ "height": 227.0
+ },
+ "distraction_free":
+ {
+ "menu_visible": true,
+ "show_minimap": false,
+ "show_open_files": false,
+ "show_tabs": false,
+ "side_bar_visible": false,
+ "status_bar_visible": false
+ },
+ "file_history":
+ [
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/redis_monitor.py",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/www/js/app.js",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/api/controller/BaseController.py",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/config.ini",
+ "/Users/nk/Library/Application Support/Sublime Text 2/Packages/User/Preferences.sublime-settings",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/redis_fill_data.py",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/redis_fill_data2.py",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/main.py",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/dataprovider/sqliteprovider.py",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/dataprovider/sqlite.py",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/dataprovider/redis.py",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/www/js/views/top-commands-widget-view.js",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/www/js/views/top-keys-widget-view.js",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/api/controller/KeysController.py",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/api/controller/CommandsController.py",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/www/js/views/readwrite-widget-view.js",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/api/controller/MemoryController.py",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/api/controller/TopCommandsController.py",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/www/index.html",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/www/js/views/keyspace-widget-view.js",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/www/js/views/base-widget-view.js",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/www/js/models/top-keys-widget-model.js",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/api/controller/TopKeysController.py",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/www/js/views/memory-widget-view.js",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/www/js/views/commands-widget-view.js",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/www/js/views/info-widget-view.js",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/issues_faced.txt",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/www/js/views/keys-widget-view.js",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/api/controller/ReadWriteController.py",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/api/controller/InfoController.py",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/api/controller/KeySpaceController.py",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/www/js/models/top-commands-widget-model.js",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/www/js/models/commands-widget-model.js",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/www/js/models/memory-widget-model.js",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/www/js/models/commands-widget-view.js",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/www/js/models/info-widget-model.js",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/www/js/models/serverlist-model.js",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/api/controller/ServerListController.py",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/www/js/views/serverlist-view.js",
+ "/Library/Python/2.7/site-packages/tornado/__init__.py",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/__init__.py",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/www/js/models/readwrite-widget-model.js",
+ "/Library/Python/2.7/site-packages/tornado/iostream.py",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/redis_info.py",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/redis_base.py",
+ "/Users/nk/Dropbox/Dropquest 2012/38645.txt",
+ "/Users/nitin/Dropbox/RedisLive/RedisLive/src/main.py",
+ "/Users/nitin/Dropbox/RedisLive/RedisLive/src/www/index.html",
+ "/Users/nitin/Dropbox/RedisLive/RedisLive/src/redis_monitor.py",
+ "/Users/nitin/Dropbox/RedisLive/RedisLive/src/redis_info.py",
+ "/Users/nitin/Dropbox/RedisLive/RedisLive/src/redis_fill_data.py",
+ "/Users/nitin/Dropbox/RedisLive/RedisLive/src/issues_faced.txt",
+ "/Users/nitin/Dropbox/RedisLive/RedisLive/src/api/controller/BaseController.py",
+ "/Users/nitin/Dropbox/RedisLive/RedisLive/src/www/js/views/memory-widget-view.js",
+ "/Users/nitin/Dropbox/RedisLive/RedisLive/src/www/js/views/base-widget-view.js",
+ "/Users/nitin/Dropbox/RedisLive/RedisLive/src/www/js/views/keyspace-widget-view.js",
+ "/Users/nk/Desktop/Ancestory Questions.txt",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/api/util/RDP.py",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/api/RDP.py",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/api/util/__init__.py",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/api/controller/rdp.py",
+ "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/parser.py",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/www/js/libs/bootstrap/less/widget.less",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/www/js/views/memory-widget-view_fixed.js",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/www/js/views/memory-widget-view leak.js",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/www/js/views/keyspace-widget-view_leak.js",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/www/js/models/keyspace-widget-model.js",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/www/js/models/keys-widget-model.js",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/www/js/libs/bootstrap/less/type.less",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/www/js/libs/bootstrap/less/wells.less",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/www/js/libs/bootstrap/less/variables.less",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/www/js/libs/bootstrap/less/tables.less",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/redislive.sublime-project",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/www/js/libs/bootstrap/js/bootstrap-typeahead.js",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/www/js/libs/bootstrap/js/bootstrap-tab.js",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/www/js/libs/bootstrap/js/bootstrap-button.js",
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/www/js/libs/bootstrap/js/bootstrap-alert.js",
+ "/Users/nitin/Desktop/RedisLive/RedisLive/src/api/main.py",
+ "/Users/nitin/Desktop/RedisLive/RedisLive/src/www/index.html",
+ "/Users/nitin/Desktop/RedisLive/RedisLive/src/www/js/views/memory-widget-view.js",
+ "/Users/nitin/Library/Application Support/Sublime Text 2/Packages/Package Control/Package Control.sublime-settings",
+ "/Users/nitin/Library/Application Support/Sublime Text 2/Packages/Default/Default (OSX).sublime-keymap",
+ "/Users/nitin/Library/Application Support/Sublime Text 2/Packages/User/Preferences.sublime-settings",
+ "/Users/nitin/Desktop/RedisLive/RedisLive/src/api/controller/MemorySparklineHandler.py",
+ "/Users/nitin/Desktop/RedisLive/RedisLive/src/www/js/app.js",
+ "/Users/nitin/Desktop/RedisLive/RedisLive/src/www/js/models/info-widget-model.js",
+ "/Users/nitin/Desktop/RedisLive/RedisLive/src/www/js/models/memory-widget-model.js",
+ "/Users/nitin/Desktop/RedisLive/RedisLive/src/www/js/views/info-widget-view.js",
+ "/Users/nitin/Desktop/RedisLive/RedisLive/src/api/controller/InfoHandler.py",
+ "/Users/nitin/Desktop/RedisLive/RedisLive/src/public/index.html",
+ "/Users/nitin/Desktop/RedisLive/RedisLive/src/public/js/app.js",
+ "/Users/nitin/Desktop/RedisLive/RedisLive/src/public/js/views/info-widget-view.js",
+ "/Users/nitin/Desktop/RedisLive/RedisLive/src/www/js/models/memory-wdiget-model.js",
+ "/Users/nitin/Desktop/RedisLive/RedisLive/src/public/js/models/info-widget-model.js",
+ "/Users/nitin/Desktop/RedisLive/RedisLive/src/api/controller/__init__.py",
+ "/Users/nitin/Desktop/RedisLive/RedisLive/redislive.sublime-workspace",
+ "/Users/nitin/Desktop/RedisLive/RedisLive/src/api/__init__.py",
+ "/Library/Python/2.7/site-packages/tornado-2.2-py2.7.egg/tornado/httpserver.py",
+ "/Library/Python/2.7/site-packages/tornado-2.2-py2.7.egg/tornado/iostream.py",
+ "/Library/Python/2.7/site-packages/tornado-2.2-py2.7.egg/tornado/web.py",
+ "/Users/nitin/Desktop/RedisLive/RedisLive/src/api/controller/HelloHandler.py",
+ "/Users/nitin/Desktop/RedisLive/RedisLive/src/js/app.js",
+ "/Users/nitin/Desktop/RedisLive/RedisLive/src/js/views/info-widget-view.js",
+ "/Users/nitin/Desktop/RedisLive/RedisLive/src/js/models/info-widget-model.js",
+ "/Users/nitin/Desktop/RedisLive/RedisLive/src/index.html",
+ "/Users/nitin/:Users:nitin:Library:Application Support:Sublime Text 2:Packages:User:comment.sublime-snippet",
+ "/Users/nitin/Desktop/RedisLive/RedisLive/src/js/views/templates/info-widget-template.js",
+ "/Users/nitin/Desktop/RedisLive/RedisLive/src/js/models/info.js",
+ "/Users/nitin/Desktop/RedisLive/RedisLive/src/js/views/info-widget.js",
+ "/Users/nitin/Library/Application Support/Sublime Text 2/Packages/Default/Preferences.sublime-settings",
+ "/Users/nitin/Library/Application Support/Sublime Text 2/Packages/User/Fetch.sublime-settings",
+ "/Users/nitin/Library/Application Support/Sublime Text 2/Packages/User/Default (OSX).sublime-keymap",
+ "/Users/nitin/Library/Application Support/Sublime Text 2/Packages/User/HTML.sublime-settings",
+ "/Users/nitin/Desktop/RedisLive/RedisLive/src/js/libs/underscore/underscore-min.js",
+ "/Users/nitin/Desktop/RedisLive/RedisLive/src/js/libs/backbone/backbone-min.js",
+ "/Users/nitin/Desktop/RedisLive/RedisLive/redislive.sublime-project",
+ "/Users/nitin/Desktop/RedisLive/RedisLive/src/js/libs/jquery/jquery-1.7.2.min.js",
+ "/Users/nitin/Desktop/RedisLive/RedisLive/home.html",
+ "/Users/nitin/Desktop/RedisLive/RedisLive/README.md",
+ "/Users/nitin/Desktop/cemeteries.json"
+ ],
+ "find":
+ {
+ "height": 35.0
+ },
+ "find_in_files":
+ {
+ "height": 0.0,
+ "where_history":
+ [
+ "/Users/nk/Dropbox/RedisLive/RedisLive/src/www/js/libs/bootstrap/less",
+ ""
+ ]
+ },
+ "find_state":
+ {
+ "case_sensitive": false,
+ "find_history":
+ [
+ "%s.%f",
+ "SaveMemoryInfo",
+ "raw_data",
+ "maximized",
+ ", ",
+ "comm",
+ "info-widget-tem",
+ " }) ",
+ "hr",
+ "date",
+ "date-control-template\n\ndate-control-template",
+ "UTC",
+ "\"></",
+ "info",
+ "fe",
+ "views",
+ ">",
+ "viewHolder",
+ "30",
+ "maxclients",
+ "limit",
+ "ulimit",
+ "connection"
+ ],
+ "highlight": true,
+ "in_selection": false,
+ "preserve_case": false,
+ "regex": false,
+ "replace_history":
+ [
+ "%s",
+ "model.data",
+ ""
+ ],
+ "reverse": false,
+ "show_context": true,
+ "use_buffer2": true,
+ "whole_word": false,
+ "wrap": true
+ },
+ "groups":
+ [
+ {
+ "selected": 1,
+ "sheets":
+ [
+ {
+ "buffer": 0,
+ "file": "src/main.py",
+ "settings":
+ {
+ "buffer_size": 1279,
+ "regions":
+ {
+ },
+ "selection":
+ [
+ [
+ 1211,
+ 1211
+ ]
+ ],
+ "settings":
+ {
+ "syntax": "Packages/Python/Python.tmLanguage",
+ "tab_size": 2,
+ "translate_tabs_to_spaces": true
+ },
+ "translation.x": 0.0,
+ "translation.y": 0.0,
+ "zoom_level": 1.0
+ },
+ "type": "text"
+ },
+ {
+ "buffer": 1,
+ "file": "src/dataprovider/redisprovider.py",
+ "settings":
+ {
+ "buffer_size": 6999,
+ "regions":
+ {
+ },
+ "selection":
+ [
+ [
+ 2172,
+ 2172
+ ]
+ ],
+ "settings":
+ {
+ "syntax": "Packages/Python/Python.tmLanguage",
+ "translate_tabs_to_spaces": false
+ },
+ "translation.x": 0.0,
+ "translation.y": 685.0,
+ "zoom_level": 1.0
+ },
+ "type": "text"
+ }
+ ]
+ }
+ ],
+ "incremental_find":
+ {
+ "height": 0.0
+ },
+ "input":
+ {
+ "height": 31.0
+ },
+ "layout":
+ {
+ "cells":
+ [
+ [
+ 0,
+ 0,
+ 1,
+ 1
+ ]
+ ],
+ "cols":
+ [
+ 0.0,
+ 1.0
+ ],
+ "rows":
+ [
+ 0.0,
+ 1.0
+ ]
+ },
+ "menu_visible": true,
+ "replace":
+ {
+ "height": 64.0
+ },
+ "save_all_on_build": true,
+ "select_file":
+ {
+ "height": 0.0,
+ "selected_items":
+ [
+ [
+ "mai",
+ "main.py"
+ ],
+ [
+ "apps",
+ "www/js/app.js"
+ ],
+ [
+ "con",
+ "config.ini"
+ ],
+ [
+ "basec",
+ "api/controller/BaseController.py"
+ ],
+ [
+ "ma",
+ "main.py"
+ ],
+ [
+ "mon",
+ "redis_monitor.py"
+ ],
+ [
+ "redis.p",
+ "dataprovider/redis.py"
+ ],
+ [
+ "sql",
+ "dataprovider/sqlite.py"
+ ],
+ [
+ "mo",
+ "redis_monitor.py"
+ ],
+ [
+ "redi",
+ "redis_monitor.py"
+ ],
+ [
+ "topco",
+ "www/js/views/top-commands-widget-view.js"
+ ],
+ [
+ "topke",
+ "www/js/views/top-keys-widget-view.js"
+ ],
+ [
+ "fil",
+ "redis_fill_data.py"
+ ],
+ [
+ "keys",
+ "www/js/views/keyspace-widget-view.js"
+ ],
+ [
+ "index",
+ "www/index.html"
+ ],
+ [
+ "top",
+ "api/controller/TopCommandsController.py"
+ ],
+ [
+ "memo",
+ "api/controller/MemoryController.py"
+ ],
+ [
+ "topc",
+ "api/controller/TopCommandsController.py"
+ ],
+ [
+ "com",
+ "api/controller/CommandsController.py"
+ ],
+ [
+ "monitor",
+ "redis_monitor.py"
+ ],
+ [
+ "app",
+ "www/js/app.js"
+ ],
+ [
+ "main",
+ "main.py"
+ ],
+ [
+ "ind",
+ "www/index.html"
+ ],
+ [
+ "fill",
+ "redis_fill_data.py"
+ ],
+ [
+ "moni",
+ "redis_monitor.py"
+ ],
+ [
+ "mem",
+ "www/js/views/memory-widget-view.js"
+ ],
+ [
+ "basew",
+ "www/js/views/base-widget-view.js"
+ ],
+ [
+ "base",
+ "www/js/views/base-widget-view.js"
+ ],
+ [
+ "readw",
+ "www/js/views/readwrite-widget-view.js"
+ ],
+ [
+ "conf",
+ "config.ini"
+ ],
+ [
+ "comma",
+ "www/js/views/commands-widget-view.js"
+ ],
+ [
+ "inde",
+ "www/index.html"
+ ],
+ [
+ "keysp",
+ "api/controller/KeySpaceController.py"
+ ],
+ [
+ "baseco",
+ "api/controller/BaseController.py"
+ ],
+ [
+ "read",
+ "www/js/views/readwrite-widget-view.js"
+ ],
+ [
+ "info",
+ "api/controller/InfoController.py"
+ ],
+ [
+ "m",
+ "main.py"
+ ],
+ [
+ "keysco",
+ "api/controller/KeysController.py"
+ ],
+ [
+ "keyswi",
+ "www/js/views/keys-widget-view.js"
+ ],
+ [
+ "memory",
+ "www/js/views/memory-widget-view.js"
+ ],
+ [
+ "key",
+ "www/js/views/keyspace-widget-view.js"
+ ],
+ [
+ "i",
+ "www/index.html"
+ ],
+ [
+ "server",
+ "www/js/views/serverlist-view.js"
+ ],
+ [
+ "",
+ "www/js/views/base-widget-view.js"
+ ],
+ [
+ "infocon",
+ "api/controller/InfoController.py"
+ ],
+ [
+ "info-w",
+ "www/js/models/info-widget-model.js"
+ ],
+ [
+ "app.",
+ "www/js/app.js"
+ ],
+ [
+ "memory-w",
+ "www/js/views/memory-widget-view.js"
+ ],
+ [
+ "basewid",
+ "www/js/views/base-widget-view.js"
+ ],
+ [
+ "basecon",
+ "api/controller/BaseController.py"
+ ],
+ [
+ "main.",
+ "main.py"
+ ],
+ [
+ "memor",
+ "www/js/views/memory-widget-view.js"
+ ],
+ [
+ "ba",
+ "api/controller/BaseController.py"
+ ],
+ [
+ "memorywi",
+ "www/js/views/memory-widget-view.js"
+ ],
+ [
+ "mm",
+ "www/js/models/memory-widget-model.js"
+ ],
+ [
+ "bas",
+ "api/controller/BaseController.py"
+ ],
+ [
+ "memory.py",
+ "api/controller/MemoryController.py"
+ ],
+ [
+ "widget",
+ "www/js/libs/bootstrap/less/widget.less"
+ ],
+ [
+ "incd",
+ "js/libs/underscore/underscore-min.js"
+ ]
+ ],
+ "width": 0.0
+ },
+ "select_project":
+ {
+ "height": 500.0,
+ "selected_items":
+ [
+ ],
+ "width": 380.0
+ },
+ "show_minimap": true,
+ "show_open_files": true,
+ "show_tabs": true,
+ "side_bar_visible": false,
+ "side_bar_width": 293.0,
+ "status_bar_visible": true
+}
View
BIN src/.DS_Store
Binary file not shown.
View
0 src/__init__.py
No changes.
View
BIN src/api/.DS_Store
Binary file not shown.
View
0 src/api/__init__.py
No changes.
View
BIN src/api/controller/.DS_Store
Binary file not shown.
View
120 src/api/controller/BaseController.py
@@ -0,0 +1,120 @@
+import tornado.ioloop
+import tornado.web
+import redis
+import re
+import dateutil.parser
+
+#from dataprovider.sqliteprovider import RedisStatsProvider
+from dataprovider.redisprovider import RedisStatsProvider
+
+from api.util.RDP import rdp
+
+class BaseController(tornado.web.RequestHandler):
+
+ statsProvider = RedisStatsProvider()
+
+ def DateTimeToList(self, datetime):
+ parsedDate = dateutil.parser.parse(datetime)
+ return [ parsedDate.year, parsedDate.month, parsedDate.day, parsedDate.hour, parsedDate.minute, parsedDate.second ]
+
+ def AverageData(self,data):
+ # data = [("2012-05-06 19:00:00",100,100),
+ # ("2012-05-06 19:01:00",300,100),
+ # #("2012-05-06 19:01:10",-100,100),
+ # ("2012-05-06 19:01:20",350,100),
+ # ("2012-05-06 19:01:21",330,100),
+ # ("2012-05-06 19:01:22",590,100),
+ # ("2012-05-06 19:01:29",190,100),
+ # ("2012-05-06 19:03:00",300,100),
+ # ("2012-05-06 19:04:00",300,100),
+ # ]
+ average = []
+
+ deviation=1024*1024
+
+ start = dateutil.parser.parse(data[0][0])
+ end = dateutil.parser.parse(data[-1][0])
+ difference = end - start
+ weeks, days = divmod(difference.days, 7)
+ minutes, seconds = divmod(difference.seconds, 60)
+ hours, minutes = divmod(minutes, 60)
+
+ if difference.days > 0:
+ current_max=0
+ current_current=0
+ current_d = 0
+ for dt,maxMemory,currentMemory in data:
+ d = dateutil.parser.parse(dt)
+ if d.day!=current_d:
+ current_d=d.day
+ average.append([dt,maxMemory,currentMemory])
+ current_max=maxMemory
+ current_current=currentMemory
+ else:
+ if maxMemory>current_max or currentMemory>current_current:
+ average.pop()
+ average.append([dt,maxMemory,currentMemory])
+ current_max=maxMemory
+ current_current=currentMemory
+ elif hours > 0:
+ current_max=0
+ current_current=0
+ current = -1
+ keep_flag = False
+ for dt,maxMemory,currentMemory in data:
+ d = dateutil.parser.parse(dt)
+ if d.hour!=current:
+ current=d.hour
+ average.append([dt,maxMemory,currentMemory])
+ current_max=maxMemory
+ current_current=currentMemory
+ keep_flag=False
+ elif abs(maxMemory-current_max)>deviation or abs(currentMemory-current_current)>deviation :
+ #average.pop()
+ average.append([dt,maxMemory,currentMemory])
+ current_max=maxMemory
+ current_current=currentMemory
+ keep_flag=True
+ elif maxMemory>current_max or currentMemory>current_current :
+ if keep_flag!=True:
+ average.pop()
+ average.append([dt,maxMemory,currentMemory])
+ current_max=maxMemory
+ current_current=currentMemory
+ keep_flag=False
+ else:
+ current_max=0
+ current_current=0
+ current_m = -1
+ keep_flag = False
+ for dt,maxMemory,currentMemory in data:
+ d = dateutil.parser.parse(dt)
+ if d.minute!=current_m:
+ current_m=d.minute
+ average.append([dt,maxMemory,currentMemory])
+ current_max=maxMemory
+ current_current=currentMemory
+ keep_flag=False
+ elif abs(maxMemory-current_max)>deviation or abs(currentMemory-current_current)>deviation :
+ #average.pop()
+ average.append([dt,maxMemory,currentMemory])
+ current_max=maxMemory
+ current_current=currentMemory
+ keep_flag=True
+ elif maxMemory>current_max or currentMemory>current_current :
+ if keep_flag!=True:
+ average.pop()
+ average.append([dt,maxMemory,currentMemory])
+ current_max=maxMemory
+ current_current=currentMemory
+ keep_flag=False
+
+
+
+ return average
+
+
+
+
+
+
View
9 src/api/controller/BaseStaticFileHandler.py
@@ -0,0 +1,9 @@
+import tornado.web
+
+class BaseStaticFileHandler(tornado.web.StaticFileHandler):
+ def compute_etag(self):
+ return None
+
+ def get_cache_time(self, path, modified, mime_type):
+ return 20
+
View
52 src/api/controller/CommandsController.py
@@ -0,0 +1,52 @@
+import tornado.ioloop
+import tornado.web
+import random
+import dateutil.parser
+import datetime
+
+from BaseController import BaseController
+
+
+class CommandsController(BaseController):
+
+ def get(self):
+
+ returnData = {
+ "data" : []
+ , "timestamp" : datetime.datetime.now().isoformat()
+ }
+
+ server = self.get_argument("server")
+ fromDate = self.get_argument("from", None)
+ toDate = self.get_argument("to", None)
+
+ if fromDate==None or toDate==None:
+ end = datetime.datetime.now()
+ delta = datetime.timedelta(seconds=120)
+ start = end - delta
+ else:
+ start = dateutil.parser.parse(fromDate)
+ end = dateutil.parser.parse(toDate)
+
+ difference = end - start
+ weeks, days = divmod(difference.days, 7)
+ minutes, seconds = divmod(difference.seconds, 60)
+ hours, minutes = divmod(minutes, 60)
+
+ if difference.days > 0:
+ groupBy = "day"
+ elif hours > 1:
+ groupBy = "hour"
+ elif hours > 0:
+ groupBy = "minute"
+ else:
+ groupBy = "second"
+
+ combinedData = []
+ for data in self.statsProvider.GetCommandStats(server, start, end, groupBy):
+ combinedData.append([ data[1], data[0]])
+
+ for data in combinedData:
+ returnData['data'].append([ self.DateTimeToList(data[0]), data[1]])
+
+ self.write(returnData)
View
86 src/api/controller/InfoController.py
@@ -0,0 +1,86 @@
+import tornado.ioloop
+import tornado.web
+from decimal import *
+import re
+from BaseController import BaseController
+
+
+class InfoController(BaseController):
+ def get(self):
+
+ server = self.get_argument("server")
+
+ #redisInfo = self.redisClient.info()
+ redisInfo = self.statsProvider.GetInfo(server)
+
+ databases=[]
+ for key in sorted(redisInfo.keys()):
+ if key.startswith("db"):
+ database = redisInfo[key]
+ database['name']=key
+ databases.append(database)
+
+ totalKeys=0
+ for database in databases:
+ totalKeys+=database.get("keys")
+
+ if(totalKeys==0):
+ databases=[{"name" : "db0", "keys" : "0", "expires" : "0"}]
+
+ redisInfo['databases'] = databases
+ redisInfo['total_keys']= self.ShortenNumber(totalKeys)
+
+ uptimeSeconds = redisInfo['uptime_in_seconds']
+ redisInfo['uptime'] = self.ShortenTime(uptimeSeconds)
+
+ commandsProcessed = redisInfo['total_commands_processed']
+ redisInfo['total_commands_processed_human'] = self.ShortenNumber(commandsProcessed)
+
+ self.write(redisInfo)
+
+ def ShortenTime(self, number):
+ numberFormat = '{0}'
+ if (number < 60):
+ return str(number) + " sec"
+ elif (number < 3600):
+ num = self.RoundedNumber(number, 60)
+ val = "1h" if num=="60" else num + "m"
+ return val
+ elif (number < 60*60*24):
+ num = self.RoundedNumber(number, 60*60)
+ val = "1d" if num=="24" else num + "h"
+ return val
+ else:
+ num = self.RoundedNumber(number, 60*60*24)
+ val = num + "d"
+ return val
+
+ def ShortenNumber(self, number):
+ numberFormat = '{0}'
+ if (number < 1000):
+ return number
+ elif (number >= 1000 and number < 1000000):
+ num=self.RoundedNumber(number, 1000)
+ val = "1M" if num=="1000" else num + "K"
+ return val
+ elif (number >= 1000000 and number < 1000000000):
+ num=self.RoundedNumber(number, 1000000)
+ val = "1B" if num=="1000" else num + "M"
+ return val
+ elif (number >= 1000000000 and number < 1000000000000):
+ num=self.RoundedNumber(number, 1000000000)
+ val = "1T" if num=="1000" else num + "B"
+ return val
+ else:
+ num=self.RoundedNumber(number, 1000000000000)
+ return num + "T"
+
+ def RoundedNumber(self, number, denominator):
+ rounded = str(round(Decimal(number)/Decimal(denominator), 1))
+ replaceTrailingZero = re.compile('0$')
+ noTrailingZeros = replaceTrailingZero.sub('', rounded)
+ replaceTrailingPeriod = re.compile('\.$')
+ finalNumber = replaceTrailingPeriod.sub('', noTrailingZeros)
+ return finalNumber
+
+
View
34 src/api/controller/KeySpaceController.py
@@ -0,0 +1,34 @@
+import tornado.ioloop
+import tornado.web
+import random
+
+from BaseController import BaseController
+
+
+class KeySpaceController(BaseController):
+
+ def get(self):
+
+ server = self.get_argument("server")
+ fromDate = self.get_argument("from", None)
+ toDate = self.get_argument("to", None)
+
+ returnData = { "data" : [] }
+
+ if fromDate == None or toDate == None:
+ counter = 0
+ for data in self.statsProvider.GetRealTimeMemoryInfo(server):
+ if counter<5:
+ returnData['data'].append([ self.DateTimeToList(data[0]), random.randint(10, 250), random.randint(10, 250)])
+ counter=counter+1
+
+ else:
+ prevMax=0
+ prevCurrent=0
+ counter=0
+ for data in self.statsProvider.GetMemoryInfo(server, fromDate, toDate):
+ if counter==0 or prevCurrent!=data[2] or prevMax!=data[1]:
+ returnData['data'].append([ self.DateTimeToList(data[0]), random.randint(10, 250), random.randint(10, 250)])
+ counter=counter+1
+
+ self.write(returnData)
View
18 src/api/controller/KeysController.py
@@ -0,0 +1,18 @@
+import tornado.ioloop
+import tornado.web
+import random
+
+from BaseController import BaseController
+
+
+class KeysController(BaseController):
+ def get(self):
+ server = self.get_argument("server")
+ fromDate = self.get_argument("from", None)
+ toDate = self.get_argument("to", None)
+ keysInfo = { "data" : [] }
+
+ for data in self.statsProvider.GetRealTimeKeysInfo(server):
+ keysInfo['data'].append(["Expires", data[0]])
+ keysInfo['data'].append(["Persists", data[1]])
+ self.write(keysInfo)
View
52 src/api/controller/MemoryController.py
@@ -0,0 +1,52 @@
+import tornado.ioloop
+import tornado.web
+import random
+import dateutil.parser
+import datetime
+
+from BaseController import BaseController
+
+
+class MemoryController(BaseController):
+
+ def get(self):
+
+ server = self.get_argument("server")
+ fromDate = self.get_argument("from", None)
+ toDate = self.get_argument("to", None)
+
+
+ returnData = {
+ "data" : []
+ , "timestamp" : datetime.datetime.now().isoformat()
+ }
+
+ if fromDate == None or toDate == None:
+ end = datetime.datetime.now()
+ delta = datetime.timedelta(seconds=60)
+ start = end - delta
+ else:
+ start = dateutil.parser.parse(fromDate)
+ end = dateutil.parser.parse(toDate)
+
+ combinedData = []
+ prevMax=0
+ prevCurrent=0
+ counter=0
+ for data in self.statsProvider.GetMemoryInfo(server, start, end):
+ # if counter==0 or prevCurrent!=data[2] or prevMax!=data[1]:
+ # combinedData.append([ data[0], data[1], data[2]])
+ # counter=counter+1
+
+ combinedData.append([ data[0], data[1], data[2]])
+
+
+ #combinedData = self.AverageData(combinedData)
+
+ for data in combinedData:
+ returnData['data'].append([ self.DateTimeToList(data[0]), data[1], data[2]])
+
+ self.write(returnData)
+
+
+
View
38 src/api/controller/ReadWriteController.py
@@ -0,0 +1,38 @@
+import tornado.ioloop
+import tornado.web
+import random
+
+from BaseController import BaseController
+
+
+class ReadWriteController(BaseController):
+
+ def get(self):
+
+ server = self.get_argument("server")
+ fromDate = self.get_argument("from", None)
+ toDate = self.get_argument("to", None)
+
+ returnData = { "data" : [] }
+
+ if fromDate == None or toDate == None:
+ for data in self.statsProvider.GetRealTimeMemoryInfo(server):
+ returnData['data'].append([ self.DateTimeToList(data[0]), random.randint(1, 100), random.randint(1, 100)])
+
+ else:
+ combinedData = []
+ prevMax=0
+ prevCurrent=0
+ counter=0
+ for data in self.statsProvider.GetMemoryInfo(server, fromDate, toDate):
+ if counter==0 or prevCurrent!=data[2] or prevMax!=data[1]:
+ #combinedData.append([ self.DateTimeToList(data[0]), random.randint(10, 250), random.randint(10, 250)])
+ combinedData.append([ data[0], data[1], data[2]])
+ counter=counter+1
+
+ combinedData = self.AverageData(combinedData)
+
+ for data in combinedData:
+ returnData['data'].append([ self.DateTimeToList(data[0]), data[1], data[2]])
+
+ self.write(returnData)
View
24 src/api/controller/ServerListController.py
@@ -0,0 +1,24 @@
+import tornado.ioloop
+import tornado.web
+import random
+
+from BaseController import BaseController
+
+
+class ServerListController(BaseController):
+
+ def get(self):
+ serverList = self.ReadServerConfig()
+ servers = { "servers" : serverList}
+ self.write(servers)
+
+ def ReadServerConfig(self):
+ redisServers = []
+ f = open("config.ini")
+ for line in f:
+ if line[0]=="#":
+ continue
+ parts=line.rstrip('\r\n').split(':')
+ redisServers.append({ "server" : parts[0], "port" : int(parts[1]) , "id" : parts[0] + ":" + parts[1]})
+
+ return redisServers
View
36 src/api/controller/TopCommandsController.py
@@ -0,0 +1,36 @@
+import tornado.ioloop
+import tornado.web
+import random
+import dateutil.parser
+import datetime
+from dateutil.relativedelta import relativedelta
+
+
+from BaseController import BaseController
+
+
+class TopCommandsController(BaseController):
+
+ def get(self):
+
+ returnData = {
+ "data" : []
+ , "timestamp" : datetime.datetime.now().isoformat()
+ }
+
+ server = self.get_argument("server")
+ fromDate = self.get_argument("from", None)
+ toDate = self.get_argument("to", None)
+
+ if fromDate==None or toDate==None:
+ end = datetime.datetime.now()
+ delta = datetime.timedelta(seconds=120)
+ start = end - delta
+ else:
+ start = dateutil.parser.parse(fromDate)
+ end = dateutil.parser.parse(toDate)
+
+ for data in self.statsProvider.GetTopCommandsStats(server, start, end):
+ returnData['data'].append([data[0], data[1]])
+
+ self.write(returnData)
View
36 src/api/controller/TopKeysController.py
@@ -0,0 +1,36 @@
+import tornado.ioloop
+import tornado.web
+import random
+import dateutil.parser
+import datetime
+from dateutil.relativedelta import relativedelta
+
+
+from BaseController import BaseController
+
+
+class TopKeysController(BaseController):
+
+ def get(self):
+
+ returnData = {
+ "data" : []
+ , "timestamp" : datetime.datetime.now().isoformat()
+ }
+
+ server = self.get_argument("server")
+ fromDate = self.get_argument("from", None)
+ toDate = self.get_argument("to", None)
+
+ if fromDate==None or toDate==None:
+ end = datetime.datetime.now()
+ delta = datetime.timedelta(seconds=120)
+ start = end - delta
+ else:
+ start = dateutil.parser.parse(fromDate)
+ end = dateutil.parser.parse(toDate)
+
+ for data in self.statsProvider.GetTopKeysStats(server, start, end):
+ returnData['data'].append([data[0], data[1]])
+
+ self.write(returnData)
View
0 src/api/controller/__init__.py
No changes.
View
39 src/api/util/RDP.py
@@ -0,0 +1,39 @@
+"""
+The Ramer-Douglas-Peucker algorithm roughly ported from the pseudo-code provided
+by http://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm
+"""
+
+from math import sqrt
+
+def distance(a, b):
+ return sqrt((a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2)
+
+def point_line_distance(point, start, end):
+ if (start == end):
+ return distance(point, start)
+ else:
+ n = abs(
+ (end[0] - start[0]) * (start[1] - point[1]) - (start[0] - point[0]) * (end[1] - start[1])
+ )
+ d = sqrt(
+ (end[0] - start[0]) ** 2 + (end[1] - start[1]) ** 2
+ )
+ return n / d
+
+def rdp(points, epsilon):
+ """
+ Reduces a series of points to a simplified version that loses detail, but
+ maintains the general shape of the series.
+ """
+ dmax = 0.0
+ index = 0
+ for i in range(1, len(points) - 1):
+ d = point_line_distance(points[i], points[0], points[-1])
+ if d > dmax:
+ index = i
+ dmax = d
+ if dmax >= epsilon:
+ results = rdp(points[:index+1], epsilon)[:-1] + rdp(points[index:], epsilon)
+ else:
+ results = [points[0], points[-1]]
+ return results
View
0 src/api/util/__init__.py
No changes.
View
4 src/config.ini
@@ -0,0 +1,4 @@
+127.0.0.1:6379
+#127.0.0.1:6380
+#10.1.0.82:6379
+#10.1.0.83:6379
View
0 src/dataprovider/__init__.py
No changes.
View
278 src/dataprovider/redisprovider.py
@@ -0,0 +1,278 @@
+import datetime
+from datetime import date
+import redis
+import json
+
+
+class RedisStatsProvider(object):
+ """ A Redis based persistance to store and fetch stats data
+ """
+
+ def __init__(self):
+ self.server = "localhost"
+ self.port = 6381
+ self.conn = redis.StrictRedis(host=self.server, port=self.port, db=0)
+
+
+ def SaveMemoryInfo(self, server, datetime, used, peak):
+ """ Saves Memory Info
+ """
+ data = { "timestamp" : datetime.strftime('%s'), "used" : used , "peak" : peak }
+ self.conn.zadd(server+":memory", datetime.strftime('%s'), data )
+
+
+ def SaveInfoCommand(self, server, datetime, info):
+ """ Save Redis info command dump
+ """
+ data = { "timestamp" : datetime.strftime('%s'), "info" : info }
+ self.conn.zadd(server+":info", datetime.strftime('%s'), data )
+
+ # c = self.conn.cursor()
+ # c.execute("INSERT INTO info VALUES (\'" + datetime.strftime('%Y-%m-%d %H:%M:%S') + "\',\'" + json.dumps(info) + "\',\'" + server + "\')")
+ # self.conn.commit()
+ # c.close()
+
+ def SaveKeysInfo(self, server, datetime, expire, persist):
+ """ Saves expire vs persist info
+ """
+ data = { "timestamp" : datetime.strftime('%s'), "expire" : expire, "persist" : persist }
+ self.conn.zadd(server+":keys", datetime.strftime('%s'), data )
+
+ # c = self.conn.cursor()
+ # c.execute("INSERT INTO keys VALUES (\'" + datetime.strftime('%Y-%m-%d %H:%M:%S') + "\'," + str(expire) + "," + str(persist) + ",\'" + server + "\')")
+ # self.conn.commit()
+ # c.close()
+
+ def SaveMonitorCommand(self, server, datetime, command, keyname, argument):
+ "Save monitor command"
+
+ # current time
+ epoch = datetime.strftime('%s')
+
+ # start a redis MULTI/EXEC transaction
+ pipeline = self.conn.pipeline()
+
+ # keep command counts in a sorted set
+ # top N commands are easily available from the set
+ commandCountKeyName = server + ":CommandCount:" + epoch
+ pipeline.zincrby(commandCountKeyName, command, 1)
+
+ # keep keys counts in a sorted set
+ # top N keys are easily available from the set
+ keyCountKeyName = server + ":KeyCount:" + epoch
+ pipeline.zincrby(keyCountKeyName, keyname, 1)
+
+ # keep aggregate command in a hash
+ commandCountKeyName = server + ":CommandCount"
+ pipeline.hincrby(commandCountKeyName, epoch, 1)
+
+
+ # commit transaction to redis
+ pipeline.execute()
+
+
+ #-----------------------------
+ # Another aproach
+ #-----------------------------
+
+ # maxCommandsExpected = 100000
+ # epoch = int(datetime.strftime('%s'))
+
+ # commandSetKeyName = server + ":commands"
+ # commandLockKeyName = server + ":command_lock:" + command + ":" + str(epoch)
+ # commandCountKeyName = server + ":command:" + command
+
+
+ # # make sure only one client adds the actual timestamp,
+ # #by doing SETNX to a temporary key
+ # isNotSet = self.conn.setnx(commandLockKeyName, epoch)
+
+ # pipeline = self.conn.pipeline()
+
+ # val = float(float(1) / float(maxCommandsExpected))
+ # print "epoch = " + str(epoch)
+
+ # if isNotSet:
+ # val = float(float(epoch) + float(val))
+ # pipeline.expire(commandLockKeyName, 10)
+
+
+
+ # print "val = " + repr(val)
+ # pipeline.zincrby(commandCountKeyName, amount = float(val), value = epoch)
+ # pipeline.execute()
+
+ #data = { "timestamp" : datetime.strftime('%s'), "expire" : expire, "persist" : persist }
+
+ #c = self.conn.cursor()
+ #c.execute("INSERT INTO monitor(datetime, command, keyname, arguments, server) VALUES (\'" + datetime.strftime('%Y-%m-%d %H:%M:%S') + "\',\'" + command + "\',\'" + keyname + "\',\'" + argument + "\',\'" + server + "\')")
+ #self.conn.commit()
+ #c.close()
+
+
+
+ def GetInfo(self, server):
+ info = {}
+ c = self.conn.cursor()
+ for row in c.execute("select info from info where server='" + server + "' order by datetime desc limit 1;"):
+ info = json.loads(row[0])
+
+ c.close()
+ return info
+
+ def GetMemoryInfo(self, server, fromDate, toDate):
+ """ Gets stats for Memory Consumption between a range of dates
+ """
+
+ memoryData = []
+
+ query = """select strftime('%Y-%m-%d %H:%M:%S',datetime), max, current from memory
+ where datetime >= '""" + fromDate.strftime('%Y-%m-%d %H:%M:%S') + """' and datetime <='""" + toDate.strftime('%Y-%m-%d %H:%M:%S') + """' and server='""" + server + """'
+ order by datetime"""
+ print query
+
+ c = self.conn.cursor()
+ for row in c.execute(query):
+ memoryData.append([row[0], row[1], row[2]])
+ c.close()
+
+ return memoryData
+
+ def GetCommandStats(self, server, fromDate, toDate, groupBy):
+ """ Gets commands processed per second list in the given date range
+ """
+
+ # if groupBy=="day":
+ # query = """select count(*) as total, strftime('%Y-%m-%d',datetime) from monitor
+ # where datetime >= '""" + fromDate.strftime('%Y-%m-%d %H:%M:%S') + """' and datetime <='""" + toDate.strftime('%Y-%m-%d %H:%M:%S') + """' and server='""" + server + """'
+ # group by strftime('%Y-%m-%d',datetime)
+ # order by datetime desc """
+ # elif groupBy=="hour":
+ # query = """select count(*) as total, strftime('%Y-%m-%d %H',datetime) from monitor
+ # where datetime >= '""" + fromDate.strftime('%Y-%m-%d %H:%M:%S') + """' and datetime <='""" + toDate.strftime('%Y-%m-%d %H:%M:%S') + """' and server='""" + server + """'
+ # group by strftime('%Y-%m-%d %H',datetime)
+ # order by datetime desc """
+ # elif groupBy=="minute":
+ # query = """select count(*) as total, strftime('%Y-%m-%d %H:%M',datetime) from monitor
+ # where datetime >= '""" + fromDate.strftime('%Y-%m-%d %H:%M:%S') + """' and datetime <='""" + toDate.strftime('%Y-%m-%d %H:%M:%S') + """' and server='""" + server + """'
+ # group by strftime('%Y-%m-%d %H:%M',datetime)
+ # order by datetime desc """
+ # else:
+ # query = """select count(*) as total, strftime('%Y-%m-%d %H:%M:%S',datetime) from monitor
+ # where datetime >= '""" + fromDate.strftime('%Y-%m-%d %H:%M:%S') + """' and datetime <='""" + toDate.strftime('%Y-%m-%d %H:%M:%S') + """' and server='""" + server + """'
+ # group by strftime('%Y-%m-%d %H:%M:%S',datetime)
+ # order by datetime desc """
+
+
+ # c = self.conn.cursor()
+ # for row in c.execute(query):
+ # memoryData.append([row[0], row[1]])
+ # c.close()
+
+ start = int(fromDate.strftime("%s"))
+ end = int(toDate.strftime("%s"))
+
+ memoryData = []
+ s = []
+ for x in range(start, end+1):
+ s.append( str(x) )
+
+ counts = self.conn.hmget(server + ":CommandCount", s)
+ for x in xrange(0,len(counts)):
+ memoryData.append([ 0 if counts[x]==None else int(counts[x]), datetime.datetime.fromtimestamp(start+x).strftime('%Y-%m-%d %H:%M:%S') ])
+
+ return reversed(memoryData)
+
+ def GetTopCommandsStats(self, server, fromDate, toDate):
+ """ Gets top commands processed
+ """
+
+ start = int(fromDate.strftime("%s"))
+ end = int(toDate.strftime("%s"))
+
+ pipeline = self.conn.pipeline()
+
+ # for x in range(start, end+1):
+ # s = [ "_top_command", server + ":CommandCount:" + str(x) ]
+ # pipeline.zunionstore("_top_command", s)
+ # pipeline.zrange("_top_command", 0, -1, True, True)
+ # pipeline.delete("_top_command")
+ # results = pipeline.execute()
+
+ s = []
+ for x in range(start, end+1):
+ s.append( server + ":CommandCount:" + str(x) )
+
+ pipeline.zunionstore("_top_command", s)
+ pipeline.zrange("_top_command", 0, 9, True, True)
+ pipeline.delete("_top_command")
+ results = pipeline.execute()
+
+ resultData = []
+ for command, count in results[-2]:
+ resultData.append([command, count])
+
+ return reversed(resultData)
+
+
+ def GetTopKeysStats(self, server, fromDate, toDate):
+ """ Gets top commands processed
+ """
+
+ start = int(fromDate.strftime("%s"))
+ end = int(toDate.strftime("%s"))
+
+ pipeline = self.conn.pipeline()
+
+ # for x in range(start, end+1):
+ # s = [ "_top_keys", server + ":KeyCount:" + str(x) ]
+ # pipeline.zunionstore("_top_keys", s)
+ # pipeline.zrange("_top_keys", 0, -1, True, True)
+ # pipeline.delete("_top_keys")
+ # results = pipeline.execute()
+
+ s = []
+ for x in range(start, end+1):
+ s.append( server + ":KeyCount:" + str(x) )
+
+ pipeline.zunionstore("_top_keys", s)
+ pipeline.zrange("_top_keys", 0, 4, True, True)
+ pipeline.delete("_top_keys")
+ results = pipeline.execute()
+
+ resultData = []
+ for command, count in results[-2]:
+ resultData.append([command, count])
+
+ return resultData
+
+
+
+
+
+
+
+
+
+
+
+
+
+ #
+ # not evaluated yet
+ #
+
+
+
+
+ def GetRealTimeKeysInfo(self, server):
+ """ Gets real time stats for Keys
+ """
+ keyData = []
+ c = self.conn.cursor()
+ for row in c.execute("select expire, persist from keys where server = '" + server + "' order by datetime desc limit 1;"):
+ keyData.append([row[0], row[1]])
+
+ c.close()
+ return keyData
+
View
189 src/dataprovider/sqliteprovider.py
@@ -0,0 +1,189 @@
+import sqlite3
+import json
+
+class RedisStatsProvider(object):
+ """ A Sqlite based persistance to store and fetch stats data
+ """
+
+ def __init__(self):
+ self.conn = sqlite3.connect('db/redislive.sqlite')
+
+
+ def SaveMemoryInfo(self, server, datetime, used, peak):
+ """ Saves Memory Info
+ """
+ c = self.conn.cursor()
+ c.execute("INSERT INTO memory VALUES (\'" + datetime.strftime('%Y-%m-%d %H:%M:%S') + "\'," + str(used) + "," + str(peak) + ",\'" + server + "\')")
+ self.conn.commit()
+ c.close()
+
+ def SaveInfoCommand(self, server, datetime, info):
+ """ Save Redis info command dump
+ """
+ c = self.conn.cursor()
+ c.execute("INSERT INTO info VALUES (\'" + datetime.strftime('%Y-%m-%d %H:%M:%S') + "\',\'" + json.dumps(info) + "\',\'" + server + "\')")
+ self.conn.commit()
+ c.close()
+
+ def SaveKeysInfo(self, server, datetime, expire, persist):
+ """ Saves expire vs persist info
+ """
+ c = self.conn.cursor()
+ c.execute("INSERT INTO keys VALUES (\'" + datetime.strftime('%Y-%m-%d %H:%M:%S') + "\'," + str(expire) + "," + str(persist) + ",\'" + server + "\')")
+ self.conn.commit()
+ c.close()
+
+ def SaveMonitorCommand(self, server, datetime, command, keyname, argument):
+ argument = ""
+ query = "INSERT INTO monitor(datetime, command, keyname, arguments, server) VALUES (\'" + datetime.strftime('%Y-%m-%d %H:%M:%S') + "\',\'" + command + "\',\'" + keyname + "\',\'" + argument + "\',\'" + server + "\')"
+ print query
+
+ c = self.conn.cursor()
+ c.execute(query)
+ self.conn.commit()
+ c.close()
+
+
+
+
+
+ def GetInfo(self, server):
+ info = {}
+ c = self.conn.cursor()
+ for row in c.execute("select info from info where server='" + server + "' order by datetime desc limit 1;"):
+ info = json.loads(row[0])
+
+ c.close()
+ return info
+
+ def GetMemoryInfo(self, server, fromDate, toDate):
+ """ Gets stats for Memory Consumption between a range of dates
+ """
+
+ memoryData = []
+
+ query = """select strftime('%Y-%m-%d %H:%M:%S',datetime), max, current from memory
+ where datetime >= '""" + fromDate.strftime('%Y-%m-%d %H:%M:%S') + """' and datetime <='""" + toDate.strftime('%Y-%m-%d %H:%M:%S') + """' and server='""" + server + """'
+ order by datetime"""
+ print query
+
+ c = self.conn.cursor()
+ for row in c.execute(query):
+ memoryData.append([row[0], row[1], row[2]])
+ c.close()
+
+ return memoryData
+
+ def GetCommandStats(self, server, fromDate, toDate, groupBy):
+ """ Gets commands processed per second list in the given date range
+ """
+
+ if groupBy=="day":
+ query = """select count(*) as total, strftime('%Y-%m-%d',datetime) from monitor
+ where datetime >= '""" + fromDate.strftime('%Y-%m-%d %H:%M:%S') + """' and datetime <='""" + toDate.strftime('%Y-%m-%d %H:%M:%S') + """' and server='""" + server + """'
+ group by strftime('%Y-%m-%d',datetime)
+ order by datetime desc """
+ elif groupBy=="hour":
+ query = """select count(*) as total, strftime('%Y-%m-%d %H',datetime) from monitor
+ where datetime >= '""" + fromDate.strftime('%Y-%m-%d %H:%M:%S') + """' and datetime <='""" + toDate.strftime('%Y-%m-%d %H:%M:%S') + """' and server='""" + server + """'
+ group by strftime('%Y-%m-%d %H',datetime)
+ order by datetime desc """
+ elif groupBy=="minute":
+ query = """select count(*) as total, strftime('%Y-%m-%d %H:%M',datetime) from monitor
+ where datetime >= '""" + fromDate.strftime('%Y-%m-%d %H:%M:%S') + """' and datetime <='""" + toDate.strftime('%Y-%m-%d %H:%M:%S') + """' and server='""" + server + """'
+ group by strftime('%Y-%m-%d %H:%M',datetime)
+ order by datetime desc """
+ else:
+ query = """select count(*) as total, strftime('%Y-%m-%d %H:%M:%S',datetime) from monitor
+ where datetime >= '""" + fromDate.strftime('%Y-%m-%d %H:%M:%S') + """' and datetime <='""" + toDate.strftime('%Y-%m-%d %H:%M:%S') + """' and server='""" + server + """'
+ group by strftime('%Y-%m-%d %H:%M:%S',datetime)
+ order by datetime desc """
+
+
+ print query
+
+ memoryData = []
+
+ c = self.conn.cursor()
+ for row in c.execute(query):
+ memoryData.append([row[0], row[1]])
+
+ c.close()
+ return reversed(memoryData)
+
+ def GetTopCommandsStats(self, server, fromDate, toDate):
+ """ Gets top commands processed
+ """
+
+ query = """select command, count(*) as total from monitor
+ where datetime >= '""" + fromDate.strftime('%Y-%m-%d %H:%M:%S') + """' and datetime <='""" + toDate.strftime('%Y-%m-%d %H:%M:%S') + """' and server='""" + server + """'
+ group by command order by total
+ """
+
+ print query
+
+ memoryData = []
+
+ c = self.conn.cursor()
+ for row in c.execute(query):
+ memoryData.append([row[0], row[1]])
+
+ c.close()
+ return memoryData
+
+
+ def GetTopKeysStats(self, server, fromDate, toDate):
+ """ Gets top commands processed
+ """
+
+ query = """select keyname, count(*) as total from monitor
+ where datetime >= '""" + fromDate.strftime('%Y-%m-%d %H:%M:%S') + """' and datetime <='""" + toDate.strftime('%Y-%m-%d %H:%M:%S') + """' and server='""" + server + """'
+ group by keyname order by total desc
+ limit 10
+ """
+
+ print query
+
+ memoryData = []
+
+ c = self.conn.cursor()
+ for row in c.execute(query):
+ memoryData.append([row[0], row[1]])
+
+ c.close()
+ return memoryData
+
+
+
+
+
+
+
+
+
+
+
+
+
+ #
+ # not evaluated yet
+ #
+
+
+
+
+ def GetRealTimeKeysInfo(self, server):
+ """ Gets real time stats for Keys
+ """
+ keyData = []
+ c = self.conn.cursor()
+ for row in c.execute("select expire, persist from keys where server = '" + server + "' order by datetime desc limit 1;"):
+ keyData.append([row[0], row[1]])
+
+ c.close()
+ return keyData
+
+
+
+
+
View
BIN src/db/redislive.sqlite
Binary file not shown.
View
BIN src/dump.rdb
Binary file not shown.
View
34 src/main.py
@@ -0,0 +1,34 @@
+import tornado.ioloop
+import tornado.web
+
+from api.controller.BaseStaticFileHandler import BaseStaticFileHandler
+
+from api.controller.InfoController import InfoController
+from api.controller.MemoryController import MemoryController
+from api.controller.KeysController import KeysController
+from api.controller.ReadWriteController import ReadWriteController
+from api.controller.KeySpaceController import KeySpaceController
+from api.controller.ServerListController import ServerListController
+from api.controller.CommandsController import CommandsController
+from api.controller.TopCommandsController import TopCommandsController
+from api.controller.TopKeysController import TopKeysController
+
+
+# Bootup
+application = tornado.web.Application([
+ (r"/api/info", InfoController),
+ (r"/api/memory", MemoryController),
+ (r"/api/keys", KeysController),
+ (r"/api/readwrite", ReadWriteController),
+ (r"/api/keyspace", KeySpaceController),
+ (r"/api/servers", ServerListController),
+ (r"/api/commands", CommandsController),
+ (r"/api/topcommands", TopCommandsController),
+ (r"/api/topkeys", TopKeysController),
+ (r"/(.*)", BaseStaticFileHandler, {"path": "www"})
+], debug="True")
+
+
+if __name__ == "__main__":
+ application.listen(8888)
+ tornado.ioloop.IOLoop.instance().start()
View
32 src/redis_fill_data.py
@@ -0,0 +1,32 @@
+import redis
+from time import strftime
+import time
+
+from dataprovider.sqlite import RedisStatsProvider
+
+def monitor():
+ redisHost = "127.0.0.1"
+ redisPort = 6379
+ redisClient = redis.StrictRedis(host=redisHost, port=redisPort, db=0)
+
+ # for x in range(0,500000):
+ # val = x
+ # if (x % 2 == 0):
+ # redisClient.set(x,val)
+ # elif (x % 3 == 0):
+ # redisClient.get(x-1)
+ # elif (x % 5 == 0):
+ # redisClient.hset("customer",x,val)
+
+ x = 0
+ while True:
+ val = x
+ x+=1
+ if (x % 2 == 0):
+ redisClient.set("x:name","nitin")
+ elif (x % 3 == 0):
+ redisClient.get("x:name")
+
+
+if __name__ == '__main__':
+ monitor()
View
32 src/redis_fill_data2.py
@@ -0,0 +1,32 @@
+import redis
+from time import strftime
+import time
+
+from dataprovider.sqlite import RedisStatsProvider
+
+def monitor():
+ redisHost = "127.0.0.1"
+ redisPort = 6379
+ redisClient = redis.StrictRedis(host=redisHost, port=redisPort, db=0)
+
+ for x in range(0,500000):
+ val = x
+ if (x % 2 == 0):
+ redisClient.set(x,val)
+ elif (x % 3 == 0):
+ redisClient.get(x-1)
+ elif (x % 5 == 0):
+ redisClient.hset("customer",x,val)
+
+ # x = 0
+ # while True:
+ # val = x
+ # x+=1
+ # if (x % 2 == 0):
+ # redisClient.set("x:name","nitin")
+ # elif (x % 3 == 0):
+ # redisClient.get("x:name")
+
+
+if __name__ == '__main__':
+ monitor()
View
198 src/redis_monitor.py
@@ -0,0 +1,198 @@
+import socket
+import datetime
+import threading
+import time
+from time import strftime
+import redis
+import traceback
+import datetime
+
+
+#from dataprovider.sqliteprovider import RedisStatsProvider
+from dataprovider.redisprovider import RedisStatsProvider
+
+
+class Monitor():
+ def __init__(self, connection_pool):
+ self.connection_pool = connection_pool
+ self.connection = None
+
+ def __del__(self):
+ try:
+ self.reset()
+ except:
+ pass
+
+ def reset(self):
+ if self.connection:
+ self.connection_pool.release(self.connection)
+ self.connection = None
+
+ def monitor(self):
+ if self.connection is None:
+ self.connection = self.connection_pool.get_connection(
+ 'monitor', None)
+ self.connection.send_command("monitor")
+ return self.listen()
+
+ def parse_response(self):
+ return self.connection.read_response()
+
+ def listen(self):
+ while True:
+ yield self.parse_response()
+
+class MonitorThread(threading.Thread):
+
+ def __init__(self, server, port):
+ threading.Thread.__init__(self)
+ self.server = server
+ self.port = port
+ self.id = self.server + ":" + str(self.port)
+ self._stop = threading.Event()
+
+ def stop(self):
+ self._stop.set()
+
+ def stopped(self):
+ return self._stop.isSet()
+