How sensugo server decided it is CRITICAL, WARNING or OK

Please correct my understanding.
I have three files file1.txt, file2.txt, file3.txt having OK,WARNING,CRITICAL written in them respectively. I write a bash script which simply grep or cat these files randomly. I create a check and use this bash script as command.
If script grep or cat file1.txt, it should return OK and display as green, if file2.txt, it should return WARNING and display orange similarly CRITICAL if grep or cat file3.txt.
Please illuminate me.

@masifpak howdy! The TL;DR here is that Sensu cares only about the exit status of a script (see . In your example, your script will only ever return 2 exit codes: 0 or 1. Either the command was able to successfully cat the file, or the command failed (there are more status codes that could be a possibility, but let’s just assume you misspelled your filename). In this case Sensu would treat the ability to cat the file successfully as OK and a failure as a WARNING and wouldn’t care at all about the text of the file. Does this help?

@aaronsachs-sensu . Thanks for your help. You made my day. Again Thanks.