Use "Summary" and "Detail" field in Linux Bash Scripts

Hey guys

How can I use the field “Summary” and “Detail” in Linux Bash Scripts? I wrote a script with some special Outputs - And I would like to bring all them into the summary section.

Thanks and greetz
Ovrld

Hi,
do you mean as a local check? if so, see this example, which shows the format of the first new line and has some sed magic to transform line breaks into \n if your output comes from another command:

#!/bin/bash
# gerd.stolz 2021
httpd_output=$(httpd -S 2>/dev/null)

#sed command from https://superuser.com/questions/955935/how-can-i-replace-a-newline-with-its-escape-sequence/1632938
echo 0 Apache_httpd_-S_details - Click for details \\n $(echo "$httpd_output" | sed ':a;N;$!ba;s/\n/\\n/g')```

Thanks you for your help - it’s not really working here for me:

echo "0 '$NAME Status' OK: $NAME Systemstatus OK - Click for details \\n §("$ENVSTATUS" "$UPGRADESTATUS")```"

(with ``` it’s not working in general - with ‘’’ I got it running, but it’s not working properly with my Agent output - I affects all other plugins after that - which means, that there is an issue with that).

Here are the outputs I got with ‘’’ when I run the script:

<<<local>>>
0 'Program Status' OK: Program Systemstatus OK - Click for details \n §(OK Environment (core_environment) Your server is fine.  OK Upgrade (core_upgradecheck) No upgrade needed for the installed version 1.1.1 (Build: 2222) (2222). Thanks!)'''

not sure why the rest after it is affected, but I the format is incorrect, after the service name, you first need performance data or, if you don’t want any, a single “-”

And the <<>> header is maybe a little off - do you print that yourself, or are you still running a 1.6 agent? (in case of cmk 1.6 ‘Program Status’ as the service name won’t work, only Program_Status without spaces!) it should be <<local:sep(0)>> but that is automatically taken care of by the agent.

if that doesn’t help:

  • Can you maybe share the agent output starting from the local section?
  • can you share the path of your script?