SpecialAttack.net
https://forum.specialattack.net/

NS2 Server Monitor
https://forum.specialattack.net/viewtopic.php?t=7639
Page 1 of 1

Author:  [SpA]lacop [ 28 Jul 2010, 14:23 ]
Post subject:  NS2 Server Monitor

INTRO
We've developed a little tool to monitor NS2 server's memory usage and restart it when it exceeds some threshold.
You can download it in the .zip attached to this post.

If you don't want to run some random .exe on your server you can find the source code here: http://lacop.pastebin.com/q25xvgbM
And if you don't want to run random .exe and neither compile it on your own, download a decompiler like Reflector and see for yourself that the .exe and public source are identical :D

Note: This is quickly thrown together to avoid servers filling memory and requiring manual restart. There is no guarantee it'll work as expected or at all. Bug reports, suggestions etc. are welcome, complete code patches even more :mrgreen:

USAGE GUIDE
Simply extract the files somewhere. Configure the utility using the .config file. You can test it by simply starting the .exe. Note that a console window will appear for a while. The program instantly closes but all the output is appended to the .log file. To test if it works you can set the threshold to a low value, like 1MB and running it.

The program itself does only a single pass over all servers and quits. You probably want to automate this task, so you need a way to run it periodically. You can use any cron-like system, for example windows task scheduler.

Locate it in control panel and add a new task.
As trigger add a scheduled trigger, repeating for every x minutes, indefinitely. Don't forget to check the enabled checkbox, if it isn't already.
In the actions tab add a start a program action, specify the path to the .exe, then copy the path to start in field and delete the .exe name so that it points to the folder you extracted the files to.
In the general tab, make sure the user you want the task to run as has rights to kill and start the server (eg. use the user running the server), and check run only when user is logged on.

You can then test it by setting low memory limit and clicking the manual Run button in the right panel. Don't forget to increase the memory limit after that.

FEEDBACK
If you have any problems, bug reports or suggestions please post them here and I'll try to answer them when I can.

Attachments:
File comment: NS2 Server monitor
NS2Monitor.zip [100.2 KiB]
Downloaded 147 times

Page 1 of 1 All times are UTC+02:00

Powered by phpBB® Forum Software © phpBB Limited