Grafana Alert Notification Message - grafana

I have installed the grafana 9 on ubunt 20.04 and trying to setup alerting but i don't know how to send the common_name result from below grafana query in the alert notification message so please check and suggest what i have to do to add common_name in the notification. ??
I think may be i need to use templating in this case ?? if yes then please share the sample template which can help because i am not much familiar with golang.
SELECT (expiry / 60 / 60 / 24) as "expiry" FROM "x509_cert" WHERE $timeFilter GROUP BY common_name,san
Thanks

Related

Zabbix: how to parse error messages from web scenario checks as a macro

I just setup dozens of web scenario checks in Zabbix. I also added triggers and one action for all the triggers. To test the action I deployed a test bad web scenario check, however an email message I got from the test only gave very high-level information:
Problem: Service "Jira-QAS" is DOWN
------------​​​​​​​----​​​​​​​-------​​​​​​​----​​​​​​​----​​​​​​​----​​​​​​​-------​​​​​​​----​​​​​​​----​​​​​​​----​​​​​​​-------​​​​​​​----​​​​​​​----​​​​​​​----​​​​​​​----
Application: CloudOps
Problem started at 13:41:38 on 2019.11.20
Problem name: Service "Jira-QAS" is DOWN
Severity: High
Status: PROBLEM
Value: 1
Original problem ID: 2314429
----​​​​​​​----​​​​​​​----​​​​​​​----​​​​​​​-------​​​​​​​----​​​​​​​----​​​​​​​----​​​​​​​-------​​​​​​​----​​​​​​​----​​​​​​​----​​​​​​​-------​​​​​​​----​​​​​​​----​​​​​​​----​​​​​​​----
I want to parse "Last error message of scenario ..." as a macro and put it in the "default message" in "Action", so it would look something like this:
Problem: Service "Jira-QAS" is DOWN
----​​​​​​​----​​​​​​​----​​​​​​​----​​​​​​​-------​​​​​​​----​​​​​​​----​​​​​​​----​​​​​​​-------​​​​​​​----​​​​​​​----​​​​​​​----​​​​​​​-------​​​​​​​----​​​​​​​----​​​​​​​----​​​​​​​----
Application: CloudOps
Problem started at 13:41:38 on 2019.11.20
Problem name: Service "Jira-QAS" is DOWN
Severity: High
Issue: Couldn't connect to server: Failed connect to jira-qas.aws.ca:443; Connection refused
Original problem ID: 2314429
----​​​​​​​----​​​​​​​----​​​​​​​----​​​​​​​-------​​​​​​​----​​​​​​​----​​​​​​​----​​​​​​​-------​​​​​​​----​​​​​​​----​​​​​​​----​​​​​​​-------​​​​​​​----​​​​​​​----​​​​​​​----​​​​​​​----
I tried different macros such as {ITEM.VALUE}, {EVENT.STATUS}, but neither of them were good enough.
You need to define Operational Data in the trigger, and add {EVENT.OPDATA} to the mail.
Operational data allow to define arbitrary strings along with macros. The macros will resolve dynamically to real time data in Monitoring → Problems. While macros in the trigger name (see above) will resolve to their values at the moment of a problem happening and will become the basis of a static problem name, the macros in the operational data maintain the ability to display the very latest information dynamically.
The same set of macros is supported as in the trigger name.
https://www.zabbix.com/documentation/current/manual/config/triggers/trigger

LiquidSoap - modifying stream meta description to match schedule

So using LiquidSoap for driving my radio station. I have 3 playlists defined and a schedule to switch between them:
pl1 = nrj(playlist("/var/www/html/radiojuno.com/playlists/pl1.m3u"))
pl2 = nrj(playlist("/var/www/html/radiojuno.com/playlists/pl2.m3u"))
pl3 = nrj(playlist("/var/www/html/radiojuno.com/playlists/pl3.m3u"))
radio = switch([ ({22h-7h}, pl1), ({7h-19h}, pl2), ({19h-22h}, pl3) ])
output.icecast(
%mp3,
host = "localhost",
port = 8000,
password = "xxxx",
mount = "mymount",
genre="Electronic",
description="**Current show description**",
url="http://example.com",
radio
)
I'd like to modify the description of the stream according to the current schedule.
But I can't work out how this can be achieved with LiquidSoap. I've been staring at https://www.liquidsoap.info/doc-1.4.2/metadata.html for hours!
Can anyone help?
It's a pity, but Icecast does not support updating the server information like name or description during a source connection.
The reason for this is that those information are sent via HTTP headers when the source client connects to the server. For more information have a look at the protocol.
Here are the sources backing up my answer:
https://github.com/savonet/liquidsoap/issues/710
http://lists.xiph.org/pipermail/icecast/2010-December/011774.html
http://lists.xiph.org/pipermail/icecast/2005-April/009022.html

Updating SLA via REST (PyOTRS)

I'm working on a little project right now and therefor I tried to update the Service Level Agreement (SLA) of a ticket which has no SLA assigned yet, by using PyOTRS, but it didn't work. Getting the Information SLA or SLAID of a Ticket did work with this code:
from pyotrs import Client
client = Client("http://otrs.example.com", "root#localhost", "password")
client.session_create()
myticket = client.ticket_get_by_id("1")
print(myticket.field_get(("SLA")))
But Updating the SLA or SLAID didn't work with the following code (It worked for other attributes like Owner, Responsible, etc.). So my Question is, is it possible to update the SLA/SLAID and if yes, what am I doing wrong?
from pyotrs import Client
client = Client("http://otrs.example.com", "root#localhost", "password")
client.session_create()
myticket = client.ticket_update(1, SLAID="1")
This is the Error Message I get:
OTRS Error Code: TicketUpdate.InvalidParameter
OTRS Error Message: TicketUpdate: Ticket->SLAID or Ticket->SLA parameter is invalid!
We faced the same issue and were able to solve it.
As a precondition, the SLA must be assigned to a Service in OTRS.
Afterwards you have to send SLAID and ServiceID to the system to get a ticket with SLA created.

Hubot Message Only Specific Channel On Enter/Leave

Working on creating a list of messages that Hubot can randomly choose from to display in the #general channel when someone joins the company. I've got the message part working, but it's doing it on ANY channel... how can I limit it to just a specific channel? One step further, would like to take the users name who entered and paste it inside the sentences if possible.
Thanks!
validWelcome = [
'We have a new kid on the block, Hello!'
'Welcome the newest member to the team!'
'Thanks for joining us!'
'Happy to have you here!'
]
module.exports = (robot) ->
robot.enter (msg) ->
msg.send {room: '#integration-test'}, msg.random validWelcome
There are two issues to consider
Does the chat software you are using expose enough information to Hubot via the adapter when a user joins a room (see docs)
Do you want to display this message if someone leaves and re-joins the #general room?
Taking a wild guess that you are using Slack you can see what the Slack adaptor sends you here. You really want access to channel.name but you can get channel.id from msg.room and take it from there and solve #1. If you're not using Slack find the source for your adapter and search for EnterMessage.
If you want to solve #2 you'll need to do something clever with Hubot's brain and record the fact that you've sent a welcome for each user.

QBO API V3.0: Persistent error today retrieving Tax Rates

We have consistently getting the following error today when using API V3.0 to retrieve TaxRate from QBO:
An application error has occurred while processing your request - Detail: System Failure Error: An unexpected error occurred while accessing or saving your data. Please wait a few minutes and try again. If the problem persists, contact customer support. - Error Code: 10000
Is this a temporary issue with the servers or has something changed in the API ?
Thanks
I tried both the taxrate endpoints(findById and Query) from ApiExplorer and got a successful response.
GetById - https://qb.sbfinance.intuit.com/v3/company/688779980/taxrate/2
Query - https://qb.sbfinance.intuit.com/v3/company/688779980/query?query=select * from TaxRate
Can you please give it a try from ApiExplorer and check if you are hitting the correct endpoints. Otherwise you can raise a support ticket mentioning your company's relamID.
EDIT
Standard BASE URL for V3 - https://quickbooks.api.intuit.com/v3/company
We get the following when we try this call using devkit -
https://quickbooks.api.intuit.com/v3/company/1119166485/query?query=select+*+from+TaxRate&requestid=faf9f5e207134f24930eef40c9b8a21a&
Thanks
There is a bug in .net devkit where IDSquery will not work for count.
You need to use the following lamda function until the fix is in place-
QueryService AccQueryService2 = new QueryService(context);
int accs22= AccQueryService2.Select(c => c).Count();
Refer:
https://intuitpartnerplatform.lc.intuit.com/questions/829658-how-to-select-count-from-invoice-using-idsquery-to-return-int?jump_to=comment_1941998
EDIT:
The team has identified this a bug. They will rectify this in the next release around 1 month from now.