You bet you can.
Have a look at your contacts.cfg. See how it’s using “service_notification_commands notify-by-email”? That means when a service alert happens and that contact (or contact group with that user in it) is listed in your service definition, it will run “notify-by-email”.
Have a look at your misccommands.cfg. See that “notify-by-email” command? that is what’s run when nagios sends out a service alert.
So what you need to do is define another command in misccommands.cfg. eg:
then make your sentinelscript.sh do what you need it to do! but heres the thing, make the script so that if you run it once, it touches the sentinal so that the data is no longer sent, but if it’s run again, it re-enables it. This is so that when the CRITICAL alert is sent out, it runs your sentinal script disabling what it needs to. Then when free space is recovered, you get an OK alert, and the script runs again to enable the sentinels again. I’m not sure how you’re going to do this since i’m not there, might i suggest keeping a file on the hosts with a 1 or a 0 in it, then doing a certain action based on that, and switching the number as necessary?
so, your last step, add the touch-sentinel command definition to your contacts.cfg.
not sure about the comma here. might want to test with a simple script to make sure it’s running the next command.