{"action":"closed","issue":{"url":"https://api.github.com/repos/burstable/burstable.js/issues/10","repository_url":"https://api.github.com/repos/burstable/burstable.js","labels_url":"https://api.github.com/repos/burstable/burstable.js/issues/10/labels{/name}","comments_url":"https://api.github.com/repos/burstable/burstable.js/issues/10/comments","events_url":"https://api.github.com/repos/burstable/burstable.js/issues/10/events","html_url":"https://github.com/burstable/burstable.js/issues/10","id":157497052,"number":10,"title":"Monitoring: Tube lengths","user":{"login":"mickhansen","id":699049,"avatar_url":"https://avatars.githubusercontent.com/u/699049?v=3","gravatar_id":"","url":"https://api.github.com/users/mickhansen","html_url":"https://github.com/mickhansen","followers_url":"https://api.github.com/users/mickhansen/followers","following_url":"https://api.github.com/users/mickhansen/following{/other_user}","gists_url":"https://api.github.com/users/mickhansen/gists{/gist_id}","starred_url":"https://api.github.com/users/mickhansen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mickhansen/subscriptions","organizations_url":"https://api.github.com/users/mickhansen/orgs","repos_url":"https://api.github.com/users/mickhansen/repos","events_url":"https://api.github.com/users/mickhansen/events{/privacy}","received_events_url":"https://api.github.com/users/mickhansen/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-05-30T12:51:45Z","updated_at":"2016-05-31T14:40:33Z","closed_at":"2016-05-31T14:40:33Z","body":"API discussion here, tool will probably be published as `node-beanstalkd-monitor` though.\r\n\r\nThe purpose of the tool is to monitor health of beanstalkd tubes, primarily by watching tube (ready) lengths and their changes.\r\n\r\n## Living document\r\n\r\n```js\r\nimport {Monitor, Alert, IncreaseAlertTrigger} from 'beanstalkd-monitor';\r\nconst monitor = new Monitor(host, port, {\r\n  pollInterval: '1m',\r\n  dataIntervals: [\r\n    '1m',\r\n    '5m',\r\n    '15m',\r\n    '30m',\r\n    '1h'\r\n  ]\r\n});\r\nconst JOB_STATES = ['urgent', 'ready', 'reserved', 'delayed', 'buried'];\r\n\r\nmonitor.start();\r\nmonitor.stop();\r\n\r\nmonitor.on('start');\r\nmonitor.on('stop');\r\n\r\nmonitor.on('data', function (data) {\r\n  /*\r\n  [\r\n    {\r\n      tube: 'tube',\r\n      ready: {\r\n        now: 123,\r\n        '5m': 60, // absolute numbers\r\n        '15m': 30,\r\n        1800000: 0\r\n      }\r\n    }\r\n  ]\r\n  */\r\n});\r\n\r\nmonitor.on('alert', function (alert) {\r\n  logger.critical(alert.message);\r\n});\r\n\r\nmonitor.addAlertTigger(new IncreaseAlertTrigger('25%', '3h'));\r\nmonitor.addAlertTigger(new IncreaseAlertTrigger('tube', '25%', '3h'));\r\nmonitor.addAlertTigger(new IncreaseAlertTrigger('tube', 'ready', '25%', '3h'));\r\n\r\nmonitor.addAlertTrigger(function (data) {\r\n  // See on('data');\r\n\r\n  return null;\r\n  return 'Oh god no!';\r\n  return new Alert({\r\n    message: 'The horror!',\r\n    tube: 'tube'\r\n  });\r\n});\r\n```\r\n\r\nhttps://www.npmjs.com/package/ms"}}
{"actor":{"display_login":"mickhansen"}}