Jump to content

Metin2Dev - Private Server Down Detector


Recommended Posts

  • Forum Moderator

Private Server Down Detector

 
⚠️ It's an open-source internal tool for Metin2dev, not for private servers.

This is the hidden content, please

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.

screenshot.png

The output features are still being worked on, but the tool is fully functional:

  1. [x] Quickly generating a graph of the server statistics:
    • [x] Offline
    • [x] Online
    • [x] Unknown (no urls) (TODO)
  2. [x] Generating a custom output file with the results of the scan.
  3. [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 drawing or VSCode drawing 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

License

License: MIT

Edited by VegaS™
Core X - External 2 Internal
  • Metin2 Dev 15
  • Good 1
  • Love 14
Link to comment
Share on other sites

  • Active Member

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 by Helia01
  • Metin2 Dev 1
Link to comment
Share on other sites

  • Forum Moderator
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:.png

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.

  • Metin2 Dev 1
Link to comment
Share on other sites

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.