Server statistics plugins for Munin
Server statistics plugins for Munin
It was summer of 2007 when these plugin first saw the daylight.
http://css.setti.info/code/munin-srcds/
At the time there was lots of fuzz about server FPS and such. People, players and other server admins, were throwing out stupid ideas about what server FPS is and how it’s noticeable in-game. GSPs (Game Server Providers) were (and are) selling 1000 FPS servers. Nobody actually knew anything about how the FPS behaves on a server.
Aside of the server FPS, the server says its uptime, number of players, number of users (which probably means RCON accesses?) and network traffic on console command “stats”. These stats were easy to piece together along with FPS stats. There’s also “CPU” entry in the stats command output, but it’s considered extremely inaccurate, and as such left out from the plugins.
After almost a year of having these plugins mostly for our own use, there came need for something better. The initial versions of the plugins graphed only one server. On April 2008 the plugins got facelift to wildcard versions, supporting as many servers as possible.
Briefing to Munin plugins
Munin plugins are easy to write. All they need to do is print out rrdtool compatible configuration string for the “rrd-database” initialization, and then print out measured statistics in simple “key.value xyz” style. Then there are also “autoconfig” and “suggest” features, which help installing the plugins.
Autoconfig is used to determine if it is even possible to run a plugin on the server. In all Munin plugins there should be this autoconfig feature, which says either “yes” or “no” depending on whether the plugin can be used on the particular host. Additionally it should say “no (reason why it can’t be used)” to help server administrators to get the plugin installed correctly. If the answer is “yes”, then there’s no need to further break down why it can be used - obviously :).
Suggest functionality is slightly more complex. It’s used with so called “wildcard plugins”, which are just like normal plugins, but they take parameter after the base plugin name. For example plugin “if_” is used to gather statistics from network interfaces, but there can be several network interfaces such as eth0 for LAN and eth1 for ADSL modem - or some weirdo GSM interface(?). Thus, the “if_” plugin would be linked as “if_eth0″, “if_eth1″ and “if_gsm”. Then all network interfaces would have their own statistics generated by Munin without the need to have one plugin for each network interface. Suggest feature comes in here. It suggests how the wildcard plugin should be linked to the Munin plugin directory. In this example case it would say “eth0″, “eth1″ and “gsm”. Then Munin would automatically know how to activate the plugin.
Special Munin functionality in the srcds_* plugins
The source dedicated server (srcds) plugins have autoconfig feature but not suggest. Suggest feature would’ve been somewhat difficult to implement, because the plugins need to have RCON password defined separately. The idea in the suggest feature is that there’s no need for further configuration after the somewhat automagical installation phase. Autoconfig however works, because it can say “yes” or “no” depending on whether it found the RCON tool or if it could connect to the defined game server.
Terrible truth
It turned out that the server FPS was fluctuating a lot. There were many custom compiled servers on Setti CSS server, but FPS-wise they all performed badly(*). Less hi-tuned kernel turned out to be better FPS-wise. Still, the FPS is clearly fluctuating along with the number of players.

At morning hours the FPS seems to be varying between 400 and 500. At the evening the FPS can be seen to drop closer to 300. That’s because there are fewer players on the server at mornings than on evenings. There are two bots on the server at night time, so that’s why the FPS probably fluctuates at morning hours too.
The FPS plugin also takes several samples from the server to ensure that the values just don’t happen to be extreme. It calculates mean (alternatively median, can be configured directly to the plugin) value from the samples. The default Munin timeout value, however, is about three seconds, so the plugin takes five samples in about 0.2 second intervals. In reality this means about five samples in 1.5-2.0 seconds. It should be close enough the truth at any given time - except on map changes - on the server.
Well adequate
Now we can be sure that there’s at average about 450 FPS server running at css.setti.info:27015. Nice.
How about your server?
Start from http://css.setti.info/code/munin-srcds/
Post your server stats to the forum thread considering the plugin.
(*) Note: The server running Setti CSS server also runs a high-traffic MySQL database configured to extreme extents, which may have caused the hi-tuned kernels perform less than optimal.


