Dynamic boolean value reversed?

vars.mysql_slave[""] = {
mysql_slave_down_timeperiod = “defined_timeperiod”
mysql_check_slave = !(get_time_period(mysql_slave_down_timeperiod).is_inside)
display_name_suffix = ternary(! mysql_check_slave, “: Slave Downtime”, “”)
}

<1> => get_service(“HOST”, “mysql-multi-slave”).vars.mysql_check_slave
false
<2> => !(get_time_period(get_service(“HOST”, “mysql-multi-slave”).vars.mysql_slave_down_timeperiod).is_inside)
true
<3> => get_service(“HOST”, “mysql-multi-slave”).vars.mysql_slave_down_timeperiod
“defined_timeperiod”

Is there a way to fix this?

Thanks,
Gerardo

Hello and welcome to the community!

I would like to ask you to elaborate a bit further on the issue you are having so others have an easier time understanding what you’re asking :slight_smile:

Michael posted a nice guide on how to improve readability in mardown, if you want to give that a look too:

Thanks for participating!
Feu

Thanks!

So the the idea behind this is:

There is a mysql server, which is a slave, and it is used to take backups of the master.

While taking backups, the slave is stopped.

So, during a given timeperiod, the slave should not be checked, but the rest of the server should be

basically, the underlying command, check_mysql, should be called with -S to check the slave, and without -S in the other.

Now, I am confused because the value of the variable is different than the value of its definition.

Is it called only when the service is defined?

If that is the case, how can it be made so it is called per check?

Thank you,
Gerardo

You’re not calling is_inside and negating the result, but negating is_inside’s memory address (always false). Is this intended?