fred41 42 Posted May 30, 2013 (edited) Project terminated. ASM did his job a long time now and i hope you enjoyed it a bit. This monitoring project was originally mean't as a temporary solution and as an example. What most users don't know is, that ASM is based of a lot of very tricky interfacing implementations, like interprocess communication based on shared memory, API hooking, callextension, e.t.c, just to present the user some data, that are already available inside the engine. Months ago i have made some really practical suggestions to BI, how a simple but professional monitoring interface could be implemented directly in arma server. I got always the answer 'developers are to busy' to do that. Meanwhile arma is 2 years old and there is still no professional solution provided by BI. Considering this above, i hope you understand, that i really see no reason to support arma server any longer. Best regards, Fred41 ASM is a little program, for monitoring some interesting values from multiple server (or HC) instances. Performance related values like: simulation cycles per second average (FPS) simulation cycles per second minimal (FPSmin) condition evaluations per second (CPS) number of alive players (PL#) number of alive server local AI units (AIL) number of alive server remote AI units (AIR) number of mission objects (OC[0..2], free configurable) amount of allocated physical memory (MEM) network traffic incoming in kbytes/s (NTI) network traffic outgoing in kbytes/s (NTO) disk reading in kbytes/s (DIR) name of running instance name of running mission are displayed, simultaneously for multiple (up to 4) server instances, in a window. The idea behind it, is to provide a fast and easy "state of health" overview at one go. more details here: https://github.com/fred41/ASM/ library and server application for NATIVE LINUX, provided by KILLSWITCH, are available and described here: Arma Server Monitor for Linux Update: Arma Server Monitor values are now accessible from remote via TCP (inspired by terox, as usual:) Changelog: 01.06.2013 Changed the install/launch method to mini-addon (thanks terox for inspiration) 01.06.2013 Fixed: instance occupied additional slot at mission change 02.06.2013 Changed bar graphs for CPS & FPS to logarithmic scale to show states more intuitive 03.06.2013 Added history graphs, customizable (individual visibility, update interval), transparency switch 08.06.2013 custom build binaries, for use with DS as service added ("Global\" namespace for MMF access, usage see my post 08.06) 11.06.2013 fixed: AI counting now works correctly (thanks terox for reporting) 13.06.2013 support for run DS as service, now merged in default build (custom build removed) 17.06.2013 remote monitoring now available via additional ArmaServerMonitor instance, configurable via start params (see github readme.md for details) 18.06.2013 value for amount of allocated physical memory in [MB], MEM added 04.07.2013 max player number adapted from 50 to 100 05.07.2013 history graph extd. (200 -> 800 samples), better lag visualisation via FPSmin (activation in popup menu) 09.07.2013 some performance related improvements, to update replace ALL related files (ASM.pbo, ASMdll.dll and ArmaServerMonitor.exe) 11.07.2013 profilName now displayed additional to missionName; forced=1 -> preInit=1 in cfgFunctions 15.07.2013 counter for all allMissionObjects added (helps to check if cleanup routines works correctly) 18.07.2013 Memory (MEM) changed from GB to MB 31.07.2013 object counting interval configurable in asm.ini (see readme.md), additional to local AI, remote AI is counted now too 31.08.2013 userinterface improvements, use popup-menu to check it out (thanks zach72 for ideas) 26.09.2013 Values AIR & AIR rescaled from 400 to 800 max. 22.10.2013 UI settings saved/restored to/from registry at session end/start 14.11.2013 FPS,CPS,FPSmin graph changed to lin. scale, MEM bar scale to max. 4GB now 24.11.2013 Souce of ASM.dll added to git hub repo, feel free to use it in your projects 02.12.2013 Historygraph extended to 86400 seconds (24h), record to RAM ringbuffer, scroll via LMB, reset via dbl.click, timedivisor via popup menu (thx to dwarden, for idea ;)) 06.12.2013 simple log feature added (-lfilenameprefix, -tinterval) 07.12.2013 OBJ value added as optional value for logging to file 08.12.2013 fix: instance slot blocked, caused by arma server crash (full update required) 13.12.2013 three customizable object counter added (set interval and .sqf command in asm.ini) 20.01.2014 added a little hint for current PID (process ID) of server instance (hoover over or click profileName string value to show) 08.02.2014 vert. gridlines and some hints to variable fields added, width of history view scalable (-wwidth, default 900) 15.02.2014 'bold'mode added, use additional -b param in commandline to activate 23.02.2014 sampling interval (1 second) now synced via timeGetTime(), to minimize longtime drift 16.03.2014 memcpy replaced by strcpy_s in ASMdll.dll (thanks killswitch for report) 22.03.2014 added API values NTI, NTO & DIR, some fixes like: logging not stopped when mission ends 04.04.2014 fix: AIR sometimes returned negative values (thanks dwarden for bug report) 17.04.2014 enableAPImonitoring added to asm.ini to switch of API monitoring feature (NTI/NTO/DIR) 26.04.2014 fix: bug related to enableAPImonitoring, caused double slot usage with HC (thanks tankbuster, for report) 28.04.2014 fix: monitoring NTI/NTO values, works now with A2, set enableAPImonitoring=2 in asm.ini (thanks Viba, for reporting and testing) 14.05.2014 for more then 4 instances (up to 16) a new commandline param, -o is introduced (for 4 blocks, of 4 arma server instances each) 22.05.2014 removed old debug code from ASMdll.dll, DIR-value counting related fix 24.05.2014 profile prefix based slot selection added, usage: arma3server.exe -name=xxwhatever, where xx is the prefered ASM slot (zero based) 23.07.2014 changed library name for callextension commands, in fn_ASM.fsm, to lowercase (thx Killswitch, for hint) 29.08.2014 library and server application, by KillSwitch, now available for native linux °° 14.12.2014 current date added to log file name 30.12.2014 timestamp algorithm "tightened" (to prevent double slot occupation in very low fps conditions) !!!please always update ALL files together (data structures of interface are sometimes changing)!!! Edited January 21, 2015 by Fred41 update Share this post Link to post Share on other sites
terox 316 Posted May 31, 2013 Nobody has replied yet, so i'd like to kick this off. This looks like a very nice tool. On the surface, it would appear that each mission needs to be edited so that it can run this - easy to use, just bind one FSM in your mission and launch it from init.sqf file This is a major bind for a server admin where missions are constantly incoming. Can you not automate this so that it feeds off a BIS FSM and make it a serverside addon and the window displayable in a web page Share this post Link to post Share on other sites
fred41 42 Posted May 31, 2013 (edited) Can you not automate this so that it feeds off a BIS FSM and make it a serverside addon and the window displayable in a web page ... Terox, two good ideas ... Do you know, what exactly is nessessary to load this one ASM.fsm in a serverside addon? Edit: ... aah, found a small example addon, i'd like to see if its within my abilities ... Edited May 31, 2013 by Fred41 Share this post Link to post Share on other sites
killzone_kid 1331 Posted May 31, 2013 Nobody has replied yet, so i'd like to kick this off.This looks like a very nice tool. On the surface, it would appear that each mission needs to be edited so that it can run this This is a major bind for a server admin where missions are constantly incoming. Can you not automate this so that it feeds off a BIS FSM and make it a serverside addon and the window displayable in a web page You mean you can make a server script start without calling it from init.sqf directly or indirectly? I would like to know how. Share this post Link to post Share on other sites
terox 316 Posted May 31, 2013 useage of extended eventhandlers in CBA this addon injects code on the clients from the server (I wouldnt use this method for a lot of code) zeu_ServerSkill (Serverside AI skill setting addon with user configuration) The important part is the eventhandler defintition in the config.cpp Share this post Link to post Share on other sites
killzone_kid 1331 Posted May 31, 2013 useage of extended eventhandlers in CBAthis addon injects code on the clients from the server (I wouldnt use this method for a lot of code) zeu_ServerSkill (Serverside AI skill setting addon with user configuration) The important part is the eventhandler defintition in the config.cpp Sorry, you mean I have to have CBA installed for it to work? Share this post Link to post Share on other sites
jw custom 56 Posted June 1, 2013 Sorry, you mean I have to have CBA installed for it to work? Yes. What about initServer.sqf /* Description: Executed on server upon mission start Parameter(s): _this select 0: BOOL - true when server is dedicated */ Share this post Link to post Share on other sites
fred41 42 Posted June 1, 2013 (edited) useage of extended eventhandlers in CBA @Terox, i think i will use your methode in mini-addon to offer an option for users already using CBA. That will save the packing in each mission file, without to introduce additional dependency in this case. @JW Custom, where should one put the initServer.sqf file? (I didnt found any documentation about that auto start methode) Edited June 1, 2013 by Fred41 Share this post Link to post Share on other sites
terox 316 Posted June 1, 2013 @Terox, i think i will use your methode in mini-addon to offer an option for users already using CBA.That will save the packing in each mission file, without to introduce additional dependency in this case.) Don't worry about having CBA as a dependancy. Most servers that support addons run CBA anyway, a lot of addons require it and the clients, in this particular case do not need it. It doesn't create a mission dependancy From a server admins point of view, anything that is automated is certainly better than having to open up every mission and edit them. (This just simply wouldn't happen) Typically a server can literally have hundreds of missions in their MpMissions folders Share this post Link to post Share on other sites
killzone_kid 1331 Posted June 1, 2013 (edited) Yes.What about initServer.sqf Have you got a link to initServer.sqf page where you got the info? NVM, found it in scripts. ---------- Post added at 13:05 ---------- Previous post was at 12:36 ---------- Just tested initServer.sqf it has to be in the mission pbo it is no different than if you if (isDedicated) then { code } in init.sqf _this contains empty array on dedicated server instead of true Edited June 1, 2013 by Killzone_Kid Share this post Link to post Share on other sites
fred41 42 Posted June 1, 2013 (edited) ... hours later ... ...found a nice way to start ASM.fsm without editing the mission file(s) and without the need of CBA extended eventhandlers ... I just defined a new class in cfgFunctions (see config.cpp in ASM.pbo). class cfgFunctions { class A3 { class ArmaServerMonitor { file = "ASM"; class ASM { ext = ".fsm"; forced = 1; }; }; }; }; forced = 1; is the key here, it forces one initial call to the defined function at mission start This works great on Arma 3 for me, maybe it helps someone of you too. Edited June 1, 2013 by Fred41 Share this post Link to post Share on other sites
killzone_kid 1331 Posted June 1, 2013 (edited) Fred, could you make similar console only that would act like a monitor and display any string you sent in it via callExtension? I only started with c++ not sure this is something I can make right now myself. Basically instead of diag_log, send important messages to onscreen in real time? ---------- Post added at 00:51 ---------- Previous post was at 23:09 ---------- ... hours later ......found a nice way to start ASM.fsm without editing the mission file(s) and without the need of CBA extended eventhandlers ... I just defined a new class in cfgFunctions (see config.cpp in ASM.pbo). class cfgFunctions { class A3 { class ArmaServerMonitor { file = "ASM"; class ASM { ext = ".fsm"; forced = 1; }; }; }; }; forced = 1; is the key here, it forces one initial call to the defined function at mission start This works great on Arma 3 for me, maybe it helps someone of you too. Works great! I've added some comments to the code: class CfgFunctions { class KKfunctions //whatever { class AddOnInit //whatever { file = "KK\init"; //path to script within addon class onAddOnInit //file name without fn_ (actual file fn_onAddOnInit + extension) { ext = ".sqf"; //extension forced = 1; //execute on addon initialisation }; }; }; }; This code added to config.cpp inside @KK addon (for example) will execute fn_onAddOnInit.sqf which is inside \init folder only once on: client - when ArmA3 loads server - when player connects to the server for the first time Edited June 2, 2013 by Killzone_Kid 1st class name does not have to be A3 Share this post Link to post Share on other sites
fred41 42 Posted June 2, 2013 (edited) @killzone_kid, thanks for adding comments to the config.cpp code, its easier to use for everybody now ... (One point seems to need clarification: the forced start of the defined function seems to be exactly at mission start, at least me .rpt log files suggest it?) To your first question: this project is basically designed to monitor states (polling from MMF). To monitor events, i would prefer "named pipes" (just reading from FIFO). (If you need help for interfacing with callextension in your own projects, feel free to PM me your questions). BTW: There are already some nice, ready solutions to monitor and filter changes in .rpt files: https://sites.google.com/site/macsarmatools/rptmon May be this offers a better solution for you? Edited June 2, 2013 by Fred41 Share this post Link to post Share on other sites
killzone_kid 1331 Posted June 2, 2013 if i start arma with my mod enabled on the client the script gets executed as soon as mod is loaded not on mission start and on server when server has loaded the mod, this is why i called my function onaddoninit. also thanks for the link, i think i already passed this stage when we had dayz server and i wrote automatic antihack tool to work with be so i could sleep at night :). i looked up some examples, apparently writing to console in cpp is a walk in a park so disregard my request im fully capable of writing it myself. thanks again for showing the way with cfgfunctions approach. Share this post Link to post Share on other sites
terox 316 Posted June 2, 2013 thats a nice way to initiate a script, thx Fred41 Share this post Link to post Share on other sites
fred41 42 Posted June 3, 2013 (edited) ... and a bit more user friendly now ... 1. history graphs for values FPS, CPS, Players, AIs (200 samples) 2. visibility of graphs individual switchable 3. update interval of history selectable (1,5,10 or 30sec) 4. transparancy switchable (default transparency off, black background) 5. colors changed for more intuitive watching (hint: use the right mouse button to open one of two little popup menus) Edited June 5, 2013 by Fred41 Share this post Link to post Share on other sites
terox 316 Posted June 8, 2013 Having some issues here. ArmaServerMonitor.exe is running, pop up window is being displayed but there is no data or graphs I have the addon installed and running via a -mod line and the .dll file is also installed into the root directory of the server i am running My .rpt is reporting the following lines "ASM.fsm started" "ASM.fsm started" and I have a mission running on that server. FYI, the server is running as a service, could this be the reason? Share this post Link to post Share on other sites
fred41 42 Posted June 8, 2013 (edited) FYI, the server is running as a service, could this be the reason? ... yes, this should be the reason ... Can't really recommend to run a DS as a service (alpha, security), but i will upload a custom build of ASM for testing to github for you (link will follow). you only have to replace the two binarys: https://github.com/fred41/ASM/tree/master/binary_service ((run ArmaServerMonitor as Administrator) OR (run at least one DS instance BEFORE ArmaServerMonitor)) AND (a swapfile on your server is required) Terox, do you really have TWO "ASM.fsm started" entrys in your servers .RPT log? There should be only one. Did you start fn_ASM.fsm from init.sqf additional? Edited June 8, 2013 by Fred41 Share this post Link to post Share on other sites
terox 316 Posted June 10, 2013 (edited) ... yes, this should be the reason ...Can't really recommend to run a DS as a service (alpha, security), but i will upload a custom build of ASM for testing to github for you (link will follow). you only have to replace the two binarys: https://github.com/fred41/ASM/tree/master/binary_service ((run ArmaServerMonitor as Administrator) OR (run at least one DS instance BEFORE ArmaServerMonitor)) AND (a swapfile on your server is required) Terox, do you really have TWO "ASM.fsm started" entrys in your servers .RPT log? There should be only one. Did you start fn_ASM.fsm from init.sqf additional? Thanks for the test builds, working apart from AI count showing as 0 I can confirm two"ASM.fsm started" in my RPT They are next to each other and NO, I am not defining anything in any missions, this is just from running it from the addon only F.Y.I a lot of Dedi servers are run as services, normally using something like Firedeamon or TADST This is the normal method when you want to give admins the ability to start and stop the servers without giving them backend access. If you want some feedback and to get this out to a greater audience. 1) Offer a way of displaying this to a web page so it can be viewed without backend access. This is good for mission developers to monitor their test missions as well as admins to have the web page up on a second monitor when playing 2) Build it so it can work with either services and direct processes and you will have then a very useful tool. Good work by the way Edited June 10, 2013 by Terox Share this post Link to post Share on other sites
fred41 42 Posted June 11, 2013 Thanks for the test builds, working apart from AI count showing as 0I can confirm two"ASM.fsm started" in my RPT They are next to each other and NO, I am not defining anything in any missions, this is just from running it from the addon only F.Y.I a lot of Dedi servers are run as services, normally using something like Firedeamon or TADST This is the normal method when you want to give admins the ability to start and stop the servers without giving them backend access. If you want some feedback and to get this out to a greater audience. 1) Offer a way of displaying this to a web page so it can be viewed without backend access. This is good for mission developers to monitor their test missions as well as admins to have the web page up on a second monitor when playing 2) Build it so it can work with either services and direct processes and you will have then a very useful tool. Good work by the way Thanks for reporting and ideas. AI counting is fixed now (i used playableUnits, instead of allUnits in fn_ASM.fsm). So all you have to do for update, is replacing the ASM.pbo file. But i am not able to reproduce the other aberration (starting fn_ASM.fsm twice on your system). So i simple added a check to the fsm init, to avoid an second start. Making this monitor a web service is a good idea and i will think about this later (currently it is beyond my "arma time window"). Share this post Link to post Share on other sites
killzone_kid 1331 Posted June 11, 2013 Thanks for reporting and ideas. AI counting is fixed now (i used playableUnits, instead of allUnits in fn_ASM.fsm). So all you have to do for update, is replacing the ASM.pbo file. But i am not able to reproduce the other aberration (starting fn_ASM.fsm twice on your system). So i simple added a check to the fsm init, to avoid an second start. Making this monitor a web service is a good idea and i will think about this later (currently it is beyond my "arma time window"). How much data are we talking about? Pretty sure you can poke a php script every so often at designated url with updated params. Will make integration with web a piece of cake. Share this post Link to post Share on other sites
fred41 42 Posted June 11, 2013 (edited) How much data are we talking about? Pretty sure you can poke a php script every so often at designated url with updated params. Will make integration with web a piece of cake. just this, one per instance, updated one per second: struct ARMA_SERVER_INFO { DWORD PID; DWORD TID; DWORD PLAYER_COUNT; DWORD AI_COUNT; FLOAT SERVER_FPS; FLOAT FSM_CE_FREQ; char MISSION[64]; }; Are you able to interface this to a web page? I could give you the source of the .dll if you like (just a few lines). The best is: There is currently no worker thread implemented, you could add one, as usual :) Edited June 11, 2013 by Fred41 Share this post Link to post Share on other sites
terox 316 Posted June 11, 2013 how much more load would it create if you also had the data in/out bandwidth displayed as "Total" and as "Per player". per player being an average Share this post Link to post Share on other sites
fred41 42 Posted June 11, 2013 how much more load would it create if you also had the data in/out bandwidth displayed as "Total" and as "Per player". per player being an average ... AFAIK, this data are not available per .sqf (directly or indirectly), or i am wrong? It should be generally possible to get the bandwidth per process (Total), via windows ressource monitor api. Not sure, but i think so. Share this post Link to post Share on other sites
terox 316 Posted June 11, 2013 this info is given out when the admin runs "#monitor 5"; AFAIK the only way to run these commands via a script requires an admin to be logged in, then you could do something like the following if (servercommandavailable "#monitor 1")then{servercommand................ Not sure how you would log this data though If time is precious, any spare time you have on this project would be better spent in other areas Share this post Link to post Share on other sites