Giter VIP home page Giter VIP logo

Comments (13)

slauger avatar slauger commented on June 19, 2024 1

Ok, this isn't supposed to happen. Let me check this.

from check_netscaler.

slauger avatar slauger commented on June 19, 2024

Hi @gjarm93,

the command interface does already support the filter switch. See https://github.com/slauger/check_netscaler/blob/master/check_netscaler.pl#L829.

I haven't tested it, but it should be possible to filter the check to a single interface via -f '0/1'. The -f also supports regular expressions, you can expand the check to multiple interfaces (e.g. -f '0.[1-3]').

Please let me know if this fits your needs.

from check_netscaler.

gmounica39 avatar gmounica39 commented on June 19, 2024

./check_netscaler.pl -H hostname -u user -p pwd -s -C perfdata -o Interface -n rxbytesrate -f '0/1/1'
NetScaler OK - perfdata: Interface.rxbytesrate[0]: 0; Interface.rxbytesrate[1]: 0; Interface.rxbytesrate[2]: 0; Interface.rxbytesrate[3]: 0; Interface.rxbytesrate[4]: 48430; Interface.rxbytesrate[5]: 3060; Interface.rxbytesrate[6]: 958333; Interface.rxbytesrate[7]: 3676; Interface.rxbytesrate[8]: 4449; Interface.rxbytesrate[9]: 1084; Interface.rxbytesrate[10]: 971690; Interface.rxbytesrate[11]: 8099; Interface.rxbytesrate[12]: 5305; Interface.rxbytesrate[13]: 0; Interface.rxbytesrate[14]: 149750; Interface.rxbytesrate[15]: 52753; Interface.rxbytesrate[16]: 4224; Interface.rxbytesrate[17]: 1930708; Interface.rxbytesrate[18]: 11658 | 'Interface.rxbytesrate[0]'=0;; 'Interface.rxbytesrate[1]'=0;; 'Interface.rxbytesrate[2]'=0;; 'Interface.rxbytesrate[3]'=0;; 'Interface.rxbytesrate[4]'=48430;; 'Interface.rxbytesrate[5]'=3060;; 'Interface.rxbytesrate[6]'=958333;; 'Interface.rxbytesrate[7]'=3676;; 'Interface.rxbytesrate[8]'=4449;; 'Interface.rxbytesrate[9]'=1084;; 'Interface.rxbytesrate[10]'=971690;; 'Interface.rxbytesrate[11]'=8099;; 'Interface.rxbytesrate[12]'=5305;; 'Interface.rxbytesrate[13]'=0;; 'Interface.rxbytesrate[14]'=149750;; 'Interface.rxbytesrate[15]'=52753;; 'Interface.rxbytesrate[16]'=4224;; 'Interface.rxbytesrate[17]'=1930708;; 'Interface.rxbytesrate[18]'=11658;;

It still gives all the interfaces even when filter is provided

from check_netscaler.

slauger avatar slauger commented on June 19, 2024

Sorry, i was a bit wrong. The filter switch filters out an interface from your result, just as the name suggests. It should be possible to add a inverse filter via perl regular expression (like (?:(?!0\/1).)*), but i couldn't find a working solution right now.

So a quick and very dirty solution would be to filter out all unwanted interfaces:

./check_netscaler.pl -H 10.0.0.240 -p nsroot -C interfaces -f '(LO.1|0.1|0.2|0.3)'

This may or may not solve your initial problem.

Filtering is currently not supported for the perfdata command. This is because the sub check_threshold_and_get_perfdata is very generic. We do not know which field contain the item field.

from check_netscaler.

slauger avatar slauger commented on June 19, 2024

It seems like that it's also possible to filter the API response to a single interface.

http://<netscaler-ip-address>/nitro/v1/config/Interface/id_value<String>

But this will require some changes in the plugin code - and also this would be only an option for the Interfaces command.

from check_netscaler.

gmounica39 avatar gmounica39 commented on June 19, 2024

I would need perfdata since I'm looking for rxbytesrate to get current value instead of total(counter). Looks like /nitro/v1/config/Interface doesn't have a rate

from check_netscaler.

slauger avatar slauger commented on June 19, 2024

Have a look at 5c0ef0a. The commit adds a new --label switch. Does this fix your problem? Currently i do not have a better idea.

Example usage:

# default
-bash$ ./check_netscaler.pl -H 10.0.0.240 -p secure -s -C perfdata -o Interface -n rxbytesrate
NetScaler OK - perfdata: Interface.rxbytesrate[0]: 1711; Interface.rxbytesrate[1]: 13915 | 'Interface.rxbytesrate[0]'=1711;; 'Interface.rxbytesrate[1]'=13915;;

# with the new -f switch set to 'id'
-bash$ ./check_netscaler.pl -H 10.0.0.240 -p secure -s -C perfdata -o Interface -n rxbytesrate -l id
NetScaler OK - perfdata: Interface.rxbytesrate[0/1]: 1575; Interface.rxbytesrate[LO/1]: 12130 | 'Interface.rxbytesrate[0/1]'=1575;; 'Interface.rxbytesrate[LO/1]'=12130;;

from check_netscaler.

gmounica39 avatar gmounica39 commented on June 19, 2024

Yes, for now this should work.

Thank you!

from check_netscaler.

gmounica39 avatar gmounica39 commented on June 19, 2024

And are there any plans for future to again filter to get single interface?

from check_netscaler.

slauger avatar slauger commented on June 19, 2024

Since we now have a label for filtering, adding support for the -f shouldn't be a problem. I'll take care of it.

from check_netscaler.

slauger avatar slauger commented on June 19, 2024

I renamed the label switch from -l to -L to make room for a new "limit" switch. The limit switch (-l) can be used to limit the current check to specific objects, just like you wanted. It can be combined with the label option (-L) and the existing filter option (-f).

Examples:

# limit to LO/1
./check_netscaler.pl -H 10.0.0.240 -p secure -s -C perfdata -o Interface -n rxbytesrate -L id -l 'LO.1' 

# limit to 0/[0-9] and filter out 0/2
./check_netscaler.pl -H 10.0.0.240 -p secure -s -C perfdata -o Interface -n rxbytesrate -L id -l '0.[0-9]' -f '0.2'

TODOs:

  • Waiting for feedback from @gjarm93
  • Update our existing docs and add some examples
  • Add additional tests for this new switches

from check_netscaler.

gmounica39 avatar gmounica39 commented on June 19, 2024

It did the job, thank you!!

from check_netscaler.

slauger avatar slauger commented on June 19, 2024

The new switches are part of Release v1.6.1.

from check_netscaler.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.