sshipway/check_rancher

Script Returns only first Stack

Closed this issue · 2 comments

Hi Steve,

thanks for you script, i experience one issue if I call the Script with following Parameters:

check_rancher -N -c rancher.cfg -E Integ -s Test -d

It returns the statistics for the Default Stack.

`
HOSTNAME=
USERNAME=
KEY=

PORT=443
SSL=1

cert.warn=7
cert.crit=1
cpu.warn=80
cpu.crit=90
mem.warn=90
mem.crit=99
disk.warn=80
disk.crit=90
#disk.exclude=sda1,sda2
swap.warn=1
swap.crit=99999
load.warn=50
load.crit=100
`

This is my Config File.

Anyone else with the same experience?

Hi Steve,

I found the issue for this bug, you call checkstack always with parameter $json->{data}[$idx] but this returns always the Stack with the lowest id. If line 586 is changed to:

$stkid = $json->{data}[$idx];

and checkstack is called checkstack($stkid); the Script returns the correct Stack Containers

You are quite right; well spotted. This is probably an artifact from back when it used to process every stack rather than just the chosen one.

Fix added to branch and committed; it's only a one-liner so no need for a pull request.

Thanks for the assistance!