Learn F5 Technologies, Get Answers & Share Community Solutions Join DevCentral

Filter by:
  • Solution
  • Technology
code share

Virtual_ Server_ Monitoring_(iRule)

Problem this snippet solves:

Hi Community,

The goal is to get a html page with the status of the virtual servers. For this we need the following: 1) "VirtualServers_Monitorizados.txt" (this file contains the name of the virtual servers that you want to monitor)

2) "virtualserver_list.sh" (This script reads the contents of the file "VirtualServers_Monitorizados.txt" and generates a class file called "lista_vs_poolmembers.class")

3) "lista_vs_poolmembers.class" (is generated by script "virtualserver_list.sh" and this file contains the virtual servers names, ips, pools and members pools with a particular structure) STRUCTURE: VirtualServerName/VirtualServerIP:VirtualServerPort/PoolName/PoolMember1:PoolMemberPort1,PoolMember2:PoolMemberPort2,

4) "iRule_Monitorizacion.tcl" (this iRule reads the content of the file "lista_vs_poolmembers.class" and generate a dynamic html page with the virtual servers and members status)

The "virtualserver_list.sh" script can be run with crontab: - Create a file in the following path /etc/cron.daily/virtualserver_list.cron - Change the permissions by entering chmod +755 /etc/cron.daily/virtualserver_status_list.cron

For iRule can read from a external file: - Create a external datagroup Main >> Local Traffic >> iRules Select Data Group List Click create enter name: lista_vs_poolmembers enter Type: External Path / Filename: /var/class/lista_vs_poolmembers.class File Content: String

The last steps are: - Create a new iRule - Create a new Virtual Server and assign the iRule. Through this service we obtain monitoring

In my scenario I get the Virtual Servers Status connecting to "http://IP_Virtual_Server_Monitor/status"

I've attachmented a ZIP file with: - virtualserver_list.sh - iRule_Monitorizacion.tcl - file example for "VirtualServers_Monitorizados.txt"

Thanks David Díez