# How check if variable is not null or is set

**URL:** <https://community.icinga.com/t/how-check-if-variable-is-not-null-or-is-set/814>\
**Category:** Icinga 2\
**Created:** [April 4, 2019, 6:41am UTC](https://community.icinga.com/t/how-check-if-variable-is-not-null-or-is-set/814 "2019-04-04T06:41:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sajet](https://community.icinga.com/letter_avatar_proxy/v4/letter/s/43a26b/32.png) [@sajet](https://community.icinga.com/u/sajet)\
**Post date:** [April 4, 2019, 6:41am UTC](https://community.icinga.com/t/how-check-if-variable-is-not-null-or-is-set/814/1 "2019-04-04T06:41:47Z")

</div>

Hello!  
How check if variable in Service or Host object is set or is not null?  
Best regards.  
Tadeja

---

<div class="post-metadata">

**Author:** ![log1c](https://community.icinga.com/user_avatar/community.icinga.com/log1c/32/2071_2.png) [@log1c](https://community.icinga.com/u/log1c)\
**Post date:** [April 4, 2019, 7:00am UTC](https://community.icinga.com/t/how-check-if-variable-is-not-null-or-is-set/814/2 "2019-04-04T07:00:25Z")

</div>

Two examples:

Check if host name matches and if variable is set:  
`assign where match("TS-*-LR01", host.name) && host.vars.dmvpn`

Check if host name matches and if variable is NOT set  
`assign where match("TS-*-LR01", host.name) && ! host.vars.dmvpn`
