Piggyback does not work

2.1.0p30
Centos 7

8 vanished services
The script should run an the CheckMK server, but removes other services.
All local script services after that part are lost.

<<<<s3-sandbox-dev.interhyp-cloud.de>>>>
<<<local>>>
0 s3-sandbox-dev - okay
<<<<>>>>

Output of “cmk --debug -vvn hostname”: (If it is a problem with checks or plugins)

<<<local:sep(0)>>>
0 DNS_PTR_Entry - DNS PTR entry exists
0 Grub_Entries - Kernel entries in /etc/grub2-efi.cfg OK
0 Check_Locked_AD_Tech_Users - All Tech AD User OK
0 LLDPD - ethernet port patch status OK
0 Puppet_Agent time=328;360;600 agent 7.24.0 is running (run-time 328 seconds)
0 Veeam_Jobs - Job "0 Default - ehyp": SUCCESS; 
0 Puppet_Env - Puppet Env: production
<<<<s3-sandbox-dev.interhyp-cloud.de>>>>
<<<local>>>
0 s3-sandbox-dev - okay
<<<<>>>>
0 SSL_Certificate_monitoring.interhyp-intern.de - Certificate will expire on 2023-11-29 - SANs: DNS:demuc2-checkmk-prod1.interhyp-infralinuxdmz.de, DNS:monitoring.interhyp-intern.de
0 Vault_Agent - Vault agent ok
0 VAULT_READ - vault login is working - read works successfully ✅
0 Process_filebeat - 1 process ^/usr/share/filebeat/bin/filebeat[^-], 3847 MB virtual, 65 MB physical, running for 11 days
0 Process_goferd - 1 process /usr/bin/goferd, 283 MB virtual, 11 MB physical, running for 10:24:20 hours
0 Process_httpd - 18 process httpd
cached(1693888241,86400) 0 Kernel_Version - Kernel Version is 3.10.0-1160.95.1.el7.x86_64 check interval 86400 sec
cached(1693888254,86400) 0 Missing_Security_Updates - MISSING SECURITY UPDATES - but below delay - see long output for details\n\npython-syspurpose.x86_64                    1.24.52-2.el7.centos centos7-updates\nsubscription-manager.x86_64                 1.24.52-2.el7.centos centos7-updates\nsubscription-manager-rhsm.x86_64            1.24.52-2.el7.centos centos7-updates\nsubscription-manager-rhsm-certificates.x86_64\n                                            1.24.52-2.el7.centos centos7-updates
<<<logwatch>>>

Even this does not work. I lose services on the server, that runs the checkmk agent.

#!/bin/bash

echo "<<<<s3-sandbox-dev.interhyp-cloud.de>>>>"
echo "<<<local>>>"
echo "0 test - andreas" 
echo "<<<<>>>>"

Storing piggyback data for: ‘s3-sandbox-dev.interhyp-cloud.de
Trying to acquire lock on /omd/sites/prod/tmp/check_mk/piggyback/s3-sandbox-dev.interhyp-cloud.de/demuc2-checkmk-prod1.interhyp-infralinuxdmz.de
Got lock on /omd/sites/prod/tmp/check_mk/piggyback/s3-sandbox-dev.interhyp-cloud.de/demuc2-checkmk-prod1.interhyp-infralinuxdmz.de
Releasing lock on /omd/sites/prod/tmp/check_mk/piggyback/s3-sandbox-dev.interhyp-cloud.de/demuc2-checkmk-prod1.interhyp-infralinuxdmz.de
Released lock on /omd/sites/prod/tmp/check_mk/piggyback/s3-sandbox-dev.interhyp-cloud.de/demuc2-checkmk-prod1.interhyp-infralinuxdmz.de
Received piggyback data for 1 hosts
Storing piggyback data for: ‘s3-sandbox-dev.interhyp-cloud.de
Trying to acquire lock on /omd/sites/prod/tmp/check_mk/piggyback/s3-sandbox-dev.interhyp-cloud.de/demuc2-checkmk-prod1.interhyp-infralinuxdmz.de
Got lock on /omd/sites/prod/tmp/check_mk/piggyback/s3-sandbox-dev.interhyp-cloud.de/demuc2-checkmk-prod1.interhyp-infralinuxdmz.de
Releasing lock on /omd/sites/prod/tmp/check_mk/piggyback/s3-sandbox-dev.interhyp-cloud.de/demuc2-checkmk-prod1.interhyp-infralinuxdmz.de
Released lock on /omd/sites/prod/tmp/check_mk/piggyback/s3-sandbox-dev.interhyp-cloud.de/demuc2-checkmk-prod1.interhyp-infralinuxdmz.de
Received piggyback data for 1 hosts

Can somebody please help me?

You cannot generate piggyback data in a Local Check.
Local Checks must only print out local check lines.

Move this script to the plugins folder.

1 Like

Thank you that was the solution. But I am using piggyback on other hosts als local scripts. I don´t understand, why it is working.

The issue is that other local checks are execute after the script that outputs the piggyback data.
The lines from these script are not in a local section any more and are lost.

This is why it is important that a script in the local directory of the agent only outputs Local Check lines and nothing else.

On your other hosts the script may be the last to be executed in the local directory.

2 Likes

Piggyback cannot be nested into a local section. Use a spool file as workaround or move the piggyback script from the local checks to the regular plugins.

1 Like