Ad Widget

Collapse

Rubix API host.update not working

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mattsims
    Junior Member
    • Jul 2013
    • 8

    #1

    Rubix API host.update not working

    Does anyone use Rubix for Zabbix API?

    Rubix's lack of documentation doesn't really help much. If I can't get help here I'll ditch it for something else.

    I'm having issues getting Rubix to perform a host.update.

    Here is my syntax. The real host has been replaced with test-host.

    Code:
    Rubix.connection.request(
        "host.update",
        "host" =>  "test-host",
        "params" => {
          "status" => 0,
          "interfaces" => [
            "type" => 1,
            "main" => 1,
            "useip" => 0, 
            "ip" => "0.0.0.0",
            "dns" => dnsname,
            "port" => "10050"
          ],
          "groups" => ["Unregistered"],
          "templates" => ["10411"]
        } 
      )
    The error I get is

    #<Rubix::Response:0x000000009c9aa0 @http_response=#<Net::HTTPOK 200 OK readbody=true>, @body="{\"jsonrpc\":\"2.0\",\"error\":{\"code\":-32602,\"message\":\"Invalid params.\",\"data\":\"Wrong fields for host \\\"test-host\\\".\"},\"id\":4}", @code=200>

    Now, I did attempt to use hostid in place of host like so:

    Code:
    Rubix.connection.request(
        "host.update",
        "hostid" => 10798,
        "params" => {
          "status" => 0,
          "interfaces" => [
            "type" => 1,
            "main" => 1,
            "useip" => 0,
            "ip" => "0.0.0.0",
            "dns" => dnsname,
            "port" => "10050"
          ],
          "groups" => ["Unregistered"],
          "templates" => ["10411"]
        }
      )
    The output looks better:

    #<Rubix::Response:0x00000001b68810 @http_response=#<Net::HTTPOK 200 OK readbody=true>, @body="{\"jsonrpc\":\"2.0\",\"result\":{\"hostids\ ":[10798]},\"id\":4}", @code=200>

    But there was no change of the host in Zabbix. As if it didn't update.

    So I'm looking for anyone else who uses Rubix. And if you think Rubix is not the way to go, which Ruby wrapper do you recommend for Ruby1.9?
  • mattsims
    Junior Member
    • Jul 2013
    • 8

    #2
    So Rubix hasn't been updated since Aug 2012. It appears to not fully work with Zabbix 2.

    Moving on to zabbixapi ruby gem instead.

    Comment

    • nelsonab
      Senior Member
      Zabbix Certified SpecialistZabbix Certified Professional
      • Sep 2006
      • 1233

      #3
      Zbxapi was the first gem and is still in active use/development on github. http://www.github.com/red-tux/zbxapi If you see somethig needed open a ticket or feel free to fork and open a pull request.
      RHCE, author of zbxapi
      Ansible, the missing piece (Zabconf 2017): https://www.youtube.com/watch?v=R5T9NidjjDE
      Zabbix and SNMP on Linux (Zabconf 2015): https://www.youtube.com/watch?v=98PEHpLFVHM

      Comment

      Working...