Is it bad form to call a php script from a ruby sensu handler?
That is just what I did to get Sensu to send incidents to osTicket and create tickets:
result = %x[php /opt/sensu/api_ticket_create.php “#{phpargs}”]
Maybe it would be worth rewriting into ruby to get it shared on sensu-community-plugins but that is beyond me at this point.
I will clean it up a bit before doing a PR. I will post it on the osTicket forums and spread the word about Sensu.
Dan
As the docs say, it is possible to create a plugin in any language, but ideally they could be all written in Ruby. You could create a GIST and post the link here so we could see the code.
···
On Thursday, 13 February 2014 21:05:08 UTC, Dan Fischer wrote:
Is it bad form to call a php script from a ruby sensu handler?
That is just what I did to get Sensu to send incidents to osTicket and create tickets:
result = %x[php /opt/sensu/api_ticket_create.php “#{phpargs}”]
Maybe it would be worth rewriting into ruby to get it shared on sensu-community-plugins but that is beyond me at this point.
I will clean it up a bit before doing a PR. I will post it on the osTicket forums and spread the word about Sensu.
Dan
I put the ruby and php code up here: https://gist.github.com/canoedf/9001274
I tried to use a single line of curl instead of using php curl but just could not work out the syntax for an error free osTicket API call.
This is my first ruby work ever - be gentle
Dan
···
On Friday, February 14, 2014 3:00:25 AM UTC-7, Riccardo Tacconi wrote:
As the docs say, it is possible to create a plugin in any language, but ideally they could be all written in Ruby. You could create a GIST and post the link here so we could see the code.
On Thursday, 13 February 2014 21:05:08 UTC, Dan Fischer wrote:
Is it bad form to call a php script from a ruby sensu handler?
That is just what I did to get Sensu to send incidents to osTicket and create tickets:
result = %x[php /opt/sensu/api_ticket_create.php “#{phpargs}”]
Maybe it would be worth rewriting into ruby to get it shared on sensu-community-plugins but that is beyond me at this point.
I will clean it up a bit before doing a PR. I will post it on the osTicket forums and spread the word about Sensu.
Dan
Change OSTICKET class to OSTicket, you have to use 2 spaces soft tabs, that’s a rule accepted in the Ruby community. You can make a POST request with ruby and it is very simple:
http://stackoverflow.com/questions/16474985/how-do-i-post-json-via-http-in-ruby-after-conversion-from-python
Why are you using the begin statement?
timemout(30) does not exist, try
while true do
puts Time.now # or call tick function
sleep 30
end
Why you are not running your code to see if it works?
···
On 14 February 2014 13:58, Dan Fischer ebay2007buys@gmail.com wrote:
I put the ruby and php code up here: https://gist.github.com/canoedf/9001274
I tried to use a single line of curl instead of using php curl but just could not work out the syntax for an error free osTicket API call.
This is my first ruby work ever - be gentle
Dan
On Friday, February 14, 2014 3:00:25 AM UTC-7, Riccardo Tacconi wrote:
As the docs say, it is possible to create a plugin in any language, but ideally they could be all written in Ruby. You could create a GIST and post the link here so we could see the code.
On Thursday, 13 February 2014 21:05:08 UTC, Dan Fischer wrote:
Is it bad form to call a php script from a ruby sensu handler?
That is just what I did to get Sensu to send incidents to osTicket and create tickets:
result = %x[php /opt/sensu/api_ticket_create.php “#{phpargs}”]
Maybe it would be worth rewriting into ruby to get it shared on sensu-community-plugins but that is beyond me at this point.
I will clean it up a bit before doing a PR. I will post it on the osTicket forums and spread the word about Sensu.
Dan
–
Riccardo Tacconi
Ruby on Rails and PHP development - System Administration
VIRTUELOGIC LIMITED
http://github.com/rtacconi
http://riccardotacconi.blogspot.com
http://twitter.com/rtacconi