Hi,
On 09/10/2018 08:26 PM, Lee Clemens wrote:
On 09/10/2018 10:30 AM, Václav Mach wrote:
Hi,

I'm using a script for automatic deployments of new configuration using 
director. The script should notify me when some problem occurs. The script is 
called from cronjob.

A part of this script checks if the configuration was deployed successfully or 
not - see 
https://github.com/CESNET/eduroam-icinga/blob/master/sync/main.sh#L31-L47

It seems that this specific parts behaves strange. Sometimes it gives me the 
startup log as it should, but sometimes it just gives me NULL. The deploy takes 
only several seconds, at least it seems so from icingaweb - configuration is 
successfully deployed several seconds after cronjob ran.

Is there some better way to check if the newly deployed configuration is valid 
and that startup log does not contain any warnings/errors?

It would obviously be an up-front cost, but using the REST API may be useful 
particularly looking forward. You can do a lot with it, including 
/director/config/deploy. However, I'm not sure if you can (yet) read the 
activities or deployments information.

I receive a 404 from /director/config/activities and 
/director/config/deployments, but /director/config/deploy returns the checksum 
that could theoretically be used in further requests/queries. That same 
checksum is stored in the database, so a hybrid approach in the interim may be 
possible e.g.:

mysql# select startup_succeeded, startup_log from director_deployment_log where 
hex(config_checksum) = '<checksum returned by API call>'


I actually get the deploy checksum from the script i mentioned. The output of lines https://github.com/CESNET/eduroam-icinga/blob/master/sync/main.sh#L21-L26 is:

+ local count=0
++ icingacli director config deploy
+ out='Config '\''aefc2853e626de35b639f554a26ec33b4ecf6fce'\'' has been deployed' + [[ Config 'aefc2853e626de35b639f554a26ec33b4ecf6fce' has been deployed =~ nothing to do ]]

I do not think that the problem is in the sql query im using. My query is: 'select id,startup_succeeded from director_deployment_log order by id desc limit 1;'

I'm getting the highest id which is the newest one. Why should this be a problem and why do i get NULL after more than 60 seconds if the deploy actually takes several seconds?

cheers,
Vaclav

--
Václav Mach
tel: +420 234 680 206
CESNET, z.s.p.o.
www.cesnet.cz

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
icinga-users mailing list
icinga-users@lists.icinga.org
https://lists.icinga.org/mailman/listinfo/icinga-users

Reply via email to