curl api call failing on platform.sh hook - bash

I'm trying to implement a message sending on my platform.sh server. The idea would be to use the existing hooks:deploy: hook in the configuration file to make a bash curl call that would send a message to an api "Deploy completed".
I use a curl snippet that works like a charm on my local machine, though the message is never sent from the server on a new deploy.
I know that the correct interpreter is bash, since the existing example in platform.sh docs is using bash code. Though, it's indicated in the docs that the disk is in read-only mode during this hook, would that be the cause of the issue?
Thanks a lot!
~SPJ

For posterity: also note that this may already exist by default in Platform.sh you can use the webhook integration to get notified of any activity.
$ platform integration:add --type=webhook --url=A-URL-THAT-CAN-RECEIVE-THE-POSTED-JSON
Details on https://docs.platform.sh/administration/integrations/webhooks.html

Hmm, I thought it was irrelevant, but French text with accents in the API parameters was causing the issue...
Hope this will help others.
~SPJ

Related

How to trigger a script when I see that I get a SNMP Set packet

I have a something that is sending an SNMP set command to my server. I can see the packet in wireshark, and I know that I'm getting the packet. Once I get this packet I need to decode it and do an operation (using a script). I can't believe I am the first person that needs to do this, but have googled for hours and found no one else in this use case. I've seen utilities that allow me to use a get snmp, but as the set doesn't actually set anything on my server, there is no way to get it. It doesn't seem traps are helpful as that seems to find the message, as its not labeled a trap. Is there a way to convert the set to a trap once my server gets it, or is there a better method. My server is windows, but if I have to create a linux VM to make this easier I'm all ears. As of now I'm thinking powershell, but if there is an easy way in go, c#, etc I would totally do it.
I am attempting to get a SNMP SET to and use that as a trigger for running a script.
You are 100% correct in that you are not the first person to ask this question. The answer depends on which SNMP agent you have deployed. Many people have had success with Net SNMP and if you want to invoke a shell script from the SNMP agent, see this tutorial. Good luck with your project.
I ended up using pythons pysnmp to build an agent that would recieve the set/get requests. I had to compile my own MIBs for the PDU I was emulating, but got the job done. I also looked into Net SNMP, but I'm more familiar with python and found many helpful examples and good documentation.
I would like to flatten my use case, but at the moment I have two scripts, one that is the agent using pysnmp and one that will do a get request to see what the value is and set off a ssh script. I wish I could hook into the snmp set function, like when the var is written, but for now I have working setup. If anyone wants me to post my code I can.
Copied a lot of code from the second example here:
https://pysnmp.readthedocs.io/en/latest/examples/v3arch/asyncore/agent/cmdrsp/agent-side-mib-implementations.html
Learned about MIB compiling and used the mbidump.py tool. Looks like if you don't provide the proper file the old host server might be compromised and it downloads a file automatically...so be careful.

Send command from TIdCmdTCPServer

I am receiving commands from a client in TIdCmdTCPServer and this works great. Now I want to send events to the client, but I cannot seem to find any place to do this. I know how to do it in TIdTCPServer, but like the clean code its Cmd equivalent gives me. How/where do I inject a text for the client?
What I've tried so far is look for a receiver thread from where I can send commands (the equivalent of TIdCmdServer's Execute thread), or something like a SendCmd, but have not found anything. Starting to wonder if this is even possible?

Whats the state for SSH on Windows in libgit2sharp

I am curious about the current state of handling SSH-Repos under windows using libgit2sharp. Is it possible to e.g. clone a Repo using SSH (git#github.com:libgit2/libgit2sharp.git) ? Thanks
As of v0.21, it's not possible yet.
A Pull request (cf. #852) is in progress to make this happen. Feel free to subscribe to it would you like to be notified of its progress.
The plan behind the scene would be to rely on libssh2 to make this happen.

Posting to Hubot via Curl

I'm running Hubot on Heroku and have connected it to Hipchat.
I'd now like to use Curl to post third-party information to the Hubot, when appropriate.
There are two scripts that seem the right fit, http-post-say.coffee or http-say.coffee. I can't get either to work.
http-post-say points to port 8080, which I don't believe will work on Heroku, and http-say simply doesn't post, without any error message.
Both scripts have zero config, and I've successfully deployed several other scripts, so I'm at a loss.
Has anyone successfully used either script in the scenario I've described, or taken a different approach to reach the same goal?
This answer is a bit late.
httpd-post-say just worked for me ignore the port 8080 for heroku just use your app url (app-name.herokuapp.com). The more confusing thing for me was for room you need to use the XMPP JID which looks like 12345_something#conf.hipchat.com. So to post a message it would look as follows for heroku.
curl -X POST http://app-name.herokuapp.com/hubot/say -d message='Hello World' -d room='12345_room_name#conf.hipchat.com'

ServiceBase.OnShutdown and event logs in Windows .Net 3.5

I've written a custom service that overrides ServiceBase.OnShutdown().
Unfortunately, when I log to the event log, nothing is written.
My guess is that the Windows event log was shut down before my service.
Is there a way to order service shutdown so that my servce shuts down
before the event logger? I don't want to have to write out to a file.
Pl. advise. Thanks.
You could try to setup a dependency where your service depends on the Event logger, this is mostly done to make them load in the correct order but I assume that might make sure that your service always was stopped first as well.
As can be seen in this Technet article, you'd need to change the DependOnService value either using the Sc.exe tool or the ChangeServiceConfig API.
There is a way, but it is more or less a Reflection-Hack.
I added my solution to an other post: Here
Hope I could help.

Resources