Ventrilo Server Status

By TheImrac on Jul 11, 2009

Quick snippet I threw together to get the status of a ventrilo server. I was unable to directly query a server because of the semi-proprietary way you have to ask for the status, instead I used a xmlish feed from an outside webhost.

To use, just make a variable %vent with ip:port

Have fun.

UPDATED Sunday, July 12, 2009

Added a GUI vent status thing, its rough, not much error check just enough to show what could be done. I will also need to work out a way to sort by channels CID parameter rather than alphabetic to get a more accurate representation of the server layout.
Usage: /ventg ip:port

Image

alias ventc {
  sockopen ventc ventrilostatus.net 80
  sockmark ventc $1-
  .timervent 1 3 vent_timeout
}

alias vent_timeout {
  var %msg = $gettok($sock(vent).mark,2,32)
  msg %msg Sorry, but the server took to long to respond or is down. Try again later.
  sockclose vent
}

alias ventg {
  sockopen ventg ventrilostatus.net 80
  sockmark ventg $1
}

on *:SOCKOPEN:vent*:{
  If ($sockerr) { echo error | halt }
  sockwrite -n $sockname GET /xml/ $+ $gettok($sock($sockname).mark,1,32) $+ / HTTP/1.1
  sockwrite -n $sockname Host: ventrilostatus.net
  sockwrite -n $sockname $crlf 
  If ($hget(vent)) hfree vent
}

on *:SOCKREAD:ventc:{
  var %x
  sockread %x
  If ($regex(sv,%x,/^<server name="(.*)" phonetic="(.*)" comment="(.*)" auth="(.*)" maxclients="(.*)" uptime="(.*)" platform="(.*)" version="(.*)" channelcount="(.*)" clientcount="(.*)" voicecodec="(.*)" voiceformat="(.*)">/i)) {
    var %svinfo = The3 $regml(sv,1) (03 $+ $+ $gettok($sock($sockname).mark,1,32) $+ ) Ventrilo server is online and has been up for3 $duration($regml(sv,6)) $+ . Users:3 $regml(sv,10) $+ /03 $+ $regml(sv,5)
    var %c = $regex(client,%x,/<client(.*?)/>/ig), %users
    While (%c) {
      noop $regex(info,$regml(client,%c),/admin="(.*)" phan="(.*)" ping="(.*)" sec="(.*)" cid="(.*)" name="(.*)" comm="(.*)"/i)
      %users = %users $iif($regml(info,1),07,) $+ $regml(info,6) $+ 
      dec %c   
    }
    var %msg = $gettok($sock($sockname).mark,2,32)
    msg %msg %svinfo
    msg %msg Current Users: %users
    .timervent off
    sockclose ventc
  }
}

on *:TEXT:*:#:{ If ($regex($1-,/^[!^&@.]v(ent(irlo)?)?$/iS)) { ventc %vent # } }

;<channel pid="-1" prot="0" cid="0" name="Lobby" comm="">
on *:SOCKREAD:ventg:{
  window @test 10 10 300 600
  clear @test
  var %x
  sockread %x
  var %y = $regex(main,%x,/(<.*?>)/gi), %z = 1, %tb = 0
  while (%z <= %y) {
    var %m = $regml(main,%z)

    If (%m == </channel>) dec %tb 1
    ElseIf ($regex(c,%m,/<channel pid="(.*)" prot="(.*)" cid="(.*)" name="(.*)" comm="(.*)"(/?)>/)) { 
      aline @test $+($str(  ,%tb),,$replace($iif($regml(c,2),$v1,3),1,08,2,05,3,10),$iif($regml(c,6),+,-),,$regml(c,4))
      if (!$regml(c,6)) { inc %tb 1 }
      ;aline @test CID: $regml(c,3)
    }
    ElseIf ($regex(cl,%m,<client admin="(.*)" phan="(.*)" ping="(.*)" sec="(.*)" cid="(.*)" name="(.*)" comm="(.*)"/>)) {
      aline @test $+($str(  ,$calc(%tb + 1)),05» ,$iif($+($iif($regml(cl,1),A,),$iif($regml(cl,2),P,)),14 $+ $qt($v1) ,),$regml(cl,6))
    }
    inc %z 1
  }
}

Comments

Sign in to comment.
Gosy   -  Mar 27, 2012

Oh : damn, i would really love to have that script to be honest :

 Respond  
TheImrac   -  Mar 27, 2012

Not sure its possible. This does not interact with the ventrilo server directly, rather through a third party web site.

 Respond  
Gosy   -  Mar 22, 2012

Awesome script man, but could you also do something like this script but for ventrilo instead?
http://www.hawkee.com/snippet/7325/

 Respond  
Spanky   -  Jul 14, 2009

-ignore this i didnt read the script right-

 Respond  
TheImrac   -  Jul 12, 2009

Oops sorry, while testing I commented out the messaging part ><

 Respond  
deeps   -  Jul 12, 2009

hmm for some reason this stopped working for me when i updated it with the new script provided :(

 Respond  
TheImrac   -  Jul 12, 2009

Updated, read above.

 Respond  
GrimReaper   -  Jul 11, 2009

why not add

on *:LOAD: {
set %vent $$?="Set IP and Port in the Format IP:PORT"
}

to the top of your script. then they can add it if they know the IP and Port number.

also Great work on the script

9/10 it will come in handy :>

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.