Celery rerun application with specify time - redis

I have a question about Celery.
I have subscribe system and want to send message in telegram bot by specific time.
#celery.task
def subscribe(chat_id, refresh_time):
//response from api and after sendmessage in bot with webhook
This task need to work infinite with by sleeping refresh time.
How i can do that ?

Related

Can you add a Nagios Acknowledgment URL to Slack messages

I'm new to nagios and my first task has been slack integration. I am using the Nagios created plugin for Slack and everything is working correctly as far as posting the message in the channels for both hosts and services. I want to add an acknowledgment URL to the message that gets sent to slack, so our team can just acknowledge through the slack message. I have tried adding the URL in various places, like the host/service definitions so I could then call it in the command Slack_notification_handlers. Is it possible to add said acknowledgement urls with the current methods I'm using? or is this something I'm going to have to make myself?

Spinnaker Webhook timeout

I want to add webhook stage for integration tests for out system like here, not sure if you can access it
But it times out within 20 seconds of request (the endpoint responds in around 30-35s). Is there any way to increase the timeout for webhook stage?

Log Laravel API calls to AWS Cloudwatch

I have been using this package (https://github.com/maxbanton/cwh) to setup logging in my laravel 8 app.
I can already send the logs properly and see them in Cloudwatch and what I am trying to do is to log the API calls (request and response). I was able to do this by doing it by adding it in the middleware. My only question is that how can you do this asynchronously? I have found this discussion posted as an issue and this was the suggested solution (https://github.com/maxbanton/cwh/issues/25#) but I couldn't figure out how to implement it.
Has anybody able to send API logs to Cloudwatch asynchronously? Thank you.
What you can try is sent the call to a queued job or listener (beanstalkd preferably as using DB as storage will probably take the same time as sending the log to AWS) that is not running on the sync queue.
This way you can fire the call off to something else, and that can deal with it without you waiting for it.

Create a channel on a discord server with webhook

I am using the discord webhook api to send messages to my discord servers channels. In a new use case I want to create a new channel with a webhook. Unfortunately I could not find any API to do so. I read through the whole documentation here: https://discordapp.com/developers/docs/resources/webhook#create-webhook
Is this even possible to do? I saw methods for a discord bot that allowed it - therefore I kinda think it should be possible with a webhook, too.
I think the Discord webhooks are only for sending messages and nothing more and you'll probably have to use a bot to create the channel if you don't want to do it manually.
Creating a webhook via discord.py API is only supported on the rewrite branch I think
Installing discord.py-rewrite
pip install git+https://github.com/Rapptz/discord.py#rewrite
import discord
from discord.ext.commands import Bot
bot=Bot(command_prefix='.')
#bot.event
async def on_ready():
print(bot.user.name)
#bot.command()
async def chan(msg):
chan=await msg.guild.create_text_channel(name='New text')
web=await chan.create_webhook(name='New web')
print(web.url)
bot.run("YOUr bot token here")
you can find the documentation here and you can create your bot here

How to receive webhook signal from 3rd party service

I'm using a SaaS for my AWS instance monitoring and Mandrill for email sending/campaigns.
I had created a simple chart with Zapier but I'd rather like to host it myself. So my question is:
How can I receive a webhook signal from Mandrill and then send it to Datadog from my server? Then again I guess hosting this script right on the same server I'm monitoring would be a terrible idea...
Basically I don't know how to "receive the webhook" so I can report it back to my Datadog service agent so it gets updated on their website.
I get how to actually report the data to Datadog as explained here http://docs.datadoghq.com/api/ but I just don't have a clue how to host a listener for web hooks?
Programming language isn't important, I don't have a preference for that case.
Here you can find how to add a new webhook to your mandrill account: https://mandrillapp.com/api/docs/webhooks.php.html#method=add
tha main thing here is this:
$url = 'http://example/webhook-url';
this is your webhook URL what will process the data sent by mandrill and forward the information to Datadog.
and this is a description about what mandrill will send to your webhook URL: http://help.mandrill.com/entries/21738186-Introduction-to-Webhooks
a listener for webhooks is nothing else then a website/app which triggers an action if a request comes in. Usually you keep it secret or secure it with (http basic) authentication. E.g. create a website called http://yourdomain.com/hooklistener.php. You can then call it with HTTP POST or GET and pass some data like hooklistener.php?event=triggerDataDog or with POST and send data along with the body. You then run a script or anything you want to process that event.
A "listener" is just any URL that you host where you can receive data that is posted to it. Keep in mind, since you mentioned Zapier, you can set up a trigger that receives the webhook data - in this case the listener URL is provided by Zapier, and you can then send that data into any application (or even post to another webhook). Using Zapier is nice because it doesn't require you to write the listener code that receives the hook data and does something with it.