Nagios checks fail

Bug #1781921 reported by Tom Haddon
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Squid Reverse Proxy Charm
New
Undecided
Unassigned

Bug Description

Using cs:squid-reverseproxy-7, and adding a relation with nrpe, the outcome is a nagios check of:

# check squidpeers
command[check_squidpeers]=/usr/lib/nagios/plugins/check_squidpeers -p 3128 -w 50

Running this commands gives:

ubuntu@juju-f66069-charm-testing-squid-reverseproxy-trusty-20-1:~$ /usr/lib/nagios/plugins/check_squidpeers -p 3128 -w 50
Traceback (most recent call last):
  File "/usr/lib/nagios/plugins/check_squidpeers", line 87, in <module>
    sys.exit(main())
  File "/usr/lib/nagios/plugins/check_squidpeers", line 81, in main
    retcode, message = get_status(peers, args.weight)
  File "/usr/lib/nagios/plugins/check_squidpeers", line 51, in get_status
    perc = calculate_perc_up(peers)
  File "/usr/lib/nagios/plugins/check_squidpeers", line 46, in calculate_perc_up
    return ((reduce(iadd, [1. for i in peers if i['status'] == STATUS_UP]))
TypeError: reduce() of empty sequence with no initial value

Related branches

Revision history for this message
William Grant (wgrant) wrote :

The linked branch fixes the crash but still makes the check fail when there are no peers. This is problematic in some use cases, e.g. where mojo is deploying base infrastructure like squid first, verifying it's all working, then relating app services, meaning that during the first verify there are legitimately no peers.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.