Forum Discussion
Leo
Jun 30, 2011Nimbostratus
Clearing the cache
Hi everyone, sorry for the newbie question :)
I'm managing a BIG-IP 9.4.7 Build 320.1 for a customer of mine, and sometimes I need to delete the cache by running:
"b profile http http-wan-optimized-compression-caching ramcache entry all delete" in the CLI.
I'd like to make an executable for him that runs the above command, so that he wont have to call me every few days.
I thought of using C to keep the credentials hidden.
I's appreciate if anyone could point to some examples doing something similar?
6 Replies
Sort By
- Hi all
- Leonid and Alakata,
- Just an update,
- I had made a C app to do this, I can post some code for how to perform the action if you'd like?
- Here is the code I have. I went down the route of attempting to ssh and do this, but it's rather difficult and not worth it. If you use the iControl API, it makes things much easier.
using iControl; protected void GetRamCacheInfo(object sender, EventArgs e) { // Declare local variables LocalLBRAMCacheInformationRAMCacheKey prof_key = new LocalLBRAMCacheInformationRAMCacheKey(); LocalLBRAMCacheInformationRAMCacheKey[] keys = new LocalLBRAMCacheInformationRAMCacheKey[] { prof_key }; LocalLBRAMCacheInformationRAMCacheEntry[][] entries = null; // Set other variables ipAddress = System.Configuration.ConfigurationManager.AppSettings["TestRamCacheClear"]; user = GetUserID(); pass = TextBox1.Text; try { // Instantiate and initialize interface Interfaces m_interfaces = new Interfaces(); m_interfaces.initialize(ipAddress, user, pass); // Set RamCache keys prof_key.host_name = ""; prof_key.maximum_responses = 500; prof_key.profile_name = profilesList.SelectedItem.ToString(); //--> I have this set to a drop down, could be text box, or list box prof_key.uri = ""; if (m_interfaces.initialized) { string[] HTTPinfo = m_interfaces.LocalLBProfileHttp.get_list(); entries = m_interfaces.LocalLBRAMCacheInformation.get_ramcache_entry(keys); Entries.Visible = true; entrieslbl.Text = entries[0].Length.ToString(); for (int i = 0; i < HTTPinfo.Length; i++) { if (HTTPinfo[i] == prof_key.profile_name) { m_interfaces.LocalLBRAMCacheInformation.evict_ramcache_entry_v2(keys, false); } } entries = m_interfaces.LocalLBRAMCacheInformation.get_ramcache_entry(keys); if (entries[0].Length == 0) { RamCachelbl.Text = "RAM cache cleared"; RamCachelbl.ForeColor = Color.Green; } } } catch (Exception x) { RamCachelbl.Text = x.Message + "\nSTACK: " + x.StackTrace; } }
- Could've used that a couple of months ago 🙂 I simply use external program for the SSH so it makes it easy:
using System; using System.Diagnostics; class Program { static void Main() { RunScript(@"-ssh -pw PASS root@IP /var/tmp/ClearCache.sh"); } static void RunScript(string f) { ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.FileName = "plink.exe"; startInfo.Arguments = f; Process.Start(startInfo); } }
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