Forum Discussion
yunan_haris
Altocumulus
Sep 27, 2022check status of the ssl certificate on f5 using rest api
greetings all, is there any way to check the ssl certificate status, validation, expiration date using rest api on the bigip? thank you
- Mar 21, 2022
I modified your script so that the relevant poolmemeber of the pool can be listed
Then perform the desired action,from f5.bigip import ManagementRoot # # Choice Poolmemeber def cpm(): print("\nChoice Pool Memeber:\n") index = 1 # ListPoolm = {} for poolm in pool_1.members_s.get_collection(): print(str(index) + ". " + poolm.name) ListPoolm[index] = poolm.name index += 1 choice = input("Which Poolmember do you want to action? ") return ListPoolm[int(choice)] # Action For Poolmember def act(): member = pool_1.members_s.members.load(partition='Common', name=cpm()) # action = input("enabled, disabled, forced_offline, Your input (press enter to skip): ") # if action == 'enabled': # enables member member.state = 'user-up' member.session = 'user-enabled' elif action == 'disabled': # disables member member.session = 'user-disabled' elif action == 'forced_offline': # forces online member member.state = 'user-down' member.session = 'user-disabled' if action is not None: member.update() else: print('readonly mode, no changes applied') if __name__ == "__main__": LB01 = ManagementRoot("testlb01", "weakuser", "weakpassword") pool_1 = LB01.tm.ltm.pools.pool.load (name="test-pool", partition="Common") # act() # via single for loop, I can extract the necessary info about pool members: for item in pool_1.members_s.raw["items"]: print("Node name: " + item["name"]) print("Node IP: " + item["address"]) print("Node full path: " + item["fullPath"]) # if item["session"] == "monitor-enabled": print("Node state: enable") elif item["session"] == "user-disabled": print("Node state: disable") # print("Node reachability: " + item["state"]) print("\n")
I hope I can help you - Mar 24, 2022
Hi oscarnet.
Your reply is what I wanted, just simplified:
#BRING POOL MEMBER UP:
pool_1.state = "user-up"
pool_1.session = "user-enabled"
pool_1.update()# BRING POOL MEMBER DOWN:
pool_1.state = "user-down"
pool_1.session = "user-disabled"
pool_1.update()Thank you very much for help.
Best Regards
Michal
forget to add your cert expiry output will be like
curl -sku admin:admin https://bigip_hostname/mgmt/tm/sys/crypto/cert/ | jq '.items[] | {certname: .name, CertExpiry: .apiRawValues.expiration}'
{
"certname": "/Common/abc_host_certJuly2022",
"CertExpiry": "Jul 14 17:11:26 2021 GMT"
}
yunan_haris
Altocumulus
Oct 11, 2022hi Samir
thank you, it works
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