Trying to get logic honor if-statements to control output

@thl-cmk In reply to your post… for a part you are correct as to the input. ( the client bash script was included in the original post)

However due to the nature of updates i cannot tell in advance if a category is present in the output.

So in this the status would need to reflect OK when there are no numbers present in the output ( the output of the client-script will just read "“No updates found”

So my way of handling this is to report (return) state.OK immediately, not evaluating further logic.

IF however the evaluation does return true on having a number, then further evaluation is needed as to how many, and what type of update is available.

So in your example i cannot tell if line contains either ‘Bugfix, Enhancement, Security’ or even how many lines my output has.
Therefore i am searching for a way to loop over all presented to the server, and in the end have a cumulative state and multiple line summary.

For your insight as to the summary i am looking for as example when multiple categories of updates are available:

3 Bugfix Update(s) [WARN],
2 Enhancement Update(s) [WARN],
1 Security Update(s) [CRIT]

Calculating a total status of the service as [CRIT]

… and yes i have been reading the referenced “Writing your own check plug-ins” over and over again :slight_smile:

  • Glowsome