Collection of CheckMK checks (see https://checkmk.com/). All checks and plugins are provided as is. Absolutely no warranty. Send any comments to thl-cmk[at]outlook[dot]com

Skip to content
Snippets Groups Projects
Commit 08e89456 authored by thl-cmk's avatar thl-cmk :flag_na:
Browse files

prefer curl/wget over squidclient

	see: https://bugs.squid-cache.org/show_bug.cgi?id=5283#c10
        added option to decide if the plugin should be installed
parent bf32afdd
No related branches found
No related tags found
No related merge requests found
[PACKAGE]: ../../raw/master/mkp/squid-2.1.1-20240514.mkp "squid-2.1.1-20240514.mkp" [PACKAGE]: ../../raw/master/mkp/squid-2.1.2-20250309.mkp "squid-2.1.2-20250309.mkp"
# Squid Web Proxy # Squid Web Proxy
This CheckMK plugin monitors the performance of the _**Squid Web Proxy**_. This plugin is intended to use with the Agent Bakery of CheckMK. This CheckMK plugin monitors the performance of the _**Squid Web Proxy**_. This plugin is intended to use with the Agent Bakery of CheckMK.
......
File added
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
# changed section from check_squid to squid # changed section from check_squid to squid
# 2023-05-22: fixed missing "<" in section name # 2023-05-22: fixed missing "<" in section name
# 2023-12-02: added -l "$ip_address" option # 2023-12-02: added -l "$ip_address" option
# 2025-03-09: changed to prefer curl/wget over squidclient ThX to mk-hs@forum.checkm.com
# (see: https://bugs.squid-cache.org/show_bug.cgi?id=5283#c10)
# #
# squidclient mgr:server_list # squidclient mgr:server_list
# squidclient mgr:info # squidclient mgr:info
...@@ -38,13 +40,27 @@ if [ -z "$ip_address" ]; then ...@@ -38,13 +40,27 @@ if [ -z "$ip_address" ]; then
ip_address=localhost ip_address=localhost
fi fi
if type squidclient > /dev/null 2>&1 ; then if type wget > /dev/null 2>&1 ; then
echo "<<<squid_file_descriptors:sep(0)>>>"
wget -q -O - http://"$ip_address":"$port"/squid-internal-mgr/info | grep "file descriptors"
echo "<<<squid:sep(0)>>>"
wget -q -O - http://"$ip_address":"$port"/squid-internal-mgr/5min | grep "="
elif type curl > /dev/null 2>&1 ; then
echo "<<<squid_file_descriptors:sep(0)>>>"
curl http://"$ip_address":"$port"/squid-internal-mgr/info | grep "file descriptors"
echo "<<<squid:sep(0)>>>"
curl http://"$ip_address":"$port"/squid-internal-mgr/5min | grep "="
elif type squidclient > /dev/null 2>&1 ; then
echo "<<<squid_file_descriptors:sep(0)>>>" echo "<<<squid_file_descriptors:sep(0)>>>"
squidclient -p "$port" -l "$ip_address" -T2 mgr:info | grep "file descriptors" squidclient -p "$port" -l "$ip_address" -T2 mgr:info | grep "file descriptors"
echo "<<<squid:sep(0)>>>" echo "<<<squid:sep(0)>>>"
# one squid instance # one squid instance
squidclient -p "$port" -l "$ip_address" -T2 mgr:5min | grep = squidclient -p "$port" -l "$ip_address" -T2 mgr:5min | grep "="
# multiple squid instances # multiple squid instances
# instance names must be without spaces and with colon char at the end # instance names must be without spaces and with colon char at the end
......
...@@ -20,21 +20,26 @@ ...@@ -20,21 +20,26 @@
# add available_number_of_file_descriptors for check section # add available_number_of_file_descriptors for check section
# 2024-05-14: moved to check_parameters # 2024-05-14: moved to check_parameters
# separated WATO for bakery and check in two files # separated WATO for bakery and check in two files
# 2025-03-08: added option to decide if the plugin should be installed
from cmk.gui.i18n import _ from cmk.gui.i18n import _
from cmk.gui.valuespec import ( from cmk.gui.valuespec import (
Dictionary, Dictionary,
Integer, Integer,
TextInput, TextInput,
DropdownChoice,
) )
from cmk.gui.plugins.wato.utils import ( from cmk.gui.plugins.wato.utils import (
HostRulespec, HostRulespec,
rulespec_registry, rulespec_registry,
) )
from cmk.gui.cee.plugins.wato.agent_bakery.rulespecs.utils import ( try:
RulespecGroupMonitoringAgentsAgentPlugins, from cmk.gui.cee.plugins.wato.agent_bakery.rulespecs.utils import (
) RulespecGroupMonitoringAgentsAgentPlugins,
)
except ImportError:
exit()
def _valuespec_agent_squid(): def _valuespec_agent_squid():
...@@ -42,6 +47,15 @@ def _valuespec_agent_squid(): ...@@ -42,6 +47,15 @@ def _valuespec_agent_squid():
help=_('The plugin <tt>squid</tt> allows monitoring of Squid Web Proxies.'), help=_('The plugin <tt>squid</tt> allows monitoring of Squid Web Proxies.'),
title=_('Squid Web Proxy (Linux)'), title=_('Squid Web Proxy (Linux)'),
elements=[ elements=[
('install_plugin',
DropdownChoice(
title=_('Install the plugin'),
choices=[
('true', _('Install the plugin')),
('false', _('Don\'t install the plugin'))
],
default='true',
)),
('ip_address', ('ip_address',
TextInput( TextInput(
title=_('IP Address/Hostname'), title=_('IP Address/Hostname'),
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
# 2023-09-21: moved file to ~/local/lib/check_mk/base/cee/plugins/bakery # 2023-09-21: moved file to ~/local/lib/check_mk/base/cee/plugins/bakery
# fix crash if port not configured in wato # fix crash if port not configured in wato
# 2023-12-02: added IP-Address option # 2023-12-02: added IP-Address option
# 2025-03-08: added option to decide if the plugin should be installed
from pathlib import Path from pathlib import Path
from cmk.base.cee.plugins.bakery.bakery_api.v1 import ( from cmk.base.cee.plugins.bakery.bakery_api.v1 import (
...@@ -29,6 +30,8 @@ from cmk.base.cee.plugins.bakery.bakery_api.v1 import ( ...@@ -29,6 +30,8 @@ from cmk.base.cee.plugins.bakery.bakery_api.v1 import (
def get_squid_files(conf) -> FileGenerator: def get_squid_files(conf) -> FileGenerator:
if conf.get('install_plugin') == 'false':
return
yield Plugin( yield Plugin(
base_os=OS.LINUX, base_os=OS.LINUX,
source=Path('squid'), source=Path('squid'),
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
'lib': ['python3/cmk/base/cee/plugins/bakery/squid.py']}, 'lib': ['python3/cmk/base/cee/plugins/bakery/squid.py']},
'name': 'squid', 'name': 'squid',
'title': 'Squid3 Health Check', 'title': 'Squid3 Health Check',
'version': '2.1.1-20240514', 'version': '2.1.2-20250309',
'version.min_required': '2.1.0b1', 'version.min_required': '2.1.0b1',
'version.packaged': 'cmk-mkp-tool 0.2.0', 'version.packaged': 'cmk-mkp-tool 0.2.0',
'version.usable_until': '2.4.0b1'} 'version.usable_until': '2.4.0b1'}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment