Forum Discussion
Michel_van_der_
Nimbostratus
Jan 10, 2006LocalLB.VirtualServer.add_rule question
I tried to apply a rule to a virtual server, but it does not seem to work.
What format should the parameter 'virtual_servers' take. Is that '1.2.3.4:80' or the name of the virtual server?
- The API's use the name of your virtual server, not the IP:port.
- Michel_van_der_
Nimbostratus
To answer (part of my) own question, I fixed the perl code (not an array of servers passed in. - You may need to update your syslog-ng configuration as follows:
- Cindy_127211
Nimbostratus
Hello, I saw your code example and am 'very' interested in trying to get this to work in my enviornment. I'd like to use it to activate a rule to display a specific page during a maintenance window. It looks like it could add a rule to the list to do this. But, I can't seem to get it to work. I can see that it connects properly and executes the add_rule method; however, I don't see that it ever makes any configuration changes. I handed it the appropriate virtual server name, bigip IP and rule name. Any ideas? - Michel_van_der_
Nimbostratus
The code as posted is wrong. - What do you mean when you said that you don't see that it ever makes any configuration changes? After you execute the add_rule() method, the rule should show up in the virtual servers resource list. If it is not showing up there, then odds are there is an issue with the rule itself. I'd try adding the rule manually through the GUI. Odds are that won't work as well.
- Cindy_127211
Nimbostratus
Sorry, I don't really understand what needed to be fixed in the code. My code looks like the following, and it is just not adding the 'rule' to the virtual server, as expected. Can you clarify for me what needs to be fixed? - Yep that's it. the virtual_servers parameter is expected to be an array and without enclosing it in brackets, a literal string is passed to the server. The server then looks for the array and finds a size of 0 (a literal isn't automatically cast to an array) it simply returns without an error.
- Cindy_127211
Nimbostratus
Thank you all for your quick responses to this. I realize the information was there from an earlier post....I just didn't understand it (not really much of a programmer type, unfortunately). Anyway, I got the code to work and it adds a rule as expected. The next thing I need to do is figure out if there is a way to make the rule the first in the list of rules. I thought 'priority' might do that...but, it didn't. Any ideas? - There is no way to control what order the rules show up in the GUI. The Priority specifies what order the rules are processed. The default value is 500. The rules will be processed from lowest priority number to highest. So, a rule with priority 100 would be processed before all other default priority rules.
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