Giter VIP home page Giter VIP logo

rotomonitor's Introduction

Information

This is a continuation of RDMMonitor by Chuckslove https://github.com/chuckleslove/RDMMonitor. We will continue to improve this repo where needed and keep it alive in his memory.

Rotomonitor is a simple discord bot to monitor device status for Rotom https://github.com/UnownHash/Rotom.


SETTING UP THE BOT:

  1. Download Node.js ver v18.19.0 from https://nodejs.org/en/download/

  2. Run git clone https://github.com/Kneckter/Rotomonitor to copy the bot.

  3. Change into the new folder cd Rotomonitor/.

  4. Run npm install.

  5. Copy the example file cp RotomonitorConfig.example.json RotomonitorConfig.json.

  6. Create an applicaiton and get the your bot's secret token, and application ID at:

  7. Get your application/bot to join your server by going here:

    • https://discordapp.com/developers/tools/permissions-calculator
    • Check the boxes for the needed permissions
      • Minimum requirements: manage messages, send messages, read message history
    • Use the URL that the page generates and go to it, and you will be asked to log into your discord. You will need Admin access in order to get the bot to join that server.
  8. Fill out the information needed in nano RotomonitorConfig.json.


SETTINGS

token: Mandator, discord bot token, bot should have send message and manage message permissions in the designated channel

channel: Default channel ID of where to post device/instance status
deviceSummaryChannel: Specific channel ID of where to post the device summary

userAlerts: an array of user IDs to DM upon device going offline

rotomURL: URL of your Rotom admin interface, by default IP:7072 but can use actual URL if you have a properly configured reverse proxy
basicUsername: Username for reverse proxy BasicAuth.
basicPassword: Password for reverse proxy BasicAuth.

postDeviceSummary: true/false - Bool to post device status in a single block by current status

clearMessagesOnStartup: Will delete all messages in the channel it is going to post to, this is to clear out posts from past history, DO NOT set this to true if you don't have a dedicated channel for device status as this will wipe out the channel

ignoredDevices: An array of strings for the overall device blacklist

postingDelay: The time in minutes to delay different posting triggers

warningTime: The time in minutes to consider a device in warning state
offlineTime: The time in minutes a device must be offline before marked as red/offline and send a DM to the designated users

allowReopenGame: true/false - Bool to enable Rotomonitor to send a reopen game request to a monitor
reopenTime: The time in minutes to request a device to reopen the game
reopenMonitorURL: An array of strings for the URLs of the reopen game monitors you are using like iPhone Controller or DCM Listener
excludeFromReopen: An array of strings that are the unique names of the devices to exclude from the reopen game request

allowReapplySAM: true/false - Bool to enable Rotomonitor to send a request to a monitor for reapplying the SAM profile.
reapplySAMTime: The time in minutes to request a device have the SAM profile reapplied automatically. DO NOT put this timer 2 minutes from a reboot, it could cause the phone to have no SAM profile. 
reapplySAMMonitorURL: An array of strings for the URLs of the reapply SAM monitors you are using like iPhone Controller or DCM Listener
excludeFromReapplySAM: An array of strings that are the unique names of the devices to exclude from the reapply SAM request

allowWarnReboots: true/false - Bool to enable Rotomonitor to send a reboot request to a monitor
rebootAgainTimer: The time in minutes to wait before trying another reboot, in case the last reboot did not bring the device online
maxRebootRetries: A number for limiting the amount of times a device is rebooted
rebootMonitorURL: An array of strings for the URLs of the reboot monitors you are using like iPhone Controller or DCM Listener
sendRebootAlerts: true/false - Bool to enable the DM message for rebooting a device
excludeFromReboots: An array of strings that are the unique names of the devices to exclude from the reboot request

brightnessMonitorURL: An array of strings for the URLs of the brightness monitors you are using like iPhone Controller or DCM Listener

cmdPrefix: A single character used to identify commands that the bot should react to
adminRoleName: This is a string for the name of the main role that will admin the bot

LAUNCHING IT

Using terminal, run node Rotomonitor.js or node Rotomonitor.js config.json if specifying a config file.

  • If you close that window, the bot connection will be terminated! You can add it to PM2 if you want it to run in the background.

Instead, add it to PM2 with pm2 start ecosystem.config.js


USAGE

.help
--.restart » to manually restart the whole bot
--.reopen <DEVICE-NAMES> » to reopen the game on specific devices
--.reboot <DEVICE-NAMES> » to reboot the specific devices
--.sam <DEVICE-NAMES> » to reapply the SAM profile to the specific devices
--.delete <DEVICE-NAMES> » to delete the specific devices from the monitor
--.brightness <VALUE>, <DEVICE-NAMES> » to change the brightness on the specific devices

The commands with <DEVICE-NAMES> accept multiple names separated by commas.
They can be used to skip the exclusion list if you specify a name on the list.
They can accept all, allwarn, or alloff to apply to groups but will omit devices on the exclude lists.

rotomonitor's People

Contributors

chuckleslove avatar kneckter avatar dependabot[bot] avatar parttimejs avatar fabio1988 avatar notheowner avatar petap0w avatar kamieniarz avatar thunder123456 avatar versx avatar wrinklytesties avatar

Stargazers

João Chung avatar Grant Ward avatar  avatar MC0RE avatar  avatar  avatar f0enix avatar  avatar  avatar Jakub avatar Crippe avatar  avatar  avatar  avatar  avatar  avatar

Watchers

James Cloos avatar mimik avatar  avatar

rotomonitor's Issues

Bug: Rotom version crash and restart

When testing the new Rotom version of this when a device/worker goes offline and it attempts to start a reboot RDMMonitor crashes and restarts

The error that displays says
Uncaught exception {}
Restarting in 1 min

If I run a reboot command manually in a channel it works and sends the command to the listener and restarts the device

I'm running android with GCv3 don't know if this has anything to do with it

[Feature request]: Restart extra when device keeps stuck

The restart function works, but i have a device that sometimes even after a restart keeps stuck, i have then to manually reboot it with iphonecontroller.
Would a extra reboot function be possible.
Now we see that rdmmonitor sents the reboot function and then does not check or does it again until the device is back online by hand.

It would be nice if there is a check every 10 minutes, if device has not been online sent reboot command even if it was already done.

Feature Request: Send an Update Request to Listener

Have a .update command to request that iPC or DCMRL run an update command on the local machine. Need to update those so they can run the command. Make the command configurable so people can tailor it to their system

Bug: Error in code somewhere, bot stops working

Hello,

Tried running this for the first time, and wrote a Dockerfile & docker-compose for it. Building didn't raise issues, although starting the script gave me the output shown below:

[9/17/2022, 3:54:19 PM]Uncaught exception: {}
[9/17/2022, 3:54:19 PM]Unexpected error, bot stopping, likely websocket
[9/17/2022, 3:54:18 PM]Logging in Discord bot token

I will do a PR to make my Dockerfiles/compose available

Basic auth Rotom Version

I’m using a basic auth dir my rotom dashboard, with that rdmmonitor is unable to connect to /api/status

Maybe a basic auth login could get implemented into the Rotommonitor version ?

Feature Request: Add Simple Scheduler

RDMMonitor could be scheduled to not reboot/check devices (use a separate config basically) during defined time period in the day. This could be useful in conjunction with DCM's device scheduler for questing and leveling with other backends.

reboot and reopen handling for

At the moment, reboot and reopen will handled by worker and not for the hole device.
This means that the commands are executed several times for the same device.

[12/8/2023, 4:12:11 PM]Sending reboot request for sn04_003 to remote listener
[12/8/2023, 4:12:11 PM]Sending reboot request for sn04_001 to remote listener
[12/8/2023, 4:12:11 PM]Sending reboot request for sn04_002 to remote listener
[12/8/2023, 4:12:12 PM]Beginning device query
[12/8/2023, 4:12:12 PM]Finished device query
[12/8/2023, 4:12:31 PM]Posting device summary
[12/8/2023, 4:12:32 PM]Finished posting device summary
[12/8/2023, 4:12:42 PM]Beginning device query
[12/8/2023, 4:12:42 PM]Finished device query
[12/8/2023, 4:13:11 PM]Sending reboot request for sn04_003 to remote listener
[12/8/2023, 4:13:11 PM]Sending reboot request for sn04_001 to remote listener
[12/8/2023, 4:13:11 PM]Sending reboot request for sn04_002 to remote listener
[12/8/2023, 4:13:12 PM]Beginning device query
[12/8/2023, 4:13:12 PM]Finished device query
[12/8/2023, 4:13:32 PM]Posting device summary
[12/8/2023, 4:13:32 PM]Finished posting device summary
[12/8/2023, 4:13:42 PM]Beginning device query
[12/8/2023, 4:13:42 PM]Finished device query
[12/8/2023, 4:14:11 PM]Sending reboot request for sn04_003 to remote listener
[12/8/2023, 4:14:11 PM]Sending reboot request for sn04_001 to remote listener
[12/8/2023, 4:14:11 PM]Sending reboot request for sn04_002 to remote listener
[12/8/2023, 4:14:12 PM]Beginning device query
[12/8/2023, 4:14:12 PM]Finished device query
[12/8/2023, 4:14:32 PM]Posting device summary
[12/8/2023, 4:14:33 PM]Finished posting device summary
[12/8/2023, 4:14:42 PM]Beginning device query
[12/8/2023, 4:14:42 PM]Finished device query
[12/8/2023, 4:15:11 PM]Sending reboot request for sn04_003 to remote listener
[12/8/2023, 4:15:11 PM]Sending reboot request for sn04_001 to remote listener
[12/8/2023, 4:15:11 PM]Sending reboot request for sn04_002 to remote listener

Feature Request - Reopen Again!

Noticed in this code you can specify reboot retries, but reopen only happens once. Sometimes ATVs need a few more reopens before trying a reboot.

Leveling instance breaks posting of instances

Problem: Instances are not being posted to Discord channel.

Error:

1|RDMMonitor  | [1/23/2021, 9:31:41 PM]Beginning RDM query
1|RDMMonitor  | [1/23/2021, 9:31:42 PM]Could not retrieve data from website: {Redacted large JSON of all leveling instances}
1|RDMMonitor  | [1/23/2021, 9:31:36 PM]SyntaxError: Unexpected token i in JSON at position 283
1|RDMMonitor  | [1/23/2021, 9:31:36 PM]Finished RDM query
1|RDMMonitor  | [1/23/2021, 9:31:37 PM]Finished posting device status

Position 283 is at "time_left":inf from a leveling instance in JSON

{"type":"Leveling","name":"L - Tokyo","status":[{"time_left":inf,"xp_current":0,"xp_target":2000000,"username":"AccountName","level":0,"xp_per_hour":0,"xp_start":0,"xp_percentage":0.0}

Reproduce: Create a leveling instance and add at least 1 device.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.