Forum Moderator VegaS™ 10275 Posted December 14, 2022 Forum Moderator Share Posted December 14, 2022 (edited) Private Server Down Detector It's an open-source internal tool for Metin2dev, not for private servers. This is the hidden content, please Sign In or Sign Up This tool is scanning the entire database.json file, which contains all topics in the private servers category, along with their associated content. The topic post is HTML code which is checked with a regex to find all valid hrefs links, as well as ignoring those in the 'ignored urls.json' file to avoid making unnecessary requests. The links are then tested with a HEAD request to determine whether or not the server is online. This will allow us to get rid of the servers that are no longer operational and tidy up the relevant forum category. Topics without URLs will be archived immediately. The output features are still being worked on, but the tool is fully functional: [x] Quickly generating a graph of the server statistics: [x] Offline [x] Online [x] Unknown (no urls) (TODO) [x] Generating a custom output file with the results of the scan. [x] Constructing an automatic query to move offline servers to the archive category. How to use Clone the repository git clone https://github.com/Metin2-Dev/down-detector-private-servers.git Install the latest version of Python, 3.11 or higher. Install virtual environment: # Install virtualenv py -3 -m venv venv # Activate virtualenv (Windows) ./venv/scripts/activate # Activate virtualenv (Linux) source ./venv/bin/activate # Install the requirements pip install -r requirements.txt Available command line arguments (optional) --version - Show the version of the script --help - Show help message with available arguments --input - JSON database file default: database.json --output - Output path directory default: ./output --exclude - JSON excluded urls file default: ignored_urls.json --timeout - Timeout for HTTP requests default: None (wait until the request is finished) --logging - Enable console output default = True --domain - URL of the topic forum's domain default = https://forum.metin2.dev/topic/ --threads - The maximum number of threads that can be used for parallel processing default = None (all available threads) Run the script via the command line: python main.py --input ./database.json Namespace(input='database.json', output='output', exclude='ignored_urls.json', timeout=None, logging=False, threads=None, domain='https://metin2.dev/topic/') You can also run the script from your preferred IDE, such as PyCharm or VSCode and it will use the default arguments. How to contribute Fork the repository Create a new branch Make your changes Create a pull request Wait for the review Author Vegas007 This is the hidden content, please Sign In or Sign Up License Edited December 14, 2022 by VegaS™ Core X - External 2 Internal 15 1 14 Check my GitHub Profile Click to find all the threads started by me [TOOL] Text file loader + JSON Link to comment Share on other sites More sharing options...
Active Member Helia01 2134 Posted December 20, 2022 Active Member Share Posted December 20, 2022 (edited) Good release. But why create something from scratch if there are grafana+prometheus and grafana+InfluxDB and zabbix? and many similar ready-made solutions .. In addition, it would be much easier to create a docker image on the basis of which a potential user could raise his container if necessary. This would get rid of OS pollution with all sorts of packages. Edited December 20, 2022 by Helia01 1 Link to comment Share on other sites More sharing options...
Forum Moderator VegaS™ 10275 Posted December 20, 2022 Author Forum Moderator Share Posted December 20, 2022 13 hours ago, Helia01 said: Good release. But why create something from scratch if there are grafana+prometheus and grafana+InfluxDB and zabbix? and many similar ready-made solutions .. Thanks. but we don't need any visualizations, they were just for fun. Furthermore, only the administrator will run this tool locally a few times per year at most, it was only used to create that sql query for moving dead servers to archive, such as this one: Quote In addition, it would be much easier to create a docker image on the basis of which a potential user could raise his container if necessary. This would get rid of OS pollution with all sorts of packages. Those packages are installed on the project environment rather than the operating system, so they will not interfere with anything. Basically, this tool has no benefits for owners/developers, it's just an internal tool for metin2dev administration, nothing special. 1 Check my GitHub Profile Click to find all the threads started by me [TOOL] Text file loader + JSON Link to comment Share on other sites More sharing options...
Recommended Posts