Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. stream
  2. |from()
  3. .measurement('cpu')
  4. |alert()
  5. .id('kapacitor/{{ index .Tags "host"}}')
  6. .message('{{ .ID }} is {{ .Level }} value:{{ index .Fields "value" }}')
  7. .info(lambda: TRUE)
  8. .post('http://localhost:1440/alert')
  9. .post('http://localhost/test.php')
  10.  
  11. var express = require("express");
  12. var app = express();
  13.  
  14. var moment = require("moment");
  15. var dateTime = moment();
  16.  
  17. var bodyParser = require("body-parser");
  18. var urlencodedParser = bodyParser.urlencoded({extended:false});
  19. var jsonParser = bodyParser.json();
  20. var port = 1440;
  21.  
  22. app.post('/alert', jsonParser ,function(request, response){
  23. console.log(request.body);
  24. response.send();
  25. });
  26.  
  27. app.listen(port);
  28.  
  29. console.log('Express App.js listening to port '+port);
  30.  
  31. <?php
  32.  
  33. $content = json_encode($_REQUEST);
  34. echo file_put_contents("/home/mahendra/Documents/tick/highcputick.log", $content);
  35.  
  36. ?>
  37.  
  38. [[httppost]]
  39. endpoint = "NodeJs"
  40. url = "http://localhost:1440/alert"
  41. # headers = { Example = "node" }
  42. # basic-auth = { username = "my-user", password = "my-pass" }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement