Home Directory

Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

Directory

dennisk

Reviews(2)
bydennisk, March 26, 2019
Hi Slauger, thank you for this script. It works very well and most important, it works fast :)
We have a problem with applying the regex filter. Can you help us with an example perhaps?

[root@server /usr/local/nagios/libexec]$ ./check_netscaler.pl -H 1.2.3.4 -u username -p password -s -C state -o lbvserver
NetScaler CRITICAL - state lbvserver: _httpredir_ DOWN; | UNKOWN=0;;;0; UP=28;;;0; 'OUT OF SERVICE'=0;;;0; DOWN=1;;;0;

This is a hidden vServer which is apparently down by default and created by the NetScaler when the option "Redirect From Port" is used. The vServer in our case is listening on port 80 to redirect to 443. Since this is by design, we would like to add a filter to the check comment to ignore vServers which have _httpredir_ in the name.

I tried to add various things like this, but that didn't work unfortunately:
-f '/(?:[^\*_httpredir_\*]*)/'

Hope you can help us with a regex example.
Dennis
Owner's reply

Hi,

sorry for my late response. I didn't get a email notification for your comment. In the future please prefer an issue on GitHub.

Anyways, the filter accepts any valid perl re syntax. For example, '_httpredir_.*', '_httpredir_' or '^_.*' should do the job.

bydennisk, October 26, 2018
Hi there, I've found a bug in calculating time drift. The timestamps of hosts are collected as epoch numbers, and put into an array. When the array is sorted, a new array is created but the newly created array is not used in the script. Without sorting, you cannot calculate the drift.

This is what I found:
my $epoch_oldest = $Host_Epoch_Hash{$Host_Epoch_Array[0]}{'epoch'};
my $epoch_newest = $Host_Epoch_Hash{$Host_Epoch_Array[-1]}{'epoch'};

This is what I changed:
my $epoch_oldest = $Host_Epoch_Hash{$Host_Epoch_Array_Sorted[0]}{'epoch'};
my $epoch_newest = $Host_Epoch_Hash{$Host_Epoch_Array_Sorted[-1]}{'epoch'};

Checks works fine now!