Splunk AppDynamics

Telegram Config

Nardus_Geldenhu
Explorer

Hi

Hope you are well. Try to get telegram notifications going. So I did create a HTTP Request Template and it is working, but I can not get rid of the html formatting when I receive messages from telegram. Anyone got this working.

Example of telegram messages:

AppDynamics has detected a problem with DB Server <b>dbserver:3333</b>.<br><b>Databases Health</b> continues
to violate with <b>critical</b>.<br>All of the following conditions were
found to be violating<br>For DB Server <b>dbserver:3333</b>:<br>1) Condition 3<br><b>Slave_IO_Running's</b>
value <b>1.00</b> was <b>within</b> baseline-based calculated value
<b>1.00</b> by <b>1.00</b> standard deviation(s) <b>0.00</b> for the last
<b>1</b> minutes.<br> Baseline used here is '<b>Daily Trend - Last 30
days</b>'. 11:24

Thanks

Regards

Nar

Labels (3)
0 Karma

Morelz
Motivator

Hi There

Are you using the text/plain MIME type encoding for the POST?

0 Karma

Nardus_Geldenhu
Explorer

Hi

Changing it did not help, I need to do a application/json payload.

#set( $sm = $!{latestEvent.summaryMessage.replace('"',"*")} )
#set( $sm = $sm.replace("<b>", "*") )
#set( $sm = $sm.replace("</b>", "*") )
#set( $sm = $sm.replace("<br>", " ") )
#set( $sm = $sm.replace("null"," ") )

{
"chat_id":"-24143434398",
"text":"${latestEvent.displayName}:\n\n${latestEvent.eventMessage}"
}

Regards

Nar

0 Karma

Morelz
Motivator

Thanks

Can you advise how you have set up Telegram to post messages to it?

I assume you created a Channel & Bot, added the Bot to the Channel and using the following type of URL

https://api.telegram.org/bot1346170414:AAFeH7D1Idjtw_pfH1-6ZwhHNtDE8JZ7_t4/sendMessage?chat_id=41551...

Can you share the HTTP request Template configuration(Method, URl etc) of how you are posting to telegram, to better assist and is there a reason you are posting it in json format, if telegram accepts text?

Ciao

0 Karma

Nardus_Geldenhu
Explorer

Hey

Look at screenshots.

image.png

image.png

Regards

Nardus

0 Karma

Morelz
Motivator

Awesome

Ok you only strip out the HTML in the first section(latestEvent.summaryMessage), not for the last 2 values of 

latestEvent.displayName

latestEvent.eventMessage

#set( $sm = $!{latestEvent.summaryMessage.replace('"',"*")} )
#set( $sm = $sm.replace("<b>", "*") )
#set( $sm = $sm.replace("</b>", "*") )
#set( $sm = $sm.replace("<br>", " ") )
#set( $sm = $sm.replace("null"," ") )

#set( $sm1 = $!{latestEvent.displayName.replace('"',"*")} )
#set( $sm1 = $sm1.replace("<b>", "*") )
#set( $sm1 = $sm1.replace("</b>", "*") )
#set( $sm1 = $sm1.replace("<br>", " ") )
#set( $sm1 = $sm1.replace("null"," ") )

#set( $sm2 = $!{latestEvent.eventMessage.replace('"',"*")} )
#set( $sm2 = $sm2.replace("<b>", "*") )
#set( $sm2 = $sm2.replace("</b>", "*") )
#set( $sm2 = $sm2.replace("<br>", " ") )
#set( $sm2 = $sm2.replace("null"," ") )

{
"chat_id":"535514651",
"text":"$sm1:\n\n$sm2"
}

I tested and no html in my telegram message

It's not the cleanest way, so you can clean it up as best as you wish:)

Nardus_Geldenhu
Explorer

Testing, thanks

Will let know

Nardus_Geldenhu
Explorer

Hi

Thanks for the reply

Trying that now

Nar

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Unlocking Unified Insights: New Gigamon Federated Search App for Splunk

In today’s data-heavy environment, organizations are caught in a data distribution dilemma. As data volumes ...

GA: New Data Management App in Splunk Platform

Streamlining Data Management: Introducing a unified experience in Splunk Managing data at scale shouldn’t feel ...

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...