AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   MySCAL (MySQL Server Configs & Admin Logging) - Need Feedback! (https://forums.alliedmods.net/showthread.php?t=73119)

MoggieX 06-23-2008 04:59

MySCAL (MySQL Server Configs & Admin Logging) - Need Feedback!
 
2 Attachment(s)
MySCAL (MySQL Server Configs & Admin Logging)

Foreword
I am looking for any suggestions for this plug-in, I currently class this plug-in as BETA because I am looking for feedback from the community, although I am using for my game servers. See my thoughts/suggestions below.

My Thoughts/Suggestions:
If you have any suggestions, please reply below, I saw two very good ideas and merged them together into a single 'viable' solution for larger communities with lots of game servers.
  1. The over writing of the map specific configs coudl be a pain in the rear for some users. I could add the ability to run map specific configs (even down to generic CS_* or DE_* map config files if needed).Wondering whether it would be an idea, to try and run the map specific config file after the plug-in has finished loading?? Done simply in V1.1
  2. I was looking through the functions and noticed that it could be possible to also write the mapcycle.txt file also, is this a feature you would want and actually use?
  3. Need to add in game command to run the configs again if needed
  4. Will look at menu integration (never done this before, so might be a while)
  5. Would error logging based upon server ID be useful to anyone else than me?
  6. Would logging of every command (that appears in the SM log files) be useful to anyone else than me?
What Does it Do?
This plug-in allows server operators to store their server.cfg file entries in a MySQL database, rather than have server config files scattered across each server and to control them from a single location.

After approximately 3 seconds of the map loading, this plug grabs the configs from a database where the server number matches and then executes them.

If any map specific config files exist eg mapname.cfg it will now run these in your cfg folder automatically.

Also its capable of logging admin commands to a MySQL Database as well. As I use HSFighter's web interface (link below), it made absolute sense to add this as well, as in theory its only a simple search based upon Steam ID, to keep a record of the commands an admin has made.

Also as a fail-safe, if the connection fails, server plug-in will run "server_back.cfg".

Web Interface Coming Soon!
The web interface is being worked up by HSFighter and will be released later this week in this thread:
http://forums.alliedmods.net/showthread.php?t=60174

I am hoping that it may end up looking similar to this for CSS:
http://www.cstrike-planet.com/cfgmaker?cfg=srcds

CVars
sm_myscal_version - Duh
sm_myscal_enable - Default: 1 - Enables and disables this plugin
sm_myscal_server_no - Server Number (see notes below)
sm_myscal_log_enable - Default: 1 - Enables/Disables Admin Command Logging

Installation
1. A working MySQL Connection, http://wiki.alliedmods.net/SQL_Admin...#Configuration noting that this plug-in will use what ever the default one is.
2. Run the SQL below or attached in the .sql file on your database to create the tables
3. Put this plugin in your <mod dir>/addons/sourcemod/plugins/ folder
4. Change maps.

FYI: The cvar is held in ' Command_Name' and the value is held in 'Command_Value', this also means you could also do "exec somefile.cfg" if needed

Optional:
Server Number:
After entering your server configs to the database in columns, you may want to think about server numbers. you will need to add the following to your server.cfg file:

PHP Code:

sm_myscal_server_no X // Where X is the server number 

FailSafe:
If the database connection fails, the plugin will attempt to run "server_backup.cfg", this of course could have been your original server.cfg which you have renamed.

SQL:
Below and attached, is the SQL to create the two tables, you will see that its prepared for HSFighter's web console (after one squillion PM's, loooool)

Server Config:
PHP Code:

CREATE TABLE IF NOT EXISTS sm_servercfg(
ID              int(11PRIMARY KEY auto_increment,
Server_ID       int(11),
Command_Name    varchar(255NOT NULL default '',
Command_Value   varchar(255NOT NULL default '',
Value_Key       varchar(255NOT NULL default '',
Default_Key     varchar(255NOT NULL default '',
Type            varchar(16NULL,
time_modified   timestamp(14NOT NULL default
CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP
)TYPE=MyISAM

Admin Logging:
PHP Code:

 CREATE TABLE `smwa`.`sm_logging` (
`
IDINT11 NOT NULL AUTO_INCREMENT ,
`
Server_IDINT11 NOT NULL ,
`
steamidVARCHAR100 NOT NULL ,
`
logtagVARCHAR100 NOT NULL ,
`
messageVARCHAR255 NOT NULL ,
`
time_modifiedTIMESTAMP14 ON UPDATE CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ,
PRIMARY KEY ( `ID` )
ENGINE MYISAM 



CVars that do not work & special considerations!

So far I have only found one CVar that does not work using this method and that is sv_downloadurl, this must be set in the server.cfg file.

We have hundreds of admins, within a a few days we had already topped the 1000 command mark that the admin logging function had stored, over a long period of time, this map be a problem for someone with a small database allowance.

Version History
V1.0 - First release
V1.1 - Added the function to run map specific cfg files automatically

Thanks to..Matt

recon0 06-23-2008 07:32

Re: MySCAL (MySQL Server Configs & Admin Logging) - Need Feedback!
 
This looks pretty good ;)

Since there's a known problem with sv_downloadurl, could you search the editor and throw an error if that string is found?

What about releasing the admin logging in a separate system?

MoggieX 06-23-2008 08:30

Re: MySCAL (MySQL Server Configs & Admin Logging) - Need Feedback!
 
Quote:

Originally Posted by r3recon (Post 642592)
This looks pretty good ;)

Since there's a known problem with sv_downloadurl, could you search the editor and throw an error if that string is found?

What about releasing the admin logging in a separate system?

Yup could do, or tbh to keep it as lite as possible, read the instructions :-P

As for just the admin loggging only, set sm_myscal_enable to 0

Matt

voogru 06-23-2008 09:23

Re: MySCAL (MySQL Server Configs & Admin Logging) - Need Feedback!
 
Code:

CREATE TABLE `smwa`.`sm_logging` (
`ID` INT( 11 ) NOT NULL AUTO_INCREMENT ,
`Server_ID` INT( 11 ) NOT NULL ,
`steamid` VARCHAR( 100 ) NOT NULL ,
`logtag` VARCHAR( 100 ) NOT NULL ,
`message` VARCHAR( 255 ) NOT NULL ,
`time_modified` TIMESTAMP( 14 ) ON UPDATE CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ,
PRIMARY KEY ( `ID` )
) ENGINE = MYISAM

Engine definitions for steamids are 64 characters, and you can store a steamid as a 4 byte unsigned int if you convert the steamid to a friendID.

MoggieX 06-23-2008 10:48

Re: MySCAL (MySQL Server Configs & Admin Logging) - Need Feedback!
 
Quote:

Originally Posted by voogru (Post 642629)
Engine definitions for steamids are 64 characters, and you can store a steamid as a 4 byte unsigned int if you convert the steamid to a friendID.

Cheers, I set it to 100, not knowing what their restriction would be

Matt

ottobohn 06-23-2008 11:14

Re: MySCAL (MySQL Server Configs & Admin Logging) - Need Feedback!
 
We'll test this on one of our servers, probably soccer server, and give feedback. I'm all about logging being done remotely just in case servers go down.

otto
:grrr:

recon0 06-24-2008 03:14

Re: MySCAL (MySQL Server Configs & Admin Logging) - Need Feedback!
 
Quote:

Originally Posted by MoggieX (Post 642610)
Yup could do, or tbh to keep it as lite as possible, read the instructions :-P

As for just the admin loggging only, set sm_myscal_enable to 0

Matt

I think you should put them in separate plugins... I'm thinking about forking it and building a really fancy viewer with a search system for the logs (.NET WinForm app)... Maybe in the future the plugin can queue all log entries to SQLite and send them to the remote DB on map changes.

MoggieX 06-24-2008 04:16

Re: MySCAL (MySQL Server Configs & Admin Logging) - Need Feedback!
 
Quote:

Originally Posted by r3recon (Post 643010)
I think you should put them in separate plugins... I'm thinking about forking it and building a really fancy viewer with a search system for the logs (.NET WinForm app)... Maybe in the future the plugin can queue all log entries to SQLite and send them to the remote DB on map changes.

There is a web console already under way, which ties this in and several other sections into a single solution.

Matt

HSFighter 06-24-2008 06:09

Re: MySCAL (MySQL Server Configs & Admin Logging) - Need Feedback!
 
Quote:

Originally Posted by MoggieX (Post 643020)
There is a web console already under way, which ties this in and several other sections into a single solution.

Matt

This will not be a problem. :)
It will be esay to switch the settings in the webpanel to a separate plugin for adminlogging.
The new Multiserver-Support for the Webadmin will allow this ^^
I think it's a fine solution to put the admin logging to a separate plugin

sirmoe 07-04-2008 00:41

Re: MySCAL (MySQL Server Configs & Admin Logging) - Need Feedback!
 
I'm getting the following errors, any ideas?

L 07/04/2008 - 14:39:17: [myscal.smx] [MySCAL] Database Error
L 07/04/2008 - 14:39:17: [myscal.smx] [MySCAL] Attempting to run server_backup.cfg
L 07/04/2008 - 14:39:17: [SM] Native "SQL_TQuery" reported: Invalid database Handle 0 (error: 4)


All times are GMT -4. The time now is 02:51.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.