Forum Discussion
HTTP Monitor to Check USER-COUNT from Ivanti Node – Regex Issues
Hi everyone,
I'm trying to configure an HTTP health monitor on an F5 LTM to check a value returned by an external Ivanti (Pulse Secure) node. The goal is to parse the value of the USER-COUNT field from the HTML response and ensure it's below or equal to 3000 users (based on our license limit). If the value exceeds that threshold, the monitor should mark the node as DOWN.
The Ivanti node returns a page that looks like this:
<!DOCTYPE html ... >
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">
<head>
<title>Cluster HealthCheck</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<h1>Health check details:</h1>
CPU-UTILIZATION=1;
<br>SWAP-UTILIZATION=0;
<br>DISK-UTILIZATION=24;
<br>SSL-CONNECTION-COUNT=1;
<br>PLATFORM-LIMIT=25000;
<br>MAXIMUM-LICENSED-USER-COUNT=0;
<br>USER-COUNT=200;
<br>MAX-LICENSED-USERS-REACHED=NO;
<br>CLUSTER-NAME=CARU-LAB;
<br>VPN-TUNNEL-COUNT=0;
<br>
</body>
</html>
I’m trying to match the USER-COUNT value using the recv string in the monitor, like this:
recv "USER-COUNT=([0-9]{1,3}|[1-2][0-9]{3}|3000);"
I’ve also tried many others.
The issue is: even when the page returns USER-COUNT=5000;, the monitor still reports the node as UP, when it should be DOWN. The regex seems to match incorrectly.
What I need:
A working recv regex that matches USER-COUNT values from 0 to 3000 (inclusive), but fails if the value exceeds that limit.
Has anyone successfully implemented this kind of monitor with a numeric threshold check using recv? Is there a reliable pattern that avoids partial matches within larger numbers?
Thanks in advance for any insight or working example
I think it's because it matches also <br>MAXIMUM-LICENSED-USER-COUNT=0;
could you try
recv "<br>USER-COUNT=([0-9]{1,3}|[1-2][0-9]{3}|3000);"
7 Replies
"-" and "=" are regex special characters which cause error in your "USER-COUNT=..."
change it to use ascii hexadecimal to USER\x02dCOUNT\x03d...
https://www.tcl-lang.org/man/tcl8.4/TclCmd/re_syntax.htm#M41
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions
- pablo_juarez
Altostratus
Thanks for the idea, but couldnt make it work.
I have tried with just a digit, but monitor is always up.
This should match from 0 to 9, shouldnt it?
USER\x2DCOUNT\x3D[0-9]\x3B
This is what I get with the curl:
<br>USER-COUNT=3265;It works with exact match, for example USER-COUNT=15; is up with 15 users and is marked down with any other.
for number sequence, you can use \d+
so for ....>USER-COUNT=22222...
you can use \x3eUSER\x2dCOUNT\x3d\d+https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions/Character_classes
https://www.tcl-lang.org/man/tcl8.4/TclCmd/re_syntax.htm#M45
- pablo_juarez
Altostratus
It looks like it is related to all html page. Checking this answer, monitor is always up with this pattern USER-COUNT\=([0-9]{1,3}|[1-5][0-9]{3}|6000);:
<head>
<title>Cluster HealthCheck</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<h1>Health check details:</h1>
CPU-UTILIZATION=1;
<br>SWAP-UTILIZATION=0;
<br>DISK-UTILIZATION=24;
<br>SSL-CONNECTION-COUNT=1;
<br>PLATFORM-LIMIT=25000;
<br>MAXIMUM-LICENSED-USER-COUNT=0;
<br>USER-COUNT=7265;
<br>MAX-LICENSED-USERS-REACHED=NO;
<br>CLUSTER-NAME=CARU-LAB;
<br>VPN-TUNNEL-COUNT=0;
<br>
</body>On the other hand, I created a simple file in a web server, which only includes:
USER-COUNT=10000;
And it works.I guess this is related to how to parse html file.
- Injeyan_Kostas
Nacreous
I think it's because it matches also <br>MAXIMUM-LICENSED-USER-COUNT=0;
could you try
recv "<br>USER-COUNT=([0-9]{1,3}|[1-2][0-9]{3}|3000);"
- pablo_juarez
Altostratus
You are completely right, I was so focused on the user-count line that hadn´t seen it was matching with previous line.
[root@lb-alc-caru-vpn-1:/S1-green-P::Active:Changes Pending] config # curl http://172.28.17.170/healthcheck.html | grep "USER-COUNT"
<br>MAXIMUM-LICENSED-USER-COUNT=0;
<br>USER-COUNT=10000;Thank you so much!!
- Injeyan_Kostas
Nacreous
You are welcome
But now the million-dollar question:
You’ve got F5s, so why are you still playing around with Ivanti? Lost a bet?
Recent Discussions
Related Content
* 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