Page 1 of 1

Obtaining parameters from the admin panel

Posted: 18 Aug 2015, 13:42
by Zed
Hi!
We are interested in the possibility of obtaining from the admin panel on the server side parameters such as: use of CPU, Memory, Extension Message Queue count, system message queue count, the number of players.

We want to make an utility for nagios. Our support team needs these parameters for server monitoring.

How we can obtain these parameters from SFS server?

Thanks.

Re: Obtaining parameters from the admin panel

Posted: 18 Aug 2015, 14:28
by Lapo
Hi,
CPU and Memory are coming directly from the JVM:
http://stackoverflow.com/questions/4717 ... ge-in-java
Extension Message Queue count:

Code: Select all

BitSwarmEngine.getInstance().getControllerManager().getControllerById(0).getQueueSize();
system message queue count

Code: Select all

BitSwarmEngine.getInstance().getControllerManager().getControllerById(1).getQueueSize();
the number of players
That depends on the Zone. You can have one or many... so first you need to select the zones that you want to check
Zone zone = SmartFoxServer.getInstance().getZoneManager().getZoneByName("myZone");
zone.getUserCount();

cheers

Re: Obtaining parameters from the admin panel

Posted: 18 Aug 2015, 14:43
by Lapo
Oh wait... I noticed you posted under the SFS PRO section, but my reply is valid for SFS2X :)

Are you asking for SFSPRO?

Re: Obtaining parameters from the admin panel

Posted: 18 Aug 2015, 15:25
by Zed
Lapo wrote:Oh wait... I noticed you posted under the SFS PRO section, but my reply is valid for SFS2X :)

Are you asking for SFSPRO?
No, i asked about 2x.
Missed thread, sorry
Thanks :)

Re: Obtaining parameters from the admin panel

Posted: 18 Aug 2015, 16:13
by Lapo
Moved, no problem

Re: Obtaining parameters from the admin panel

Posted: 19 Aug 2015, 14:14
by Zed
Lapo wrote:Hi,
Extension Message Queue count:

Code: Select all

BitSwarmEngine.getInstance().getControllerManager().getControllerById(0).getQueueSize();
system message queue count

Code: Select all

BitSwarmEngine.getInstance().getControllerManager().getControllerById(1).getQueueSize();
getControllerById(0) and getControllerById(1) return null value.
What im doing wrong?

Re: Obtaining parameters from the admin panel

Posted: 19 Aug 2015, 14:33
by Lapo
try using this:
getControllerById((byte) 0); and getControllerById((byte) 1)

I am going by memory... the controller ID should be a byte.

Re: Obtaining parameters from the admin panel

Posted: 20 Aug 2015, 13:44
by Zed
Lapo wrote:try using this:
getControllerById((byte) 0); and getControllerById((byte) 1)

I am going by memory... the controller ID should be a byte.
It works! Thanks.