Monitoring squid proxy with plugin

Hi, I’ve been following several threads on this forum, and I’m pretty lost right now while trying to monitor a squid. I am using Checkmk Raw Edition 2.2.0p14, and I have downloaded the following mkp: https://thl-cmk.hopto.org/gitlab/checkmk/various/squid I have installed and activated it, but it does not detect anything.

When I run the plugin on the checkmk server I get no results:

Somebody could help me? Thanks!



**OMD[monitoring]:~$ mkp list**
Name   Version          Title               Author                                       Req. Version Until Version Files State                        
------ ---------------- ------------------- -------------------------------------------- ------------ ------------- ----- -----------------------------
squid  2.0.4-2023-09-21 Squid3 Health Check Th.L. (thl-cmk[at]outlook[dot]com)           2.1.0b1      None          6     Enabled (active on this site)
huawei 2.3              Huawei Storage      Robert Sander <r.sander@heinlein-support.de> 1.5.0        None          19    Disabled                     
squid  2.0.3-2023-05-22 Squid3 Health Check Th.L. (thl-cmk[at]outlook[dot]com)           2.1.0b1      None          6     Disabled  

**root@co42sap162:~# netstat -pltn | grep squid**
tcp6       0      0 :::8080                 :::*                    LISTEN      912/(squid-1)       

**OMD[monitoring]:~$ cmk -vvII CO41SAP162-PROXY-USUARIOS**
Discovering services and host labels on: CO41SAP162-PROXY-USUARIOS
CO41SAP162-PROXY-USUARIOS:
+ FETCHING DATA
  Source: SourceInfo(hostname='CO41SAP162-PROXY-USUARIOS', ipaddress='10.72.1.201', ident='agent', fetcher_type=<FetcherType.TCP: 8>, source_type=<SourceType.HOST: 1>)
[cpu_tracking] Start [7fdccdb4e3d0]
Read from cache: AgentFileCache(CO41SAP162-PROXY-USUARIOS, path_template=/omd/sites/monitoring/tmp/check_mk/cache/{hostname}, max_age=MaxAge(checking=0, discovery=90.0, inventory=90.0), simulation=False, use_only_cache=False, file_cache_mode=1)
[TCPFetcher] Execute data source
Connecting via TCP to 10.72.1.201:6556 (20.0s timeout)
Detected transport protocol: TransportProtocol.PLAIN (b'<<')
Reading data from agent
Closing TCP connection to 10.72.1.201:6556
[cpu_tracking] Stop [7fdccdb4e3d0 - Snapshot(process=posix.times_result(user=0.010000000000000009, system=0.0, children_user=0.0, children_system=0.0, elapsed=1.1399999968707561))]
  Source: SourceInfo(hostname='CO41SAP162-PROXY-USUARIOS', ipaddress='10.72.1.201', ident='piggyback', fetcher_type=<FetcherType.PIGGYBACK: 4>, source_type=<SourceType.HOST: 1>)
[cpu_tracking] Start [7fdccd721390]
Read from cache: NoCache(CO41SAP162-PROXY-USUARIOS, path_template=/dev/null, max_age=MaxAge(checking=0.0, discovery=0.0, inventory=0.0), simulation=False, use_only_cache=False, file_cache_mode=1)
[PiggybackFetcher] Execute data source
No piggyback files for 'CO41SAP162-PROXY-USUARIOS'. Skip processing.
No piggyback files for '10.72.1.201'. Skip processing.
[cpu_tracking] Stop [7fdccd721390 - Snapshot(process=posix.times_result(user=0.0, system=0.0, children_user=0.0, children_system=0.0, elapsed=0.0))]
+ PARSE FETCHER RESULTS
<<<check_mk>>> / Transition NOOPParser -> HostSectionParser
<<<cmk_agent_ctl_status:sep(0)>>> / Transition HostSectionParser -> HostSectionParser
<<<checkmk_agent_plugins_lnx:sep(0)>>> / Transition HostSectionParser -> HostSectionParser
<<<labels:sep(0)>>> / Transition HostSectionParser -> HostSectionParser
<<<df_v2>>> / Transition HostSectionParser -> HostSectionParser
<<<df_v2>>> / Transition HostSectionParser -> HostSectionParser
<<<systemd_units>>> / Transition HostSectionParser -> HostSectionParser
<<<nfsmounts_v2:sep(0)>>> / Transition HostSectionParser -> HostSectionParser
<<<cifsmounts>>> / Transition HostSectionParser -> HostSectionParser
<<<mounts>>> / Transition HostSectionParser -> HostSectionParser
<<<ps_lnx>>> / Transition HostSectionParser -> HostSectionParser
<<<mem>>> / Transition HostSectionParser -> HostSectionParser
<<<cpu>>> / Transition HostSectionParser -> HostSectionParser
<<<uptime>>> / Transition HostSectionParser -> HostSectionParser
<<<lnx_if>>> / Transition HostSectionParser -> HostSectionParser
<<<lnx_if:sep(58)>>> / Transition HostSectionParser -> HostSectionParser
<<<tcp_conn_stats>>> / Transition HostSectionParser -> HostSectionParser
<<<multipath>>> / Transition HostSectionParser -> HostSectionParser
<<<diskstat>>> / Transition HostSectionParser -> HostSectionParser
<<<kernel>>> / Transition HostSectionParser -> HostSectionParser
<<<md>>> / Transition HostSectionParser -> HostSectionParser
<<<vbox_guest>>> / Transition HostSectionParser -> HostSectionParser
<<<job>>> / Transition HostSectionParser -> HostSectionParser
<<<ntp:cached(1701328843,120)>>> / Transition HostSectionParser -> HostSectionParser
<<<local:sep(0)>>> / Transition HostSectionParser -> HostSectionParser
  HostKey(hostname='CO41SAP162-PROXY-USUARIOS', source_type=<SourceType.HOST: 1>)  -> Add sections: ['check_mk', 'checkmk_agent_plugins_lnx', 'cifsmounts', 'cmk_agent_ctl_status', 'cpu', 'df_v2', 'diskstat', 'job', 'kernel', 'labels', 'lnx_if', 'local', 'md', 'mem', 'mounts', 'multipath', 'nfsmounts_v2', 'ntp', 'ps_lnx', 'systemd_units', 'tcp_conn_stats', 'uptime', 'vbox_guest']
  HostKey(hostname='CO41SAP162-PROXY-USUARIOS', source_type=<SourceType.HOST: 1>)  -> Add sections: []
Received no piggyback data
+ ANALYSE DISCOVERED HOST LABELS
Trying host label discovery with: check_mk, checkmk_agent_plugins_lnx, cifsmounts, cmk_agent_ctl_status, cpu, df_v2, diskstat, job, kernel, labels, lnx_if, local, md, mem, mounts, multipath, nfsmounts_v2, ntp, ps_lnx, systemd_units, tcp_conn_stats, uptime, vbox_guest
  cmk/os_family: linux (check_mk)
  cmk/device_type: vm (labels)
Trying host label discovery with: 
SUCCESS - Found 2 host labels
+ ANALYSE DISCOVERED SERVICES
+ EXECUTING DISCOVERY PLUGINS (35)
  Trying discovery with: diskstat, ntp_time, systemd_units_sockets_summary, uptime, mem_linux, lnx_if, mem_win, mssql_datafiles, systemd_units_services, df, mssql_transactionlogs, ntp, systemd_units_sockets, vbox_guest, checkmk_agent, mounts, chrony, cpu_threads, docker_container_status_uptime, domino_tasks, job, local, multipath, cpu_loads, tcp_conn_stats, nfsmounts, cifsmounts, systemd_units_services_summary, kernel_performance, kernel, mem_vmalloc, check_mk_only_from, kernel_util, md, ps
  1 checkmk_agent
  1 cpu_loads
  1 cpu_threads
  2 df
  1 diskstat
  1 kernel_performance
  1 kernel_util
  2 lnx_if
  1 mem_linux
  2 mounts
  1 ntp_time
  1 systemd_units_services_summary
  1 systemd_units_sockets_summary
  1 tcp_conn_stats
  1 uptime
SUCCESS - Found 18 services

Hi.

Did you check out that squidclient is installed on the system and show data. I missed the section for squid in the dicovery output. Please try to test the plugin on the squid proxy to see if it’s working.

Rg, Christian

Hi Chirsitian, thanks for your reply.
squidclient is installed in remote host and checkmk server

root@co42sap162:~# squidclient -p 8080 mgr:info | grep 'file descri'
        Maximum number of file descriptors:   20000
        Available number of file descriptors: 19879
        Reserved number of file descriptors:   100

root@checkmkIT:~# squidclient -h 10.72.1.201 -p 8080
HTTP/1.1 400 Bad Request
Server: squid/5.7
Mime-Version: 1.0
Date: Thu, 30 Nov 2023 11:12:38 GMT
Content-Type: text/html;charset=utf-8
Content-Length: 3538
X-Squid-Error: ERR_INVALID_URL 0
Vary: Accept-Language
Content-Language: en
X-Cache: MISS from co42sap162
X-Cache-Lookup: NONE from co42sap162:8080
Via: 1.1 co42sap162 (squid/5.7)
Connection: close

Hi,

you need also to know if the agent deliver this output. You can run “check_mk_agent” on the shell an look for the squidclient output. If the output not there, then the plugin has a problem.
I saw the you run the command directly and not running the plugin.

Rg, Christian

I don’t know if this could be the problem, I have seen that this folder /opt/omd/sites/monitoring/local/share/check_mk/checks/ is empty.

To install the plugin, download the .mkp, I did a mkp add and then a mkp enable, should I do something else?

imagen

I copied by hand the squid agent plugin from ~/local/share/check_mk/agents/plugins/squid of my CheckMK site to the check_mk agent path of my Squid server to /usr/lib/check_mk_agent/plugins/ following the instructions on the plugin’s website

if I execute this file in remote host:

root@co42sap162:~# ./squid 
<<<squid:sep(0)>>>
Content-Type: text/plain;charset=utf-8
sample_start_time = 1701343127.345556 (Thu, 30 Nov 2023 11:18:47 GMT)
sample_end_time = 1701343427.349238 (Thu, 30 Nov 2023 11:23:47 GMT)
client_http.requests = 0.089999/sec
client_http.hits = 0.000000/sec
client_http.errors = 0.016666/sec
client_http.kbytes_in = 7.099913/sec
client_http.kbytes_out = 10.346540/sec
client_http.all_median_svc_time = 14.898263 seconds
client_http.miss_median_svc_time = 30.056059 seconds
client_http.nm_median_svc_time = 0.000000 seconds
client_http.nh_median_svc_time = 0.000000 seconds
client_http.hit_median_svc_time = 0.000000 seconds
server.all.requests = 0.093332/sec
server.all.errors = 0.000000/sec
server.all.kbytes_in = 10.349873/sec
server.all.kbytes_out = 7.109913/sec
server.http.requests = 0.016666/sec
server.http.errors = 0.000000/sec
server.http.kbytes_in = 0.000000/sec
server.http.kbytes_out = 0.006667/sec
server.ftp.requests = 0.000000/sec
server.ftp.errors = 0.000000/sec
server.ftp.kbytes_in = 0.000000/sec
server.ftp.kbytes_out = 0.000000/sec
server.other.requests = 0.076666/sec
server.other.errors = 0.000000/sec
server.other.kbytes_in = 10.349873/sec
server.other.kbytes_out = 7.103246/sec
icp.pkts_sent = 0.000000/sec
icp.pkts_recv = 0.000000/sec
icp.queries_sent = 0.000000/sec
icp.replies_sent = 0.000000/sec
icp.queries_recv = 0.000000/sec
icp.replies_recv = 0.000000/sec
icp.replies_queued = 0.000000/sec
icp.query_timeouts = 0.000000/sec
icp.kbytes_sent = 0.000000/sec
icp.kbytes_recv = 0.000000/sec
icp.q_kbytes_sent = 0.000000/sec
icp.r_kbytes_sent = 0.000000/sec
icp.q_kbytes_recv = 0.000000/sec
icp.r_kbytes_recv = 0.000000/sec
icp.query_median_svc_time = 0.000000 seconds
icp.reply_median_svc_time = 0.000000 seconds
dns.median_svc_time = 0.003722 seconds
unlink.requests = 0.000000/sec
page_faults = 0.000000/sec
select_loops = 345.909088/sec
select_fds = 231.397160/sec
average_select_fd_period = 0.000000/fd
median_select_fds = 0.000000
swap.outs = 0.000000/sec
swap.ins = 0.000000/sec
swap.files_cleaned = 0.000000/sec
aborted_requests = 0.016666/sec
syscalls.disk.opens = 0.000000/sec
syscalls.disk.closes = 0.000000/sec
syscalls.disk.reads = 0.000000/sec
syscalls.disk.writes = 0.000000/sec
syscalls.disk.seeks = 0.000000/sec
syscalls.disk.unlinks = 0.000000/sec
syscalls.sock.accepts = 0.093332/sec
syscalls.sock.sockets = 0.093332/sec
syscalls.sock.connects = 0.093332/sec
syscalls.sock.binds = 0.000000/sec
syscalls.sock.closes = 0.179998/sec
syscalls.sock.reads = 115.488583/sec
syscalls.sock.writes = 115.398584/sec
syscalls.sock.recvfroms = 0.413328/sec
syscalls.sock.sendtos = 0.179998/sec
cpu_time = 1.731968 seconds
wall_time = 300.003682 seconds
cpu_usage = 0.577316%


but i don't know how to execute this script in checkmk server

root@checkmkIT:/usr/lib/check_mk_agent/plugins/# ./squid

<<< squid:sep(0)>>>

ERROR: Cannot connect to 127.0.0.1:3128

The run the script from a remote site, you need to exchange the localhost (127.0.0.1) with your remote address.

Rg, Christian

I don’t know if you mean this plugin, I’m a little lost.
But if try squidclient:

root@checkmkIT:/usr/lib/check_mk_agent/plugins# squidclient -h 10.72.1.201:8080
ERROR: Cannot resolve 10.72.1.201:8080: Host unknown.

nmap:



root@checkmkIT:/usr/lib/check_mk_agent/plugins# nmap 10.72.1.201
Starting Nmap 7.80 ( https://nmap.org ) at 2023-12-04 10:16 CET
Nmap scan report for 10.72.1.201
Host is up (0.00010s latency).
Not shown: 997 closed ports
PORT     STATE SERVICE
22/tcp   open  ssh
80/tcp   open  http
8080/tcp open  http-proxy

Nmap done: 1 IP address (1 host up) scanned in 0.32 seconds```

Hi.

You need to run the plugin on the host where the squid is located. Running on Monitoring Server will not work. There are no port 3128. No squid is running there.

Rg, Christian

if I execute this file in remote host:

root@co42sap162:~# ./squid 
<<<squid:sep(0)>>>
Content-Type: text/plain;charset=utf-8
sample_start_time = 1701343127.345556 (Thu, 30 Nov 2023 11:18:47 GMT)
sample_end_time = 1701343427.349238 (Thu, 30 Nov 2023 11:23:47 GMT)
client_http.requests = 0.089999/sec
client_http.hits = 0.000000/sec
client_http.errors = 0.016666/sec
client_http.kbytes_in = 7.099913/sec
client_http.kbytes_out = 10.346540/sec
client_http.all_median_svc_time = 14.898263 seconds
client_http.miss_median_svc_time = 30.056059 seconds
client_http.nm_median_svc_time = 0.000000 seconds
client_http.nh_median_svc_time = 0.000000 seconds
client_http.hit_median_svc_time = 0.000000 seconds
server.all.requests = 0.093332/sec
server.all.errors = 0.000000/sec
server.all.kbytes_in = 10.349873/sec
server.all.kbytes_out = 7.109913/sec
server.http.requests = 0.016666/sec
server.http.errors = 0.000000/sec
server.http.kbytes_in = 0.000000/sec
server.http.kbytes_out = 0.006667/sec
server.ftp.requests = 0.000000/sec
server.ftp.errors = 0.000000/sec
server.ftp.kbytes_in = 0.000000/sec
server.ftp.kbytes_out = 0.000000/sec
server.other.requests = 0.076666/sec
server.other.errors = 0.000000/sec
server.other.kbytes_in = 10.349873/sec
server.other.kbytes_out = 7.103246/sec
icp.pkts_sent = 0.000000/sec
icp.pkts_recv = 0.000000/sec
icp.queries_sent = 0.000000/sec
icp.replies_sent = 0.000000/sec
icp.queries_recv = 0.000000/sec
icp.replies_recv = 0.000000/sec
icp.replies_queued = 0.000000/sec
icp.query_timeouts = 0.000000/sec
icp.kbytes_sent = 0.000000/sec
icp.kbytes_recv = 0.000000/sec
icp.q_kbytes_sent = 0.000000/sec
icp.r_kbytes_sent = 0.000000/sec
icp.q_kbytes_recv = 0.000000/sec
icp.r_kbytes_recv = 0.000000/sec
icp.query_median_svc_time = 0.000000 seconds
icp.reply_median_svc_time = 0.000000 seconds
dns.median_svc_time = 0.003722 seconds
unlink.requests = 0.000000/sec
page_faults = 0.000000/sec
select_loops = 345.909088/sec
select_fds = 231.397160/sec
average_select_fd_period = 0.000000/fd
median_select_fds = 0.000000
swap.outs = 0.000000/sec
swap.ins = 0.000000/sec
swap.files_cleaned = 0.000000/sec
aborted_requests = 0.016666/sec
syscalls.disk.opens = 0.000000/sec
syscalls.disk.closes = 0.000000/sec
syscalls.disk.reads = 0.000000/sec
syscalls.disk.writes = 0.000000/sec
syscalls.disk.seeks = 0.000000/sec
syscalls.disk.unlinks = 0.000000/sec
syscalls.sock.accepts = 0.093332/sec
syscalls.sock.sockets = 0.093332/sec
syscalls.sock.connects = 0.093332/sec
syscalls.sock.binds = 0.000000/sec
syscalls.sock.closes = 0.179998/sec
syscalls.sock.reads = 115.488583/sec
syscalls.sock.writes = 115.398584/sec
syscalls.sock.recvfroms = 0.413328/sec
syscalls.sock.sendtos = 0.179998/sec
cpu_time = 1.731968 seconds
wall_time = 300.003682 seconds
cpu_usage = 0.577316%

Thats fine. Now you need to move thsi script zo “/usr/lib/check_mk_agent/plugins”. The agent will run the script in this directory. After that, you need to do a service discovey for the given host.

Rg, Christian