Advertisement
phukao_itm

mikrotik-ws-captrue-Telegram

Apr 27th, 2023 (edited)
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.78 KB | Source Code | 0 0
  1. ######## MIKROTIK - DIAY GRAPHING CAPTURE REPORT - TELEGRAM #########
  2. # #
  3. # build 0.2.20231105 public review #
  4. # BY: PHUKAO PONGSUWAN #
  5. # #
  6. # LINE Script: https://pastebin.com/Jk9kjH2A #
  7. # TELEGRAM Script: https://pastebin.com/v6RCJqBh #
  8. # #
  9. # * * * * IF USE ROS > v7.10 please use * * * * * #
  10. # LINE Script: https://pastebin.com/w6vWjjav #
  11. # TELEGRAM Script: https://pastebin.com/jnRBkwCx #
  12. # #
  13. # Capture with https://github.com/elestio/ws-screenshot #
  14. # #
  15. # fix 20231105 - add uniq value in url to avoid caching #
  16. # #
  17. # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
  18.  
  19. # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
  20. # #
  21. # !!! NEED THIS SCRIPT "func_LINEdateTime" as INCLUDE FIELS !!!! #
  22. # #
  23. # https://pastebin.com/tznx0BSu #
  24. # #
  25. # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
  26.  
  27. #
  28. # Multiple interface use =>
  29. #
  30. # :local interfaces { "<interface-name-1>"; "<interface-name-2>"; "<interface-name-n>" }
  31. #
  32.  
  33. :local interfaces { "<interface-name>" }
  34. :local telegramtoken "<TELEGRAM_TOKEN>"
  35. :local telegramchannel "<TELEGRAM CHANNEL>"
  36. :local domainWS "<DOMAIN_OR_IP_WS-CAPTURE-SERVICE>"
  37. :local domianGRAPH "<IP_PORT_TO_GRAPH>"
  38. :local msg "<MESSAGE TEXT>"
  39.  
  40. :local datetime [[:parse [/system/script/get func_LINEdateTime source]]]
  41.  
  42. :local msg "$msg$datetime"
  43.  
  44. /tool/fetch url="https://api.telegram.org/bot$telegramtoken/sendmessage?chat_id=$telegramchannel&text=$msg" http-method=get output=none
  45.  
  46. :foreach inf in=$interfaces do={
  47. :local uniq [:rndnum from=100000 to=999999]
  48. :local url "https://$domainWS/api/screenshot%3Funiq=$uniq%26resX=1024%26resY=500%26outFormat=png%26waitTime=50%26isFullPage=true%26url=http://$domianGRAPH/graphs/iface/$inf/"
  49.  
  50. /tool/fetch url="https://api.telegram.org/bot$telegramtoken/sendPhoto?chat_id=$telegramchannel&photo=$url" http-method=get output=none
  51.  
  52. :log info ("Telegram: $msg - $inf")
  53. }
Tags: mikrotik
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement