Webinjection test Issue/Question

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
lavosgo
Posts: 6
Joined: Wed Apr 03, 2019 12:52 pm

Webinjection test Issue/Question

Post by lavosgo »

Hello all,

I need to create (and see if it can be done) some kind of pattern that match a numerical value to be greater than a specific number... can this be done with regex or something else?

In here http://www.webinject.org/manual.html#tcparamverpos it says:
verifypositive
String in response for positive verification. Verification fails if this string does not exist in the HTTP response. This is matched as a Perl regular expression, so you can do some complex verification patterns if you are familar with using regex matching.

Note: Because your verification string is used as a regex, the following characters within it must be escaped with a backslash: {}[]()^$.|*+?\

So overall what I want to do is:

Get XXXX Number in metrics then verify positive if XXXX number is greater than YYYY number.

Thanks!
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Webinjection test Issue/Question

Post by cdienger »

Regex can be used to find a range. For example, I have a file(index.php) with the following text:

example 100 test

and a simple webinject testcase:

Code: Select all

<testcases>
<case
    id="1"
    url="http://192.168.55.3/index.php"
    verifypositive="example [0-9]{1,2} test"
/>
</testcases>
The test fails in this case because the number is 100. Anything between 1-99 would return success.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
lavosgo
Posts: 6
Joined: Wed Apr 03, 2019 12:52 pm

Re: Webinjection test Issue/Question

Post by lavosgo »

Hi!

and what if my file is http://mysite.com:8080/metrics

{"results":

{"CardMigration":{"fifteenMinuteRate":3.91389181659031E-11,"fiveMinuteRate":9.504353538802847E-30,"oneMinuteRate":8.868794373407464E-136,"meanRate":1.4867613403866456E-4,"seventyFifthPercentile":1902.842522,"nintyFifthPercentile":1902.842522,"nintyNinthPercentile":1902.842522,"nintyNinePointNinePercentile":1902.842522,"max":2403.063908,"min":1154.246251,"mean":1902.7940546531531,"median":1902.842522,"count":3},

"CardMigrationFailureRate":{"fifteenMinuteRate":0.0,"fiveMinuteRate":0.0,"oneMinuteRate":0.0,"meanRate":0.0,"count":0},

"ReportCredentialMigration":{"fifteenMinuteRate":1.1798124663085237E-10,"fiveMinuteRate":2.818298571359711E-29,"oneMinuteRate":2.8918378837296734E-135,"meanRate":3.966869878176289E-4,"seventyFifthPercentile":338.641369,"nintyFifthPercentile":338.641369,"nintyNinthPercentile":338.641369,"nintyNinePointNinePercentile":338.641369,"max":2028.339908,"min":8.363896,"mean":225.19234794089792,"median":328.545247,"count":8}

and my verifypositve have to be CardMigration.meanRate < than 100

And the other case: my verifypositve for CardMigrationFailureRate.oneMinuteRate < ReportCredentialMigration.oneMinuteRate

Is that possible?
User avatar
swolf
Developer
Posts: 300
Joined: Tue Jun 06, 2017 9:48 am

Re: Webinjection test Issue/Question

Post by swolf »

Hi,

It looks like you have 2 threads referring to the same issue.

I'm going to lock this one, so we can continue discussion in the other thread.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy
Locked