Giter Site home page Giter Site logo

samonitor's Introduction

SAMonitor - San Andreas Monitor

A free and open source server monitor, tracking over a thousand SA-MP and open.mp servers.

Providing: A server browser, a public API and a Masterlist alternative.

Contents

Server browser

The server browser is available at https://sam.markski.ar

It consumes the public API endpoints listed below.

Masterlist

We offer a masterlist alternative, at http://sam.markski.ar/api/GetMasterlist.

You may specify a version parameter. Example: http://sam.markski.ar/api/GetMasterlist?version=0.3.7

It is a relatively high-quality masterlist: It is both automatically and manually pruned of repeated and illegitimate servers regularly. It omits servers which are password protected or have been offline for more than 6 hours.

To ensure fairness, the position of every server in the list is shuffled every 30 minutes.

If you wish to use SAMonitor's masterlist in SA-MP, check out SA-MP Masterlist Fix!

API Endpoints

All of these endpoints are located at http://sam.markski.ar/api/. All of them are GET.

GetAllServers

Return a collection with the information for EVERY server in SAMonitor. This might include dead/offline servers.

Try it: http://sam.markski.ar/api/GetAllServers

GetFilteredServers

Return a collection with the information for EVERY ONLINE server in SAMonitor.

By default, it won't include empty servers, but this can be changed.

All parameters:

  show_empty:
   - If specified 1, will show empty servers.

  order:
   - Possible values: "none", "players", "ratio". By default, "none".

  name, gamemode, version, language:
   - They are a search filter. Specify text in any of them.

  hide_roleplay:
   - If specified 1, hide roleplay servers.

  require_sampcac:
   - If specified 1, only get servers where SAMPCAC is required.
  
  paging_size:
   - For paging. There is no paging by default.
     If number is provided then it'll be the amount of returns per page.

  page:
   - Specify the page number, if paging_size is used.

Try it: http://sam.markski.ar/api/GetFilteredServers?name=Roleplay&order=player

GetServerByIP

Provide an IP address (optionaly with a specified port), returns information about it.

If no port is provided and several servers are under that IP, the one at 7777 will be chosen.

Try it: http://sam.markski.ar/api/GetServerByIP?ip_addr=151.80.19.151:7777

GetServerPlayers

Provided an IP address (optionaly with a specified port), return a list of players.

Try it: http://sam.markski.ar/api/GetServerPlayers?ip_addr=51.68.204.178:7777

GetGlobalStats

Receive counts for amount of servers tracked, amount of servers online, servers that are inhabited, and global amount of players at the moment.

Data updates every 5 minutes.

Try it: http://sam.markski.ar/api/GetGlobalStats

GetGlobalMetrics

Providing an amount of hours, get metrics for global count of players and servers in the last given hours. Default 6.

Updated every 30 minutes.

Try it: http://sam.markski.ar/api/GetGlobalMetrics?hours=6

GetServerMetrics

Providing an IP address and an amount of hours, get metrics for the count of players in the last given hours.

If no hour is provided, defaults to 6.

Try it: http://sam.markski.ar/api/GetServerMetrics?hours=6&ip_addr=51.68.204.178:7777

NOTE: By default, returns no entries for times a server failed to respond to a query. To have these, use include_misses=1. These are marked with a player count of -1, and can be used to (somewhat loosely) track downtime.

Data schemas

There are two schemas: Player and Server.

The player schema is used for GetServerPlayers. It is the simplest schema, and will likely never change.

  id:    Integer
  ping:  Integer
  name:  String
  score: Integer

The server schema is likely to change as SAMonitor is fairly in-development. However breaking changes are unlikely and it might just come in the form of adding more fields.

  success:       Boolean
  lastUpdated:   DateTime
  worldTime:     DateTime (only the Time portion has the relevant data)
  playersOnline: Integer
  maxPlayers:    Integer
  allowsDL:      Boolean
  lagComp:       Boolean
  name:          String
  gameMode:      String
  ipAddr:        String
  mapName:       String
  website:       String
  version:       String
  language:      String
  sampCac:       String (Version of SAMPCAC required. "Not required" otherwise.)

The API should never return any null values. Either '0' or "Unknown" would come in their placee where appropiate, or at worst, an empty [] response. Still, because bugs can exist, you may wish to account for the possibility of 'null' returns.

Add your server

You may add your server through the add server page in SAMonitor.

You can also use the Announce filterscript.

samonitor's People

Contributors

markski1 avatar mysy00 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

samonitor's Issues

Investigate memory leak

In ~12 days of uptime, SAMonitor ballooned up to consuming 1Gb of system memory. This is not a crazy amount, and RAM is only cheap, but considering it's previously ran for over a month using below 400Mb this must've been introduced by a somewhat recent change.

I imagine I can find the reason by reviewing my last 15 commits or so. Can't do that now, so writing this as a reminder to self.

Sort by suggestion

TL;DR:
Filter by language

Long version:
Now that there's finally a SACNR clone with an active development; I can suggest something I've wanted since SA-MP 0.1b in 2007. With the boom in global playerbase; filtering the servers by your own language can be exceptionally difficult. If need be, I'd be more than happy to write the pull request myself, if timing/manpower is an issue.

Filter feature:
Sort by language {string}

Example:
OzAawWN

[Question] NuGet

Can you add in the future or soon the NuGet package of your API?

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.