Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatible with pgbarman 1.6.0? #11

Open
sorano opened this issue Apr 26, 2016 · 4 comments
Open

Incompatible with pgbarman 1.6.0? #11

sorano opened this issue Apr 26, 2016 · 4 comments

Comments

@sorano
Copy link

sorano commented Apr 26, 2016

Greetings dev.

Recently updated our pgbarman installation to 1.6.0 and decided it was time to have some proper checks to verify the backups are proper.
However I am having some issues when running most of the check-barman actions. The psql setup is master --> slave replication with wal_level hot standby. Barman is running on the slave host, dumping to a locally mounted share.

whoami
barman

gem list rbarman
*** LOCAL GEMS ***
rbarman (0.0.15)

barman -v
1.6.0

The only check that works

./check-barman.rb -a pg -s main
PG connection ok

The checks that fails

./check-barman.rb -a ssh -s main
SSH connection failed!

Although SSH works according to barman itself

barman check main | grep ssh
ssh: OK (PostgreSQL server)

The ssh check I can live without. However the "good" checks spits out more fails which I interpret as being related to rbarman:
./check-barman.rb -a last_wal_received -s main -w 300 -c 600

/var/lib/gems/1.9.1/gems/rbarman-0.0.15/lib/rbarman/cli_command.rb:216:in block in parse_backup_list': undefined method[]' for nil:NilClass (NoMethodError)
from /var/lib/gems/1.9.1/gems/rbarman-0.0.15/lib/rbarman/cli_command.rb:205:in each' from /var/lib/gems/1.9.1/gems/rbarman-0.0.15/lib/rbarman/cli_command.rb:205:inparse_backup_list'
from /var/lib/gems/1.9.1/gems/rbarman-0.0.15/lib/rbarman/cli_command.rb:67:in backups' from /var/lib/gems/1.9.1/gems/rbarman-0.0.15/lib/rbarman/backups.rb:20:inall'
from ./check-barman.rb:43:in latest_backup_id' from ./check-barman.rb:84:incheck_last_wal_received'
from ./check-barman.rb:237:in `

'

./check-barman.rb -a failed_backups -s main -w 1 -c 2

/var/lib/gems/1.9.1/gems/rbarman-0.0.15/lib/rbarman/cli_command.rb:216:in block in parse_backup_list': undefined method[]' for nil:NilClass (NoMethodError)
from /var/lib/gems/1.9.1/gems/rbarman-0.0.15/lib/rbarman/cli_command.rb:205:in each' from /var/lib/gems/1.9.1/gems/rbarman-0.0.15/lib/rbarman/cli_command.rb:205:inparse_backup_list'
from /var/lib/gems/1.9.1/gems/rbarman-0.0.15/lib/rbarman/cli_command.rb:67:in backups' from /var/lib/gems/1.9.1/gems/rbarman-0.0.15/lib/rbarman/backups.rb:20:inall'
from ./check-barman.rb:102:in check_failed_backups' from ./check-barman.rb:240:in

'

barman show-backup main latest

Backup 20160425T220004:
Server Name : main
Status : DONE
PostgreSQL Version : 90312
PGDATA directory : /var/lib/postgresql/9.3/main

Base backup information:
Disk usage : 10.6 GiB (10.6 GiB with WALs)
Incremental size : 9.7 GiB (-7.99%)
Timeline : 1
Begin WAL : 000000010000001B00000020
End WAL : 000000010000001B00000021
WAL number : 2
WAL compression ratio: 75.47%
Begin time : 2016-04-25 22:00:04.299301+02:00
End time : 2016-04-25 22:45:06.371444+02:00
Begin Offset : 9289632
End Offset : 0
Begin XLOG : 1B/208DBFA0
End XLOG : 1B/22000000

WAL information:
No of files : 7
Disk usage : 28.5 MiB
WAL rate : 0.59/hour
Compression ratio : 74.56%
Last available : 000000010000001B00000028

Catalog information:
Retention Policy : VALID
Previous Backup : 20160424T220003
Next Backup : - (this is the latest base backup)

Any help towards a solution would be appreciated.

@hamann
Copy link
Owner

hamann commented Apr 26, 2016

Thanks for your report!

We're still on barman 1.3.x in production and I've never tested with barman 1.6, so it's quite likely that rbarman/check-barman is incompatible. I'll try to investigate the next couple of days

@kevkev82
Copy link

Hi,
I had the same problem, it seems that with the 1.6 barman version the output of ssh command changes from "OK" to "OK (PostgreSQL server)" so the plugin is not able anymore to parse the output correctly.

I'm on centOS 6.5 and I found where to change the test in folder /usr/local/rvm/gems/ruby-2.1.3/gems/rbarman-0.0.15/lib/rbarman , you need to edit the file cli_command.rb :

change :
def parse_check_lines(server, lines) raise(ArgumentError, 'arg server not of type Server') if !server.is_a? Server lines.each do |l| key, value = l.gsub("\t","").split(": ") case key.chomp when "ssh" server.ssh_check_ok = value == "OK" ? true : false when "PostgreSQL" server.pg_conn_ok = value == "OK" ? true : false end end end

to

def parse_check_lines(server, lines) raise(ArgumentError, 'arg server not of type Server') if !server.is_a? Server lines.each do |l| key, value = l.gsub("\t","").split(": ") case key.chomp when "ssh" server.ssh_check_ok = value == "OK (PostgreSQL server)" ? true : false when "PostgreSQL" server.pg_conn_ok = value == "OK" ? true : false end end end

@hamann
Copy link
Owner

hamann commented Feb 27, 2017

Thanks, I'll have a look. Should be easy to solve

@hamann
Copy link
Owner

hamann commented Feb 27, 2017

Should be fixed here. @kevkev82 could you try it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants