-
Notifications
You must be signed in to change notification settings - Fork 0
hub
The hub class is one of the major component of the framework. This class let you made multiple call between controller or hubs probe in a easy way. A lot of methods directly return sub-class (Robots, tunnels, queues etc..).
If you think something is missing feel free to create an issue or made a pull-request !
Name | Type |
---|---|
name | string |
robotname | string |
addr | string |
domain | string |
ip | string |
port | number |
status | number |
version | string |
origin | string |
source | string |
last | string |
license | string |
sec_on | string |
sec_ver | string |
ssl_mode | number |
ldap | string |
ldap_version | string |
tunnel | yes or no |
uptime | number |
started | string date |
$Console->print($hub->{variableName});
The hub class take a pds as argument. You can create this PDS by yourself or take one from a nimsoft Request.
sub getLocalHub {
my ($self) = @_;
my $PDS = pdsCreate();
my ($RC,$NMS_RES) = nimNamedRequest("hub","get_info",$PDS,1);
pdsDelete($PDS);
if($RC == NIME_OK) {
my $RobotNFO = Nimbus::PDS->new($NMS_RES)->asHash();
my $PDS = new Nimbus::PDS();
foreach my $key (keys $RobotNFO) {
$PDS->put($key,$RobotNFO->{$key},PDS_PCH);
}
return $RC,new perluim::hub($PDS);
}
else {
return $RC,undef;
}
}
Return NIMRC,Hash
Execute the callback "get_info" from controller probe.
my ($RC,$HashInfo) = $hub->getInfo();
if($RC == NIME_OK) {
$Console->print($HashInfo->{processor_type});
}
Return NIMRC,Hash
Execute the callback get_environment
from controller probe. You can put a variable as argument if you want to check if this variable exist or not.
my ($RC,$HashEnv) = hub->getEnv('PERL5LIB');
if($RC == NIME_OK) {
$Console->print('Perl5Lib is installed on this hub!');
}
Return archive class (archive.pm)
Put probePort as argument if you want to use local
call from archive. That can be the port of ADE
or Distsrv
as well.
my $hub_archive = $hub->archive();
$hub_archive->deletePackage(pkg); # Exemple, you need pkg here !
Return NIMRC
Unsubsribe robot from a hub.
my $RC = $hub->removeRobot('test_robot');
if($RC == NIME_OK) {
# ...
}
Return NIMRC,Hash
Get all robots or only one by putting the name at first argument. (As HASH).
my ($RC,$Hash) = hub->getRobots();
if($RC == NIME_OK) {
# ...
}
Return NIMRC,Array of robot
Get all robots in an array Object.
my ($RC,@Robots) = $hub->robotsArray();
if($RC == NIME_OK) {
# ...
}
Return NIMRC,Hash of robot
Get all robots in a Hash table. The key is the robot name.
my ($RC,%Robots) = $hub->robotsHash();
if($RC == NIME_OK) {
# ...
}
Return NIMRC,Array of probe
You can put a probeName as argument if you want only one probe.
my ($RC,$ProbeList) = $hub->probeList('cdm');
if($RC == NIME_OK) {
$Console->print($ProbeList->{cdm}->{name});
}
Return NIMRC,Array of tunnel
my ($RC,@Tunnels) = $hub->tunnelsList();
if($RC == NIME_OK) {
foreach(@Tunnels) {
$Console->print($_->{id});
}
}
Return NIMRC
Active or deactive a queue (with 1 or 0 as state argument).
my $RC = $hub->setQueue_state('HUB_QUEUE_1',1);
if($RC == NIME_OK) {
# ...
}
Return NIMRC
queueName is not an optional argument.
my $RC = $hub->queueDelete('HUB_QUEUE_1');
if($RC == NIME_OK) {
$Console->print("Queue deleted successfully");
}
Return NIMRC,Array of queue
my ($RC,@Queues) = $hub->queueList();
if($RC == NIME_OK) {
foreach(@Queues) {
$Console->print($_->{subject});
}
}
Return NIMRC
Probe_verify callback from controller.
my $RC = $hub->probeVerify('logmon');
if($RC == NIME_OK) {
# ...
}