Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Tools

Development::Tools 3rd Party Tools for EQEMu (DB management tools, front ends, etc...)

Reply
 
Thread Tools Display Modes
  #1  
Old 11-27-2009, 08:21 PM
cubber
Discordant
 
Join Date: Apr 2006
Posts: 374
Default Perl Server Status Script

I wrote this script so that I could check the status of my linux eqemu server from a terminal window without going through a web interface.

You need Net::Telnet installed on the machine running the scirpt.

The code uses the telnet interface on the eqemu server so that needs to be enabled in the config. The script is set to use the default eqemu telnet port of 9000. If your using a different port then changes this accordingly.

Code:
#!/usr/bin/perl

#eqstatus.pl
#By:Cubber
#Script to print out information about the eqemu server
#Uses Net::Telnet module
#11-25-2009

use strict;
use warnings;
use Net::Telnet();

my $telnet;

$telnet = new Net::Telnet (Timeout=>10, Port=>'9000', Prompt=>'/\> $/');

#Enter Server IP Here
$telnet->open("192.168.1.21");

#Enter Telnet enabled account username and password here.
$telnet->login("username", "password");  

my @version;

@version = $telnet->cmd("version");
my $vercnt = $#version;
my $i;

for($i=1;$i<$vercnt;$i++)
	{
		print $version[$i];
	}

print "\n";

my @uptime;

@uptime =  $telnet->cmd("uptime");
print $uptime[1];
print "\n";

my @who;

@who = $telnet->cmd("who");
my $whocnt = $#who;

for($i=1;$i<$whocnt;$i++)
	{
		print $who[$i];
	}

print "\n";

my @zones = $telnet->cmd("zonestatus");
my $zonecnt = $#zones;

for($i=1;$i<$zonecnt;$i++)
	{
		print $zones[$i];
	}

print "\n";
The output, note items in green have been changed to foobar to protect the innocent!

Code:
Current version information.
  EQEmulator 0.8.0
  Compiled on: Nov 25 2009 at 18:47:31
  Last modified on: 18:47:31

Worldserver Uptime: 02d 00h 11m 23s

Players on server:
  [66 Transcendent] PLAYERNAME (Iksar) <GUILD NAME> zone: bothunder AccID: ID# AccName: ACCNTNAME LSID: ID# Status: 0
1 players online

World Locked: No
Zoneservers online:
  #23  S       127.0.0.1:58197  0  :7022  potranquility (203)
  #22  S       127.0.0.1:58196  0  :7021  poknowledge (202)
  #21          127.0.0.1:58195  1  :7020  bothunder (209)
  #20          127.0.0.1:58194  0  :7019  
  #19          127.0.0.1:58193  0  :7018  
  #18          127.0.0.1:58192  0  :7017  
  #17          127.0.0.1:58191  0  :7016  
  #16          127.0.0.1:58190  0  :7015  
  #15          127.0.0.1:58189  0  :7014  
  #14          127.0.0.1:58188  0  :7013  
  #13          127.0.0.1:58187  0  :7012  
  #12          127.0.0.1:58186  0  :7011  
  #11          127.0.0.1:58185  0  :7010  
  #10          127.0.0.1:58184  0  :7009  
  #9           127.0.0.1:58183  0  :7008  
  #8           127.0.0.1:58182  0  :7007  
  #7           127.0.0.1:58181  0  :7006  
  #6           127.0.0.1:58180  0  :7005  
  #5           127.0.0.1:58179  0  :7004  
  #4           127.0.0.1:58178  0  :7003  
  #3           127.0.0.1:58177  0  :7002  
  #2           127.0.0.1:58176  0  :7001  
  #1   S       127.0.0.1:58175  0  :7000  bazaar (151)
23 servers listed. 23 servers online.
3 zones are static zones, 1 zones are booted zones, 19 zones available.
I have more ideas for this to work on in the future. I will update this thread as I evolve the script.

Enjoy!
Reply With Quote
  #2  
Old 11-28-2009, 12:04 PM
cubber
Discordant
 
Join Date: Apr 2006
Posts: 374
Default

I revised the script and put all of the telnet commands into sub functions.

Code:
#!/usr/bin/perl

#eqstatus.pl
#By:Cubber
#Script to print out information about the eqemu server
#Uses Net::Telnet module
#11-25-2009

use strict;
use warnings;
use Net::Telnet();

my $i;
my $telnet;

$telnet = new Net::Telnet (Timeout=>10, Port=>'9000', Prompt=>'/\> $/');
$telnet->open("192.168.1.21");
$telnet->login("username", "password");

&Version;
&Uptime;
&Who;
&Zones;
exit;

sub Version()

{

my @version;

@version = $telnet->cmd("version");
my $vercnt = $#version;

for($i=1;$i<$vercnt;$i++)
	{
		print $version[$i];
	}

print "\n";

}


sub Uptime()

{

my @uptime;

@uptime =  $telnet->cmd("uptime");
print $uptime[1];
print "\n";

}


sub Who()

{

my @who;

@who = $telnet->cmd("who");
my $whocnt = $#who;

for($i=1;$i<$whocnt;$i++)
	{
		print $who[$i];
	}

print "\n";

}

sub Zones()

{

my @zones = $telnet->cmd("zonestatus");
my $zonecnt = $#zones;

for($i=1;$i<$zonecnt;$i++)
	{
		print $zones[$i];
	}

print "\n";

}
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 09:04 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3