ajrnz / rundeck-telegram-plugin

Allows Rundeck to send notifications to Telegram
Apache License 2.0
18 stars 9 forks source link

Failed to send telegram Message: Null #1

Closed Nhoya closed 8 years ago

Nhoya commented 8 years ago
Config: {telegramProperties=/etc/rundeck/telegram.properties, botAuthToken=12345678:xxxxxxxxxxxxxxxxxxxxx, templateMessage=mynet: ${job.group}/check_stuff
Status: ${status} (${context.job.execid}), templateDir=/var/lib/rundeck/templates, telegramApiBaseUrl=https://api.telegram.org, chatId=45483937, templateName=status.ftl}
Failed to send Telegram message: null
ERROR NotificationService: Notification Failed: TelegramNotification

status.ftl

${job.project}: ${job.group}/${job.name}
Status: ${status} (${context.job.execid})

telegram.properties

project.plugin.Notification.TelegramNotification.projectBotAuthToken=12345678:xxxxxxxxxxxxxxxxxxxxx
framework.plugin.Notification.TelegramNotification.projectBotAuthToken=12345678:xxxxxxxxxxxxxxxxxxxxx
project.plugin.Notification.TelegramNotification.templateDir=/var/lib/rundeck/templates
framework.plugin.Notification.TelegramNotification.templateDir=/var/lib/rundeck/templates
project.plugin.Notification.TelegramNotification.telegramApiBaseUrl=https://api.telegram.org 
telegram.ids.chat.me=myid
project.plugin.Notification.TelegramNotification.templateNameProject=status.ftl
framework.plugin.Notification.TelegramNotification.templateNameProject=status.ftl

Any suggestion?

ajrnz commented 8 years ago

It's not obvious what is causing this but it is probably configuration. I've made a 1.0.1 release which has slightly better error reporting which should make the problem easier to locate. Can you try it out please.

Nhoya commented 8 years ago
ExecutionData: {id=11305, href=myurl:myportproject//execution/follow/11305, status=succeeded, user=admin, dateStarted=2016-05-30 17:50:57.609, dateStartedUnixtime=1464623457609, dateStartedW3c=2016-05-30T15:50:57Z, description=controllo valori critici, argstring=null, project=checkstuff, failedNodeListString=null, failedNodeList=null, succeededNodeListString=xxxxxxxx, succeededNodeList=[xxxxxxx], loglevel=INFO, dateEnded=2016-05-30 17:52:03.222, dateEndedUnixtime=1464623523222, dateEndedW3c=2016-05-30T15:52:03Z, abortedby=null, nodestatus={succeeded=4, failed=0, total=4}, job={id=a2e60e67-b2ec-4397-8ca5-c95aaaa39ac1, href=https://myurl:myport/project/job/show/a2e60e67-b2ec-4397-8ca5-c95aaaa39ac1, name=check_stuff, group=, project=checkstuff, description=controllo valori critici, averageDuration=66493}, context={job={loglevel=INFO, wasRetry=false, url=https://myurl:myport/project/execution/follow/11305, id=a2e60e67-b2ec-4397-8ca5-c95aaaa39ac1, project=check, user.email=me@mail.com, username=admin, retryAttempt=0, user.name=admin, name=check_stuff, serverUUID=null, group=null, serverUrl=https://myurl:myport/, execid=11305}, option={}}}

Config: {telegramProperties=/etc/rundeck/telegram.properties, botAuthToken=123456:xxxxxxxxxxxxxxxxxxxxx, templateMessage=check_stuff, templateDir=/var/lib/rundeck/templates, telegramApiBaseUrl=https://api.telegram.org, chatId=zzzzzz, templateName=status.ftl}
Failed to send Telegram message - check config: ajr.rundeck.telegram.TelegramNotificationPlugin$InvalidConfigException
ajr.rundeck.telegram.TelegramNotificationPlugin$InvalidConfigException
    at ajr.rundeck.telegram.TelegramNotificationPlugin.missing(TelegramNotificationPlugin.scala:105)
    at ajr.rundeck.telegram.TelegramNotificationPlugin$$anonfun$4.apply(TelegramNotificationPlugin.scala:126)
    at ajr.rundeck.telegram.TelegramNotificationPlugin$$anonfun$4.apply(TelegramNotificationPlugin.scala:126)
    at scala.Option.getOrElse(Option.scala:121)
    at ajr.rundeck.telegram.TelegramNotificationPlugin.get(TelegramNotificationPlugin.scala:96)
    at ajr.rundeck.telegram.TelegramNotificationPlugin.postNotification(TelegramNotificationPlugin.scala:126)
    at com.dtolabs.rundeck.plugins.notification.NotificationPlugin$postNotification$0.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
    at com.dtolabs.rundeck.plugins.notification.NotificationPlugin$postNotification.call(Unknown Source)
    at rundeck.services.NotificationService.triggerPlugin(NotificationService.groovy:475)
    at rundeck.services.NotificationService.this$2$triggerPlugin(NotificationService.groovy)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1207)
    at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1110)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1016)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1152)
    at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1110)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1016)
    at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:153)
    at rundeck.services.NotificationService$_triggerJobNotification_closure5.doCall(NotificationService.groovy:337)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1207)
    at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1110)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1016)
    at groovy.lang.Closure.call(Closure.java:423)
    at groovy.lang.Closure.call(Closure.java:439)
    at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1379)
    at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1372)
    at org.codehaus.groovy.runtime.dgm$149.invoke(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:271)
    at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:53)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
    at rundeck.services.NotificationService.triggerJobNotification(NotificationService.groovy:146)
    at sun.reflect.GeneratedMethodAccessor1258.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1207)
    at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1110)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1016)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1152)
    at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1110)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1016)
    at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:149)
    at rundeck.services.NotificationService$_triggerJobNotification_closure1.doCall(NotificationService.groovy:88)
    at sun.reflect.GeneratedMethodAccessor1257.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:207)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:68)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:73)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
    at org.codehaus.groovy.grails.orm.hibernate.HibernateGormStaticApi$6.doInHibernate(HibernateGormStaticApi.groovy:513)
    at org.codehaus.groovy.grails.orm.hibernate.GrailsHibernateTemplate.doExecute(GrailsHibernateTemplate.java:179)
    at org.codehaus.groovy.grails.orm.hibernate.GrailsHibernateTemplate.execute(GrailsHibernateTemplate.java:123)
    at org.codehaus.groovy.grails.orm.hibernate.GrailsHibernateTemplate$execute$0.call(Unknown Source)
    at org.codehaus.groovy.grails.orm.hibernate.HibernateGormStaticApi.withNewSession(HibernateGormStaticApi.groovy:511)
    at rundeck.ScheduledExecution.withNewSession(ScheduledExecution.groovy)
    at rundeck.ScheduledExecution$withNewSession$7.call(Unknown Source)
    at rundeck.services.NotificationService.triggerJobNotification(NotificationService.groovy:85)
    at rundeck.services.NotificationService$triggerJobNotification$0.call(Unknown Source)
    at rundeck.services.ExecutionService$_saveExecutionState_closure61.doCall(ExecutionService.groovy:2087)
    at sun.reflect.GeneratedMethodAccessor1554.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:207)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:68)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:73)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
    at org.codehaus.groovy.grails.orm.hibernate.HibernateGormStaticApi$6.doInHibernate(HibernateGormStaticApi.groovy:513)
    at org.codehaus.groovy.grails.orm.hibernate.GrailsHibernateTemplate.doExecute(GrailsHibernateTemplate.java:179)
    at org.codehaus.groovy.grails.orm.hibernate.GrailsHibernateTemplate.execute(GrailsHibernateTemplate.java:123)
    at org.codehaus.groovy.grails.orm.hibernate.GrailsHibernateTemplate$execute$0.call(Unknown Source)
    at org.codehaus.groovy.grails.orm.hibernate.HibernateGormStaticApi.withNewSession(HibernateGormStaticApi.groovy:511)
    at rundeck.Execution.withNewSession(Execution.groovy)
    at rundeck.Execution$withNewSession$4.call(Unknown Source)
    at rundeck.services.ExecutionService.saveExecutionState(ExecutionService.groovy:1992)
    at rundeck.services.ExecutionService$$FastClassBySpringCGLIB$$ffb73873.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:708)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
    at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:644)
    at rundeck.services.ExecutionService$$EnhancerBySpringCGLIB$$5e5c87b2.saveExecutionState(<generated>)
    at rundeck.services.ExecutionService$saveExecutionState$25.call(Unknown Source)
    at rundeck.quartzjobs.ExecutionJob$_saveState_closure4.doCall(ExecutionJob.groovy:480)
    at rundeck.quartzjobs.ExecutionJob$_saveState_closure4.doCall(ExecutionJob.groovy)
    at sun.reflect.GeneratedMethodAccessor1640.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:207)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:68)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:73)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)
    at rundeck.quartzjobs.ExecutionJob.withRetry(ExecutionJob.groovy:418)
    at sun.reflect.GeneratedMethodAccessor1284.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrap.invoke(PogoMetaMethodSite.java:187)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:56)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:153)
    at rundeck.quartzjobs.ExecutionJob.saveState(ExecutionJob.groovy:490)
    at rundeck.quartzjobs.ExecutionJob$saveState$5.callCurrent(Unknown Source)
    at rundeck.quartzjobs.ExecutionJob.execute_internal(ExecutionJob.groovy:146)
    at sun.reflect.GeneratedMethodAccessor1612.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1207)
    at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1110)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1016)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1152)
    at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1110)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1016)
    at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)
    at rundeck.quartzjobs.ExecutionJob$_execute_closure1.doCall(ExecutionJob.groovy:74)
    at rundeck.quartzjobs.ExecutionJob$_execute_closure1.doCall(ExecutionJob.groovy)
    at sun.reflect.GeneratedMethodAccessor1681.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1207)
    at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1110)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1016)
    at groovy.lang.Closure.call(Closure.java:423)
    at groovy.lang.Closure.call(Closure.java:417)
    at com.codahale.metrics.Timer.time(Timer.java:99)
    at com.codahale.metrics.Timer$time$0.call(Unknown Source)
    at rundeck.quartzjobs.ExecutionJob.execute(ExecutionJob.groovy:73)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
ERROR NotificationService: Notification Failed: TelegramNotification
INFO  ExecutionService: updated scheduled Execution
ajrnz commented 8 years ago

It looks like it's having trouble getting the auth token although it is in the map on your logs. Can you try configuring the auth token at project level projectAuthToken and see if that works. I'll make a version with a bit more debugging when I'm near a computer.

ajrnz commented 8 years ago

Actually projectBotAuthToken

Nhoya commented 8 years ago

It looks like it's having trouble getting the auth token although it is in the map on your logs. Can you try configuring the auth token at project level projectAuthToken and see if that works. I'll make a version with a bit more debugging when I'm near a computer.

How can i do that?

ajrnz commented 8 years ago

Check out the README

Also please try out version 1.0.2 it should identify the problem.

However looking again at your configuration the projectBotAuthToken should be an alias for the bot auth token not the actual token itself (it's badly named I know). You need to map this alias to the bot in /etc/rundeck/telegram.properties. See the example in the README. This is most probably the problem.

Nhoya commented 8 years ago

Still failing

here is the logs

Config: {telegramProperties=/etc/rundeck/telegram.properties, botAuthToken=123456:xxxxxxxxxxxxx, templateMessage=check_stuff, templateDir=/var/lib/rundeck/templates, telegramApiBaseUrl=https://api.telegram.org, chatId=xxxxxxx, templateName=status.ftl}
Failed to send Telegram message - check config: ajr.rundeck.telegram.TelegramNotificationPlugin$InvalidConfigException: Missing configuration: botAuthToken or projectBotAuthToken
ajr.rundeck.telegram.TelegramNotificationPlugin$InvalidConfigException: Missing configuration: botAuthToken or projectBotAuthToken
    at ajr.rundeck.telegram.TelegramNotificationPlugin.missing(TelegramNotificationPlugin.scala:105)
    at ajr.rundeck.telegram.TelegramNotificationPlugin$$anonfun$4.apply(TelegramNotificationPlugin.scala:126)
    at ajr.rundeck.telegram.TelegramNotificationPlugin$$anonfun$4.apply(TelegramNotificationPlugin.scala:126)
    at scala.Option.getOrElse(Option.scala:121)
    at ajr.rundeck.telegram.TelegramNotificationPlugin.get(TelegramNotificationPlugin.scala:96)
    at ajr.rundeck.telegram.TelegramNotificationPlugin.postNotification(TelegramNotificationPlugin.scala:126)
    at com.dtolabs.rundeck.plugins.notification.NotificationPlugin$postNotification$0.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
    at com.dtolabs.rundeck.plugins.notification.NotificationPlugin$postNotification$0.call(Unknown Source)
    at rundeck.services.NotificationService.triggerPlugin(NotificationService.groovy:475)
    at rundeck.services.NotificationService.this$2$triggerPlugin(NotificationService.groovy)
    at sun.reflect.GeneratedMethodAccessor1719.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1207)
    at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1110)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1016)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1152)
    at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1110)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1016)
    at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:153)
    at rundeck.services.NotificationService$_triggerJobNotification_closure5.doCall(NotificationService.groovy:337)
    at sun.reflect.GeneratedMethodAccessor1712.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1207)
    at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1110)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1016)
    at groovy.lang.Closure.call(Closure.java:423)
    at groovy.lang.Closure.call(Closure.java:439)
    at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1379)
    at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1372)
    at org.codehaus.groovy.runtime.dgm$149.invoke(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:271)
    at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:53)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
    at rundeck.services.NotificationService.triggerJobNotification(NotificationService.groovy:146)
    at sun.reflect.GeneratedMethodAccessor1258.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1207)
    at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1110)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1016)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1152)
    at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1110)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1016)
    at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:149)
    at rundeck.services.NotificationService$_triggerJobNotification_closure1.doCall(NotificationService.groovy:88)
    at sun.reflect.GeneratedMethodAccessor1257.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:207)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:68)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:73)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
    at org.codehaus.groovy.grails.orm.hibernate.HibernateGormStaticApi$6.doInHibernate(HibernateGormStaticApi.groovy:513)
    at org.codehaus.groovy.grails.orm.hibernate.GrailsHibernateTemplate.doExecute(GrailsHibernateTemplate.java:179)
    at org.codehaus.groovy.grails.orm.hibernate.GrailsHibernateTemplate.execute(GrailsHibernateTemplate.java:123)
    at org.codehaus.groovy.grails.orm.hibernate.GrailsHibernateTemplate$execute$0.call(Unknown Source)
    at org.codehaus.groovy.grails.orm.hibernate.HibernateGormStaticApi.withNewSession(HibernateGormStaticApi.groovy:511)
    at rundeck.ScheduledExecution.withNewSession(ScheduledExecution.groovy)
    at rundeck.ScheduledExecution$withNewSession$7.call(Unknown Source)
    at rundeck.services.NotificationService.triggerJobNotification(NotificationService.groovy:85)
    at rundeck.services.NotificationService$triggerJobNotification$0.call(Unknown Source)
    at rundeck.services.ExecutionService$_saveExecutionState_closure61.doCall(ExecutionService.groovy:2087)
    at sun.reflect.GeneratedMethodAccessor1554.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:207)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:68)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:73)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
    at org.codehaus.groovy.grails.orm.hibernate.HibernateGormStaticApi$6.doInHibernate(HibernateGormStaticApi.groovy:513)
    at org.codehaus.groovy.grails.orm.hibernate.GrailsHibernateTemplate.doExecute(GrailsHibernateTemplate.java:179)
    at org.codehaus.groovy.grails.orm.hibernate.GrailsHibernateTemplate.execute(GrailsHibernateTemplate.java:123)
    at org.codehaus.groovy.grails.orm.hibernate.GrailsHibernateTemplate$execute$0.call(Unknown Source)
    at org.codehaus.groovy.grails.orm.hibernate.HibernateGormStaticApi.withNewSession(HibernateGormStaticApi.groovy:511)
    at rundeck.Execution.withNewSession(Execution.groovy)
    at rundeck.Execution$withNewSession$4.call(Unknown Source)
    at rundeck.services.ExecutionService.saveExecutionState(ExecutionService.groovy:1992)
    at rundeck.services.ExecutionService$$FastClassBySpringCGLIB$$ffb73873.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:708)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
    at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:644)
    at rundeck.services.ExecutionService$$EnhancerBySpringCGLIB$$5e5c87b2.saveExecutionState(<generated>)
    at rundeck.services.ExecutionService$saveExecutionState$25.call(Unknown Source)
    at rundeck.quartzjobs.ExecutionJob$_saveState_closure4.doCall(ExecutionJob.groovy:480)
    at rundeck.quartzjobs.ExecutionJob$_saveState_closure4.doCall(ExecutionJob.groovy)
    at sun.reflect.GeneratedMethodAccessor1640.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:207)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:68)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:73)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)
    at rundeck.quartzjobs.ExecutionJob.withRetry(ExecutionJob.groovy:418)
    at sun.reflect.GeneratedMethodAccessor1284.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrap.invoke(PogoMetaMethodSite.java:187)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:56)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:153)
    at rundeck.quartzjobs.ExecutionJob.saveState(ExecutionJob.groovy:490)
    at rundeck.quartzjobs.ExecutionJob$saveState$5.callCurrent(Unknown Source)
    at rundeck.quartzjobs.ExecutionJob.execute_internal(ExecutionJob.groovy:146)
    at sun.reflect.GeneratedMethodAccessor1612.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1207)
    at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1110)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1016)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1152)
    at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1110)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1016)
    at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)
    at rundeck.quartzjobs.ExecutionJob$_execute_closure1.doCall(ExecutionJob.groovy:74)
    at rundeck.quartzjobs.ExecutionJob$_execute_closure1.doCall(ExecutionJob.groovy)
    at sun.reflect.GeneratedMethodAccessor1681.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1207)
    at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1110)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1016)
    at groovy.lang.Closure.call(Closure.java:423)
    at groovy.lang.Closure.call(Closure.java:417)
    at com.codahale.metrics.Timer.time(Timer.java:99)
    at com.codahale.metrics.Timer$time$0.call(Unknown Source)
    at rundeck.quartzjobs.ExecutionJob.execute(ExecutionJob.groovy:73)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
ERROR NotificationService: Notification Failed: TelegramNotification
INFO  ExecutionService: updated scheduled Execution

And here the content of telegram.properties

project.plugin.Notification.TelegramNotification.projectBotAuthToken=messenger_bot
framework.plugin.Notification.TelegramNotification.projectBotAuthToken=123456:xxxxxxxxxxxxxxxxxxxx
project.plugin.Notification.TelegramNotification.templateDir=/var/lib/rundeck/templates
framework.plugin.Notification.TelegramNotification.templateDir=/var/lib/rundeck/templates
project.plugin.Notification.TelegramNotification.telegramApiBaseUrl=https://api.telegram.org 
telegram.ids.chat.myname=xxxxxxx
telegram.ids.bot.messenger_bot=123456:xxxxxxxxxxxxxxxxxxxx
project.plugin.Notification.TelegramNotification.templateNameProject=status.ftl
framework.plugin.Notification.TelegramNotification.templateNameProject=status.ftl

And here a screenshot of what i use in the project settings Rundeck

ajrnz commented 8 years ago

Ok got it. There was a bug which meant that you had to have a project auth token sent.

BTW: You cannot define project properties in telegram.properties (see README). You configure these in the RunDeck GUI via Configure (left of Admin) -> Project Configuration: <Project> -> Edit Configuration File

Either way version 1.0.3 should fix your problem

Nhoya commented 8 years ago

It worked, thank you so much. Just a simple request, can you add to the readme how to generate and use a Rundeck API key and how to use the FreeMaker Vars? Because using ${suceeededNodeList} i got

Expecting a string, date or number here, Expression succeededNodeList is instead a reemarker.template.SimpleSequence
The problematic instruction:

Same with ${nodestatus}

Expecting a string, date or number here, Expression nodestatus is instead a freemarker.template.SimpleHash
The problematic instruction:
----------
==> ${nodestatus} [on line 2, column 43 in message]
ajrnz commented 8 years ago

Thanks for the feedback.

I've added a link to the RunDeck documentation for generating the API key

Explaining how to use Freemarker is a beyond the scope of the README. There is plenty of documentation online on the Freemarker site and on StackOverflow.

To dump lists and hashes you can do:

SucceededNodeList: <#list succeededNodeList as item>${item}, </#list>

Node status:
<#assign keys = nodestatus?keys>
<#list keys as key>${key} = ${nodestatus[key]}; </#list>