Forum Discussion
tarsier_90410
Nimbostratus
Aug 25, 2009way to list pools?
I am trying to find a way for an irule (9.x LTM) to query for a list of all pools on the system, but so far have not found a way to do so. Is this possible?
62 Replies
- The_Bhattman
Nimbostratus
Hi Chris,
Here are some steps to see if it will work
1. What you can do is create directory etc/cron.daily/
2. Create the file pool_member_status_list.cron
3. Populate it with
!/bin/bash
b pool all member all | grep pool_ | awk '{print "\""$3"\""}'> | sort >/var/class/pool_member_status_list.class
Only performs a b load when it's on the active unit.
if [ "`/bin/ps1`" == "Active" ]; then
b load
fi
exit 0
4. Make sure you make it a executable script by "chmod +755 /etc/cron.daily/pool_member_status_list.cron"
4. add the following entry in the crontab
0 1 * * * root /etc/cron.daily/pool_member_status_list.cron >/var/log/pool_member_status_list.log 2>&1
Then run "pool_member_status_list.cron" script so that it's initially created.
I hope this helps
Bhattman - The_Bhattman
Nimbostratus
Can you add the following into crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=""
HOME=/
run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly
Bhattman - The_Bhattman
Nimbostratus
Can you add the following into crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=""
HOME=/
run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly
Bhattman - Chris_FP
Cirrus
added all that but still no good.
[xxxxxxxxxxxx:Active] config
[xxxxxxxxxxxx:Active] config
[xxxxxxxxxxxx:Active] config
[xxxxxxxxxxxx:Active] config
[xxxxxxxxxxxx:Active] config cd /var/log
[xxxxxxxxxxxx:Active] log ls -l *.log
-rw-r--r-- 1 root root 0 Nov 17 04:02 boot.log
-rw-r--r-- 1 root root 77 Sep 11 19:18 bootLogMarker.log
-rw-r--r-- 1 root root 35 Dec 15 04:02 crondaily.log
-rw-r--r-- 1 root root 35 Dec 15 12:01 cronhourly.log
-rw-r--r-- 1 root root 0 Dec 13 04:02 daemon.log
-rw-r--r-- 1 root root 0 Dec 15 04:02 kern.log
-rw-r--r-- 1 root root 33 Dec 15 01:00 pool_member_status_list.log
-rw-r--r-- 1 root root 19573 Nov 25 13:23 user.log
-rw-rw-r-- 1 root tomcat4 0 Dec 15 04:02 webui.log
[xxxxxxxxxxxx:Active] log more pool_member_status_list.log
/bin/sh: root: command not found
[xxxxxxxxxxxx:Active] log more cronhourly.log
/bin/bash: root: command not found
[xxxxxxxxxxxx:Active] log more crondaily.log
/bin/bash: root: command not found
[xxxxxxxxxxxx:Active] log crontab -l
cron tab for root
1-59/30 * * * * /usr/bin/diskmonitor
0 1 * * * root /etc/cron.daily/pool_member_status_list.cron >/var/log/pool_member_status_list.log 2>&1
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=""
HOME=/
run-parts
01 * * * * root run-parts /etc/cron.hourly >/var/log/cronhourly.log 2>&1
02 4 * * * root run-parts /etc/cron.daily >/var/log/crondaily.log 2>&1
22 4 * * 0 root run-parts /etc/cron.weekly >/var/log/cronweekly.log 2>&1
42 4 1 * * root run-parts /etc/cron.monthly >/var/log/cronmonthly.log 2>&1
[xxxxxxxxxxxx:Active] log - The_Bhattman
Nimbostratus
Does this work if you manually run pool_member_status_list.cron?
Bhattman - David_Larsen
Employee
The other thing to check is what is your output when you run the command: b pool all member all ?
I seem to remember that 9.3 has some differences in the outputs of b pool than 9.4 and that may be causing the issues.
David - milo
Nimbostratus
I'm using this irule and it works fine. But, I removed a few pools and now they show up as Invalid. Is there a way to keep them from displaying? I checked the pool_member_status_list.class file, they no longer show up there. But, for some reason, they're still displayed on the html status page. - The_Bhattman
Nimbostratus
Hi Milo,
After the pool_member_status_list.class was updated did you remember to perform a b load on the active unit? That will update the class object which is being loaded up into memory.
I hope this helps
Bhattman - milo
Nimbostratus
Thanks.
I was doing a b load. But I didn't run the b pool list command afterwards to update the external file. Thanks again for your help and the quick response. - Rupa_34586
Nimbostratus
Thanks for the Irule and the script.It is indeed a very good information.
I have the similar requirment.some of my clients want to see the pool status in realtime.
So, i feel this cron job will run only once in a day.if a specific pool is down after the cronjob (script) execution, then the client will be viewing wrong information i.e pool is up.
How do we handle this?How do we get the realtime status of the pools?
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
