Skip to content

Commit

Permalink
Add "user.authenticate" for older Zabbix servers. Update changelog an…
Browse files Browse the repository at this point in the history
…d README.
  • Loading branch information
Farzad FARID committed Mar 27, 2012
1 parent 67d0f6c commit 00256a1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ChangeLog.rdoc
Expand Up @@ -2,6 +2,14 @@

List of visible changes:

== v0.1.2 (2012/03/27)

* Older Zabbix 1.8.x used "user.authenticate" instead of "user.login", we must try both methods.
* Improve command line parsing. It is now easier to pass parameters to a "zabbysh" script withtout
having to prepend "--".
* Make some methods private.
* Internal: add an primary key to Zabby classes (not used yet).

== v0.1.1 (2012/03/14)

* Initialization code (the argument given to "Zabby.init") was not executed.
Expand Down
4 changes: 4 additions & 0 deletions README.rdoc
Expand Up @@ -159,6 +159,8 @@ Now to execute the script you just have to type:

# ./my_zabbix_commands.zby

Zabbysh script can have their own command line parameters (with libs like 'optparse').

=== API use

The barebone API can be used in Ruby like this:
Expand All @@ -171,6 +173,7 @@ The barebone API can be used in Ruby like this:
set :server => "https://monitoring.example.com"
set :user => "api_user"
set :password => "s3cr3t"
# The proxy settings are of coure optional

This comment has been minimized.

Copy link
@renchap

renchap Mar 27, 2012

You have a typo here (courSe)

This comment has been minimized.

Copy link
@Farzy

Farzy Mar 27, 2012

Member

Thanks :)

set :proxy_host => "http://10.10.10.10"
set :proxy_user => "john"
set :proxy_password => "D0e"
Expand Down Expand Up @@ -222,6 +225,7 @@ Farzad FARID mailto:ffarid@pragmatic-source.com
- Nicolas Blanco (slainer68): Advices on code design and Triple Facepalming after reading other Ruby/Zabbix code.
- Renaud Chaput (renchap): For suggesting the "zabby" name.
- Folks on the irc channel #rubyonrails.fr@Freenode
- Beta testers: A-Kaser, gaetronik.

=== Sources of inspiration

Expand Down
6 changes: 6 additions & 0 deletions lib/zabby/connection.rb
Expand Up @@ -55,6 +55,12 @@ def authenticate
'user' => @user,
'password' => @password)
@auth = query_zabbix_rpc(auth_message)
rescue Zabby::APIError
# Older Zabbix 1.8.x used a different authentication method. You have to guess...
auth_message = format_message('user', 'authenticate',
'user' => @user,
'password' => @password)
@auth = query_zabbix_rpc(auth_message)
rescue Exception => e
@auth = nil
raise e
Expand Down

0 comments on commit 00256a1

Please sign in to comment.