Twitter handler (sensu and ruby) troubleshooting - ruby

I'm trying to get Sensu twitter-handler working on my environment. The issue is that I'm not getting any errors on screen or logs when I cat a .json event into the twitter-handler and, the tweets are not being shown on the linked account.
Here're are my config files:
https://gist.github.com/Mariano-gon/8648427
https://gist.github.com/Mariano-gon/8648455
https://gist.github.com/Mariano-gon/8648489
This is the output I get:
https://gist.github.com/Mariano-gon/8648480
One important note is that in sensu-api.log the request are being recieved:
https://gist.github.com/Mariano-gon/8673758
So, my question is: is there a way to troubleshoot this issue? Any way to debug the handler.rb?
Thanks!

Finally got it working! Thing was the new 'twitter' gem (in my case v5.6) won't work with the code as it was written. I needed to follow this great answer and this thread too. Was just a matter of sintaxis (as usual).
Thanks!

Related

Where does the output of dd() and dump() get written when developing Laravel in VS Code?

I'm developing a Laravel 8.x app in the current version of VS Code. I have a dump() statement in a Controller that I've written so that I can determine precisely what's in the $request that is being handled because I suspect that my date isn't exactly what I think it is. I've added this to the store() method: $request->dump() and I'm pretty sure it has executed but I can't find the output from the dump() function anywhere. I've got Debugbar installed and it does not show the dump() output. Ditto for any window of the browser like the console, inspector, etc. I've looked in the laravel.log but it's not there either. I've checked each of my terminal windows - the ones dedicated to php artisan serve and npm run watch and the one I use for all other commands but I can't find anything there. I'm out of ideas on where to look.
If the Laravel docs tell you where to find the output, I missed it; they describe what dump() and dd() do but I can't find where they describe where the output is written.
I'm pretty new to Laravel and I'm working alone so I have no work colleagues to ask. Could someone kindly tell me where to find the output of dump() so that I can debug this program?
None of the comments pointed me to precisely where I eventually found the dd() output so I'm posting it here for the sake of any future person who has the same issue. I finally found it in the browser, in the console tab (I'm using Firefox) and within the Response to the Axios statement that tried to write the new record to the database. Here's a picture:
I had assumed that the information wouldn't require me to drill down as far as I did; I thought it would be as visible as normal console.log() output.
I'm very grateful to those who replied to my question; you finally got me looking in the exact right place. I've never used dd() or dump() before, even in vanilla PHP, so I really had no idea where the output got written.

Reporting to Sentry to proof that it's working, like on start up?

We are using Sentry for finding some errors.
How do you proof, that a reporting is working?
I had a Spring-Boot project, which was not sending any error to Sentry, so it looks like it was working without an error, but I saw in Kibana, that there have been errors.
So, my configuration was wrong. After fixing the setup, it's now sending the errors to Sentry too.
Is there any way to proof that the sending to Sentry is working?
Something like on startup of my Spring-Boot application sending a first string?
I found 2 possible solutions which both sucks, so that's why I ask for a more professional way:
I can make just on application start up a log.error("sentry is working")
I can set the log-level from warning / error to info just to see that it's working and if see it in Sentry, you change it back?
But as i mentioned, both methods are not good, so let me know how you are resolving problems like this
are unprofessional to me, so let me know
There isn't a real "answer" here currently, as part of Sentry's simplicity is it doesn't do anything until an error happens. One potential solution is to introduce a path like example.com/500 that deliberately errors.

Trouble with Codeigniter Cron Job

I am haveing trouble with getting a cron job to work with codeigniter
I have used these instructions.
https://www.codeigniter.com/user_guide/general/cli.html
But it is not working
Here is what I have.
php /home4/markwolf/public_html/propalert.asia/index.php admin_notifications index
But it is not finding the right controller or the method, instead it is going to the "default_controler". Everything else I've tried gets a 404 not found error.
I've been pulling my hair out for two days trying to get this to work so any help would be greatly appreciated.
Thanks
EDIT
This works:
wget -q http://propalert.asia/admin_notifications
But the problem with this method is that Codeigniter's method for protecting the script by checking whether it is accessed by cli returns false.
I came across this post at CI's forum describing the same problem.
https://ellislab.com/forums/viewthread/236475/#1055830
Unfortunately he never got an answer there either.
I finally found the solution:
/usr/bin/php-cli -q /home4/markwolf/public_html/propalert.asia/index.php admin_notifications index
the key is "php-cli" instead of "php".
But then there is a bug in the CI core that needs to be fixed. You can find the solution to that here:
https://ellislab.com/forums/viewthread/227672/

Dredd - API Blueprint Testing Tool. "Undefined" issue

I installed dredd - API Blueprint Testing Tool and trying to test our APIary API against the implementation.
In the blueprint I have just one resource which is correctly implemented on somehost... but test fails :(
test command:
dredd apiary.apib http://somehost.de:8443/imp-endpoint
output:
Info: Beginning Dredd testing...
undefined
I tried also with more options to get more information what is undefined.. like -l verbose and some other options. But I did not get more information about the failure :(
Does anyone have experience with it? Thank you!!! :)
Answered on Github but I'll reproduce the main points here for reference:
I wasn't able to to reproduce your "undefined" problem, but there are a few issues that, when corrected, make everything work.
At the moment, the base url can't have a path in it (see #43). This is solved in #45 but hasn't yet been merged. So your command should be 'dredd apiary.apib http://somehost.de:8443/' and then '/imp-endpoint' should be a prefix on the urls.
The URI template is incorrect in your apib file. Instead of /api/V0/Resources/CarSharing/Cars?{lat}&{lng}&{radius}, it should be /imp-endpoint/api/V0/Resources/CarSharing/Cars{?lat,lng,radius}. See RFC6750 for reference.
The line-endings should be Unix style, not Windows (\n, not \n\r). When I first ran the apib you provided, I got the error: the use of carriage return(s) '\r' in source data isn't currently supported, please contact makers (this is actually enforced by the blueprint parser, see snowcrash)
Hope that helps! I get a 401 when running the test, so you'll need to provide HTTP Basic authentication information (this can be done in the header section of the blueprint or with the -u flag on dredd, as in -u username:password)

Twitter Streams API with Heroku

Hi I'm really becoming mad with this problem. I need to continuously post to another server some tweets, in realtime. They are filtered by a hashtag.
I'm using this solution: http://joslynesser.com/blog/archives/2010/09/12/consuming-the-twitter-streaming-api-with-heroku-and-mongodb/#comment-form
If I change it to use filter.json it works (alias retrieves tweets) only with words that have a lot of traffic on Heroku, while it works with my hashtag from my local machine. I tried with different accounts.
Anyone can please shed light?
Thanks.
OK I sorted it out, with the TweetStream gem. See the code here: https://github.com/aledalgrande/mongo-twitter-streaming/blob/master/app.rb
Fully working on Heroku!!!

Resources