# How sensugo server decided it is CRITICAL, WARNING or OK

**URL:** <https://discourse.sensu.io/t/how-sensugo-server-decided-it-is-critical-warning-or-ok/1420>\
**Category:** Sensu Go\
**Created:** [October 29, 2019, 5:57am UTC](https://discourse.sensu.io/t/how-sensugo-server-decided-it-is-critical-warning-or-ok/1420 "2019-10-29T05:57:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![masifpak](https://avatars.discourse-cdn.com/v4/letter/m/b38774/32.png) [@masifpak](https://discourse.sensu.io/u/masifpak)\
**Post date:** [October 29, 2019, 5:57am UTC](https://discourse.sensu.io/t/how-sensugo-server-decided-it-is-critical-warning-or-ok/1420/1 "2019-10-29T05:57:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![aaronsachs](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.sensu.io/aaronsachs/32/47_2.png) [@aaronsachs](https://discourse.sensu.io/u/aaronsachs)\
**Post date:** [October 29, 2019, 11:30am UTC](https://discourse.sensu.io/t/how-sensugo-server-decided-it-is-critical-warning-or-ok/1420/2 "2019-10-29T11:30:07Z")

</div>

@masifpak howdy! The TL;DR here is that Sensu cares _only_ about the exit status of a script (see [https://docs.sensu.io/sensu-go/5.14/reference/checks/#check-result-specification](https://docs.sensu.io/sensu-go/5.14/reference/checks/#check-result-specification)) . 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?

---

<div class="post-metadata">

**Author:** ![masifpak](https://avatars.discourse-cdn.com/v4/letter/m/b38774/32.png) [@masifpak](https://discourse.sensu.io/u/masifpak)\
**Post date:** [October 30, 2019, 4:35am UTC](https://discourse.sensu.io/t/how-sensugo-server-decided-it-is-critical-warning-or-ok/1420/3 "2019-10-30T04:35:33Z")

</div>

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