This article was written for version 6.1 of Monitor, it could work on both lower and higher version if nothing else is stated.
Articles in the Community-Space are not supported by op5 Support.
This is a side effect of how Livestatus Query Language is designed, and not an intended feature.
The syntax of filtering on custom variables will change, so don't expect it to work in the future. It's useful for simple searches, and possibly some saved queries, which will need to be updated later. But don't embed it in other programs. They will stop working when we update this feature, and implement it in a more user-friendly way.
show all hosts that have "_NOMONITORING" set to something (the "." stands for "any character)
[hosts] custom_variables ~~ "NOMONITORING ."
show all hosts that have "_NOMONITORING" set to "1234"
[hosts] custom_variables ~~ "NOMONITORING 1234"
show all services called something with "ping" on hosts that have "_NOMONITORING" set to "1234"
[services] host.custom_variables ~~ "NOMONITORING 1234" and description ~~ "ping"