Forum Discussion
Pushkar_73645
Feb 26, 2012Nimbostratus
icontrol call for 10.1.0
I am trying to find out soap calls for following.
1) Any active user sessions
2) Find out sync status in an active/active configuration
I was looking through icontrol doc...
Hamish
Feb 27, 2012Cirrocumulus
It's a DB call. There's s perl program to so this in the codeshare at https://devcentral.f5.com/wiki/iControl.walkF5Stats.ashx that i wrote a few years back.
the relevant code (Apologies for the line numbers) is
----------------------------------------------------------------------------
0359 getConfigSyncStatus
0360----------------------------------------------------------------------------
0361sub getConfigSyncStatus {
0362 my $dbh=$_[0];
0363 my $dev=$_[1];
0364 my $t0=[gettimeofday];
0365
0366 my $devID=$dev->{ID};
0367 @dbKeys = (
0368 "configsync.autodetect",
0369 "configsync.localconfigtime",
0370 "configsync.peerconfigtime",
0371 "configsync.localsyncedtime",
0372 "configsync.state");
0373 (@dbValues) = &getDBVariable($dev, @dbKeys);
0374
0375 my $autodetect;
0376
0377 dbprint "check " , gmtime($dbValues[1]);
0378
0379 print "CONFIG SYNC STATUS --\n";
0380 if ( "disable" eq $dbValues[0] ) {
0381 Standalone
0382 dbprint " Status: disabled\n";
0383 dbprint " Last change (Self): ", strftime("%Y%m%dT%H%M%SZ", gmtime($dbValues[1])), "\n";
0384 $autodetect=0;
0385 } else {
0386 HA Pair
0387 $autodetect=1;
0388 dbprint " Status: $dbValues[4]\n";
0389 dbprint " Last change (Self): ", strftime("%Y%m%dT%H%M%SZ", gmtime($dbValues[1])), "\n";
0390 dbprint " Last change (Peer): ", strftime("%Y%m%dT%H%M%SZ", gmtime($dbValues[2])), "\n";
0391 dbprint " Last Configsync: ", strftime("%Y%m%dT%H%M%SZ", gmtime($dbValues[3])), "\n";
0392 }
0393 get the current f5deviceSync information. This creates blank info if one doesn't exist already...
0394 my $f5dS=getDBDeviceSync($dbh, $devID);
0395
0396 Update the information... If it's changed. And set an alert or warning (In DB only?)...
0397 my $localcfgtime=strftime("%Y%m%dT%H%M%SZ", gmtime($dbValues[1]));
0398 my $peercfgtime=strftime("%Y%m%dT%H%M%SZ", gmtime($dbValues[2]));
0399 my $localsynctime=strftime("%Y%m%dT%H%M%SZ", gmtime($dbValues[3]));
0400
0401 my ($statusCode)=($dbValues[4] =~ /(\d+) \-/);
0402
0403 dbprint "getConfigSyncStatus: Status code of $statusCode from $dbValues[4]\n";
0404
0405 if(($localcfgtime ne $f5dS->{localcfgtime})||($peercfgtime ne $f5dS->{peercfgtime})||($localsynctime ne $f5dS->{localsynctime})) {
0406 dbprint " Status Change. Updating DB\n";
0407 my $updatestr="update f5deviceSync set autodetect=$autodetect,localcfgtime='$localcfgtime',peercfgtime='$peercfgtime',localsynctime='$localcfgtime',state='$dbValues[4]' where id=$devID";
0408 dbprint "getConfigSyncStatus: SQL [$updatestr]\n";
0409
0410 my $update=$dbh->prepare($updatestr);
0411
0412
0413 $update->execute;
0414
0415
0416 }
0417 my $elapsed=tv_interval ( $t0 );
0418 log_action($elapsed, 0, "getConfigSyncStatus", "");
0419
0420 $t0=[gettimeofday];
0421
0422 Not very useful... This overwrites the last one... Needs fixing...
0423 my $updatestr="update cluster,cluster_device set insync=$statusCode where cluster.clusterid=cluster_device.clusterid and cluster_device.deviceid=$devID";
0424 dbprint "getConfigSyncStatus: SQL [$updatestr]\n";
0425
0426 my $update=$dbh->prepare($updatestr);
0427 $update->execute;
0428
0429 $updatestr="update device set sync=$statusCode where id=$devID";
0430 $update=$dbh->prepare($updatestr);
0431 $update->execute;
0432
0433 my $elapsed=tv_interval ( $t0 );
0434 log_action($elapsed, 0, "getConfigSyncStatus", "$updatestr");
0435
0436}
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects