Forum Discussion

K-Dubb's avatar
K-Dubb
Icon for Nimbostratus rankNimbostratus
Jun 13, 2011

Pool_Member_Status_Page_on_a_Virtual_Server (Topic Changed)

Hi,

 

 

I am trying to use this from windows command line: http://devcentral.f5.com/wiki/default.aspx/iControl/pyControlQuickPoolStatus.html. I have python installed on the server. I saved the syntax/usage section to a file called check.py and modified host, user and password. I saved the main script to a file called pool_status.py. I am calling check.py from comand line and I get:

 

 

 

 

C:\Python27>c:\scripts\check.py

 

Traceback (most recent call last):

 

File "c:\scripts\check.py", line 1, in

 

import pycontrol.pyControl as pyControl

 

ImportError: No module named pycontrol.pyControl

 

 

 

I have never ran a python script before, so perhaps I am doing somehting wrong. Any help would be great.

 

 

Thanks.

 

 

 

EDIT:

 

I am now going another route based on a recommendation by Jason Rahm

 

 

 

Working on trying to get this to work, but having issues (See further down in the topic)

 

http://devcentral.f5.com/wiki/default.aspx/iRules/Pool_Member_Status_Page_on_a_Virtual_Server.html
  • K-Dubb's avatar
    K-Dubb
    Icon for Nimbostratus rankNimbostratus
    Ok guys, I am still having issues here. THis is a highlevel of what I have done:

     

     

    Trying to get http://devcentral.f5.com/wiki/default.aspx/iRules/Pool_Member_Status_Page_on_a_Virtual_Server.html to work. I am on version 9.4.8 and using the "verified on 9.4.6 and 9.4.7" version.

     

     

    1. Created cron file and changed permissions

     

    2. Created external data group and ran the List Port command.

     

    3. Created iRule with the syntax listed in the How To

     

    4. Created http Virtual Server with the defual http monitor and no pools. Assigned the iRule created in step 3 to the Virtual server.

     

     

    Tried to access the status page by doing the following:

     

     

    1. Going to the IP of Virtual Server I created in step 4

     

    1. Going to http://status as suggested by The Bhattman

     

     

    Neither of these worked and resulted in page cannot be displayed. The IP of the virtual server is pingable.
  • Do you see any errors in /var/log/ltm when you make a request to the virtual server?

     

     

    Aaron
  • K-Dubb's avatar
    K-Dubb
    Icon for Nimbostratus rankNimbostratus
    Hoolio I did not realize the address should be http://1.1.1.1/status! That is all it was. Works great!!

     

     

    Thanks!
  • Can you use curl from the command line to make a request to the virtual server?

    curl -v 1.1.1.1/status

    If that doesn't return anything, can you check the datagroup to see if it has been populated?

    b class pool_member_status_list list

    If the datagroup is populated, but the VS still doesn't work, can you try this update:

    
    when HTTP_REQUEST {
            switch [HTTP::uri] {
    
    "/status" {
    set response "BIGIP Pool Member Status - \
    [clock format [clock seconds]]BIGIP Pool Member Status - [clock format [clock seconds]]\
    StatusPool NameMemberPort"
    
    foreach { selectedpool } $::pool_member_status_list  {
    if { [catch {
    scan $selectedpool {%[^/]/%[^:]:%s} poolname addr port  
    switch -glob [LB::status pool $poolname member $addr $port] {
    "up" {
    append response "UP\
    [string tolower $poolname]$addr$port"
    }
    "down" { 
    append response "DOWN\
    [string tolower $poolname]$addr$port"
    }
    "session_enabled" { 
    append response "ENABLED\
    [string tolower $poolname]$addr$port"
    }
    "session_disabled" { 
    append response "DISABLED\
    [string tolower $poolname]$addr$port"
    }
    Default {
    append response "INVALID\
    [string tolower $poolname]$addr$port"
    }
    }
    SWITCH END
    } errmsg] } { 
    append response "INVALID\
    [string tolower $poolname]$addr$port"
    }
    }
    append response ""  
    HTTP::respond 200 content $response "Content-Type" "text/html" "Cache-Control" "no-cache, must-revalidate" "Expires" "Mon, 26 Jul 1997 05:00:00 GMT"
    }
    
    "/rss" {
    set response " \
    BigIP Server Pool StatusServer Pool Status \
    en[clock format [clock seconds]]\60"
    foreach { selectedpool } $::pool_member_status_list {
    if { [catch {
    scan $selectedpool {%[^/]/%[^:]:%s} poolname addr port  
    switch -glob [LB::status pool $poolname member $addr $port] {
    "up" {
    append response "[string tolower $poolname] Status \
    Member $addr:$port is UP"
    }
    "down" { 
    append response "[string tolower $poolname] Status \
    Member $addr:$port is DOWN"
    }
    "session_enabled" { 
    append response "[string tolower $poolname] Status \
    Member $addr:$port is ENABLED"
    }
    "session_disabled" { 
    append response "[string tolower $poolname] Status \
    Member $addr:$port is DISABLED"
    }
    Default {
    append response "[string tolower $poolname] Status \
    Member $addr:$port is INVALID"
    }
    }
    SWITCH END
    } errmsg] } {
    append response "[string tolower $poolname] StatusMember $addr:$port is \
    INVALID"
    }
    }
    append response ""
    HTTP::respond 200 content $response "Content-Type" "text/xml" "Cache-Control" "no-cache, must-revalidate" "Expires" "Mon, 26 Jul 1997 05:00:00 GMT"
    }                
    default {
    HTTP::respond 200 content {Pool status VSPool status page
    Select a URI}
    }
    }
    }
    

    Aaron