Good morning,
Need some assistance initializing (objIControl.initialize) as it fails to return true. I downloaded the iControlAssembly and ran the testclient which also returns the error ‘not initialized’ from the command prompt. This tells me known good code is having the same issue as my code.
What is strange is that I can log into the BIG-IP’s cgi URL from the same server I’m running the code from, the CGI URL returns the data I’m looking to use. This tells me that the network connectivity is good and my credentials work to access the BIP’s API. Using IE 7.0 I’m prompted to accept the issue with the BIG-IP’s local certificate and then I’m challenged for credentials. Do you think having to acknowledge the certificate issue is causing the code to fail?
Below is the VB .net code I’m testing connectivity with in VS 2008. I also have issues initializing the icontrol object from C code shown on DevCentral. Any guidance on how to fix this issue would be greatly appreciated. After successfully initializing the connection I’m looking to disable pool members one by one as we institute a weekly scripted reboot job on our Windows 2003 server web farm.
Thanks for your assistance!
Wade
https://" + bigip_address + "/iControl/iControlPortal.cgi
Basic VB .net code I’m using to test the iControl object:
Module Module1
Sub Main()
Dim objIControl As New iControl.Interfaces
Dim arrPoolList As Array
Dim isGood As Boolean
isGood = objIControl.initialize(“172.16.200.8”, 443, “adminuser”, “adminuserpass”, “proxy.contoso.com”, 8080, “proxyuser”, “proxyuserpass”)
'arrPoolList = objIControl.LocalLBPool.get_list
'For x = LBound(arrPoolList) To UBound(arrPoolList)
'Console.WriteLine("Pool name = " & arrPoolList(x))
'Next x
End Sub
End Module
Hi Wade,
Just starting with the easy stuff, did you check that the version of the .NET Framework on the machine is in line with the assembly requirements? If so we’ll move on, but I like to check the easy bit first :-).
Don.
Hey Don,
I have 1.0, 1.1.4, 2.0, 3.0,3.5 installed on my 2003 dev server. The VB project I loaded in VS 2008 to test the code out in is using both 2.0 and 3.5 depending on which dll is being referenced. Check out the attached document for screen shot of the program’s dll’s framework version being referenced. What dot framework is the sample testlclient using which i downloaded from devcentral? The testclient also receives the not initialize error.
Thanks!
Wade
Okay, one down. I don’t maintain it, but Joe told me once it requires 2.0 or later.
My next suggestion would be to try accessing it with the SDK samples (as opposed to the assembly, which masks exceptions)… you can download it here: http://devcentral.f5.com/wiki/default.aspx/iControl/F5Downloads.html and I would simply download it, install it, and build one of the samples per the instructions, then run it.
At least with this version if it errors out it will tell you why it did. We could try guessing at it and checking things like connectivity and SSL transport, but better to just let the API tell you what went wrong.
Let us know how it goes!
Don.
Don,
I had tried that earlier. I ran the testclient app which came with the assembly and recieved the “Not Initialized” error. Basically the same issue my VB code is having.
Ideas? I’m still stuck.
Hey Wade,
I meant the actual API - the Assemblies are wrappers over the API. Try downloading the API here: http://devcentral.f5.com/wiki/default.aspx/iControl/F5Downloads.html
At the top of the page are the APIs, below them are the wrappers.
What happens with the assemblies is that they make API calls and catch Exceptions, so “Not Initialized” is the assembly’s way of saying “there was an Exception, I caught it, but we can’t connect”. By downloading the core API and building one of those samples, there won’t be anything to catch the exception and you can see what’s actually going on.
Hope that helps!
Don.
Hi Don,
I downloaded the API and ran the VB sample “Pool.exe” with the bip ip’s IP address, username and password. The pool.exe returned the error "The remote server returned an error: (407) Proxy Authentication Required. This does return some results when Googling the error which I need to see if they apply to my situation.
Looking at the command line arguments for pool.exe I can’t pass my proxy values to it. Although, the VB code I wrote did pass proxy address, port, username and password as parameters and that code would not initialize either.
thanks for your help,
Wade
I was reading the iControl Quickstart Guide for .NET and noticed the blurb below but I dont have access to the link to configuring ‘Configuring .NET SSL Security in a Trusted Environment’. This looks important and seems like I may need to do this for my development environment.
How do i get access to the article?
‘start blurb’
Configuring .NET Security
To configure the client environment in .NET to allow communication with servers using un-trusted or self-signed server certificates, see the article Configuring .NET SSL Security in a Trusted Environment on this site.
‘end blurb’
error received:
You do not have access to view this tab within the portal.
Hi Again Wade,
Odd… I can see it as a not-even-logged-in user, both from my laptop and my Blackberry.
I hate to ask this, but can you try again by going here: http://devcentral.f5.com/Default.aspx?tabid=63&articleType=ArticleView&articleId=4
If the direct link takes you there, then there’s something broken with the links you followed and we’ll need to figure that out. If it doesn’t work for you, we’ll have to look elsewhere for the problem.
Thanks,
Don.
Yes, the direct linked worked. sorry to bother with stupid PEBKAC questions.
Also, great news, I compiled the SDK code as you suggested and made my first successful connection to the BIG-IP. I loaded the VB .Net project ‘iControl-9.6.0\sdk\samples\soap\vb\microsoft\LocalLB\Pool’ and built a pool.exe which connected successfully from a command prompt once I learned the proper parameters to pass it. I’m so stoked.
My next steps are to look at the pool.vbproj and see what code I can use to make a connection to the BIG-IP and gracefully shutdown a node. It’s definately a lot more complicated to get the initialize connection up and running in C or VB .Net than this article leads you to believe http://devcentral.f5.com/Default.aspx?tabid=68. I wish it were as simple as only adding a reference iControl.dll to a vb or c project. Let me know how I missed the bus here if you can.
My main goal is to integrate that code call into VBScript if possible to work inconjunction with a weekly IIS 6.0 web server reboot job we run after hours. The code is important because we want to stop connections to the web application gracefully before we reboot. There’s a similar app written out on the devcentral site but its written in perl http://devcentral.f5.com/Default.aspx?tabid=63&articleType=ArticleView&articleId=254.
I’m not sure if I’ll be able to instantiate the iControl objects from a vbscript. If not, I’ll write something similar to the pool.exe in VB .Net and use WMI to start the pool.exe process remotely and pass it parameters so I can keep the whole process automated.
Let me know if you know a more succinct way to accomplish my goal.
Thanks for your ideas and assistance!
Hey Again,
I am going to ping Deb at her new role, she sometimes answers these questions with things like “oh. You can just configure a monitor to do that!” I don’t think that will be the case here, but I’ll check to be sure.
The document you’re reading assumes the assembly is being used, not the core API - we wrote the assemblies and the Java Wrappers to make using the API easier, and you’re feeling that difference.
I’ve never tried to hit iControl from VBScript, I think you just gave me a tech tip to research. While it should be possible, I’ll go toy with the how. If you can use powershell, this should be done for you - Joe has written a lot of great powershell stuff, but you’d have to have PS installed.
I’ll check back when I hear from Deb.
Don.
Sure, I think you can do something a bit simpler with iRules or a monitor, actually:
Set “Action on Service Down” to “None” on the pool settings. (Click here to read the LTM: Action on Service Down article for more on that setting)
Then you can set up either:
an iRule that marks the node DOWN using LB::down when a specific URI is seen
or
a 2nd monitor besides the app health monitor that looks at a specific page to determine if in the maint window.
iRule might be simplest/most deterministic, something like:
when HTTP_REQUEST {
if { [HTTP::uri] starts_with “/drainserver” } {
LB::down [LB::server pool] member [substr [HTTP::query] “ip=” 3 &] [substr [HTTP::query] “port=” 5 &]
}
}
Then you could send a URI like this to drain a specific server (10.101.0.1:80, in this case):
http://virtualserver.domain.com/drainserver?ip=10.101.0.1&port=80
Then you could script the http call above instead of the iControl bit.
HTH
/deb
Deb, thank you. I think I will go your route as I’m struggling with the SOAP APIs in VB .Net as I’m not the most talented programmer in the tool shed. The power of the APIs are awesome but I’m taking too long to complete the overarching goal.
Couple questions regarding your suggestions:
1) It seems that if someone knows the URI the iRule is waiting for they could disable members without permission, correct? If so, how could I prevent this using the IIS server’s NTLM authentication mechanism or another method?
2) We recently moved away the “Action on Service Down” from ‘none’ to ‘reselect’ as we thought it would help load balance away from faulty servers with less application interruption because the application state is kept in a SQL table not web server session object. Will marking the member ‘down’ as you mentioned drain stop the connections from the member like the ‘disable’ button does in the LTM’s GUI? Or does is it stop connection on the members abruptly? At the pool member management level in the GUI, the ‘disable’ button works very nicely for our application.
Thanks again for everyone’s time and effort in guiding me to a solution which fits our needs.
Wade
deb, that syntax doesnt compile in the iRule editor.
I think Deb left out the “pool” argument to LB::down.
when HTTP_REQUEST {
if { [HTTP::uri] starts_with “/drainserver” } {
LB::down pool [LB::server pool] member [substr [HTTP::query] “ip=” 3 &] [substr [HTTP::query] “port=” 5 &]
}
}
-Joe
This code seems better although its not shutting the node. I havent figured that out yet but at least it compiles and the right values are being passed and logged to the bip ip.
Why isnt the node going down with code like this? I tried using the LB::down node and LB::down node commands and they arent working. Is it because I’m passing the values via a variable name?
when HTTP_REQUEST {
if { [HTTP::uri] starts_with “/Drainserver”} {
LB::down [LB::server pool] member [substr [HTTP::query] 4 &] [substr [HTTP::query] 5 &]
set uri1 [findstr [HTTP::query] “ip=” 3 &]
set uri2 [findstr [HTTP::query] “port=” 5 &]
set uri [substr [HTTP::query] 5 &]
log “Uri Part = $uri1 Uri Part2 = $uri2”
log local0 [substr [HTTP::query] 3 &] [substr [HTTP::query] 5 &]
LB::down node $uri1
LB::down pool “QA_RTA_Future” member $uri1 $uri2
}
}
This is the error being logged while using the LB::down command. Do you what this is?
TCL error: Rule DrainServersForMaintenance HTTP_REQUEST - while executing LB::down pool QA_RTA_Future member 172.20.6.60 443
Have you verified that pool “QA_RTA_Future” is configured properly and that it has a member of 172.20.6.60:443? I’m assuming, since you are using an iRule, that you are terminating the SSL connection on the VIP. Are you re-encrypting the connection to the backend servers? If not, the pool member wouldn’t likely be running on port 443.
-Joe
Thanks Joe. Yes, i had something confused initially.
The iRule is working nicely now. Do you know a while loop i could use to check the session to know when they’re connections are bled off the node? I’ve seen the logic in the iControls but I’m not sure the objects are available to iRules.
Thank you,
Wade
Here is some working logic others could use:
**the string trimming may not have been necessary
URI to control the iRule
https://172.1.1.2/drainserver?ip=172.20.1.1&port=80&poolname=WadesPool&prioritystatus=active&
iRule:
when HTTP_REQUEST {
if { [HTTP::uri] starts_with “/drainserver”} {
set strSvrIP [string trim [findstr [HTTP::query] “ip=” 3 &]]
set strPort [string trim [findstr [HTTP::query] “port=” 5 &]]
set strPoolName [findstr [HTTP::query] “poolname=” 9 &]
set strPoolName [string trim [findstr [HTTP::query] “poolname=” 9 &]]
set strPriorityStatus [string trim [findstr [HTTP::query] “prioritystatus=” 15 &]]
if { $strPriorityStatus == “active” } {
LB::up pool “$strPoolName” “member” “$strSvrIP” “$strPort”
} elseif { $strPriorityStatus == “inactive”} {
LB::down pool “$strPoolName” “member” “$strSvrIP” “$strPort”
}
log “$strPoolName $strPort $strSvrIP was set to $strPriorityStatus by the server mainteance job on servernamehere”
HTTP::respond 200 content "Web Server Reboot Programmatic MaintenanceThank you. The $strPoolName pool member $strSvrIP was successfully set to $strPriorityStatus.
"
}
}
Deb / Joe,
when HTTP_REQUEST { if { [HTTP::uri] starts_with “/drainserver” } { LB::down [LB::server pool] member [substr [HTTP::query] “ip=” 3 &] [substr [HTTP::query] “port=” 5 &] } }
The LB::down command is changing the priority group to inactive which does drainstop connections off the pool member but when I give it the LB::up command the priority changes to ‘active’ again but the LTM is not sending HTTP connections to the server. How come?
I couldn’t make the IIS server start taking connections again without logging into the LTM GUI and setting the member to ‘disabled’ and then to ‘enabled’ again. The server will then start taking connections again.
Can you tell me how to correct this?
Or, what iRule command can I use which is the same as ‘enable’ and ‘disable’ on the pool member using the GUI?
thank you!
Wade