#!/usr/bin/perl -w # # Copyright (C) 2011-2013 Cesnet z.s.p.o # # Use of this source is governed by a BSD-style license, see LICENSE file. use strict; #------------------------------------------------------------------------------ # Warden 2.2 Client, Info, Example # # Simple use of warden-client Info functionality to receive information about # client registered to Warden server. This code illustrates how to integrate # warden-client info functionality into local applications. #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ # This code should developer add into his/her application. # Path to warden-client directory my $warden_path = '/home/soukal/pokus/warden/warden-client/'; # Inclusion of warden-client receiving functionality require $warden_path . '/lib/WardenClientCommon.pm'; my @clients = WardenClientCommon::getClientsInfo($warden_path) or exit 1; # receive data or exit print "+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n"; print "| Client ID | Hostname | Registered | Requestor | Service | CT | Type | ROE | Description tags | IP Net Client |\n"; print "+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n"; foreach (@clients) { printf("| %-10s ", @$_[0] || "unknown"); printf("| %-30s ", @$_[1] || "unknown"); printf("| %19s ", @$_[2] || "unknown"); printf("| %-23s ", @$_[3] || "unknown"); printf("| %-25s ", @$_[4] || "unknown"); printf("| %-2s ", @$_[5] || "unknown"); printf("| %-15s ", @$_[6] || "unknown"); printf("| %-4s ", @$_[7] || "unknown"); printf("| %-50s ", @$_[8] || "unknown"); printf("| %-18s |\n", @$_[9] || "unknown"); } print "+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n"; print "\n"; print "Current registered clients in: " . scalar localtime(time) . "\n"; exit 0;