Skip to content

Commit 4dd32cb

Browse files
committed
v2.2.9: fix password auth, fix #78
1 parent b4e133c commit 4dd32cb

File tree

5 files changed

+27
-9
lines changed

5 files changed

+27
-9
lines changed

mamonsu/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
__author__ = 'Dmitry Vasilyev'
22
__author_email__ = '[email protected]'
33
__description__ = 'Monitoring agent for PostgreSQL'
4-
__version__ = '2.2.8'
4+
__version__ = '2.2.9'
55
__licence__ = 'BSD'
66

77
__url__ = 'https://github.com/postgrespro/mamonsu'

mamonsu/plugins/pgsql/driver/connection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def get_hash(self):
2929
'host': self.host,
3030
'port': self.port,
3131
'user': self.user,
32-
'passwd': self.user,
32+
'passwd': self.passwd,
3333
'db': self.db,
3434
'timeout': self.timeout,
3535
'appname': self.appname

packaging/debian/changelog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
mamonsu (2.2.9-1) stable; urgency=low
2+
3+
* fix password auth.
4+
5+
-- PostgresPro DBA <[email protected]> Wed, 30 Nov 2016 18:00:00 +0300
6+
17
mamonsu (2.2.8-1) stable; urgency=low
28

39
* fix double connection.

packaging/rpm/SPECS/mamonsu.spec

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Name: mamonsu
2-
Version: 2.2.8
2+
Version: 2.2.9
33
Release: 1%{?dist}
44
Summary: Monitoring agent for PostgreSQL
55
Group: Applications/Internet
@@ -70,6 +70,9 @@ chown mamonsu.mamonsu /var/log/mamonsu
7070
/sbin/chkconfig --del mamonsu
7171

7272
%changelog
73+
* Wed Nov 30 2016 Dmitry Vasilyev <[email protected]> - 2.2.9-1
74+
- fix password auth
75+
7376
* Mon Nov 28 2016 Dmitry Vasilyev <[email protected]> - 2.2.8-1
7477
- fix double connection
7578

tests/check.sh

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ class DefConfTest(Plugin):
4040
'config': 'external_plugin_config',
4141
}
4242
43-
def run(self, zbx):
44-
self.log.error(self.plugin_config('config'))
43+
def run(cls, zbx):
44+
cls.log.error(cls.plugin_config('config'))
4545
os.system("touch /tmp/extenal_plugin_is_called")
4646
EOF
4747
mamonsu export config /tmp/config
@@ -96,12 +96,12 @@ cat <<EOF > /usr/share/zabbix/conf/zabbix.conf.php
9696
<?php
9797
global \$DB;
9898
\$DB["TYPE"] = 'POSTGRESQL';
99-
\$DB["SERVER"] = 'localhost';
99+
\$DB["SERVER"] = '127.0.0.1';
100100
\$DB["PORT"] = '5432';
101101
\$DB["DATABASE"] = 'zabbix';
102102
\$DB["USER"] = 'zabbix';
103103
\$DB["SCHEMA"] = '';
104-
\$ZBX_SERVER = 'localhost';
104+
\$ZBX_SERVER = '127.0.0.1';
105105
\$ZBX_SERVER_PORT = '10051';
106106
\$ZBX_SERVER_NAME = '';
107107
\$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;
@@ -118,13 +118,22 @@ hostgroup_id=$(mamonsu zabbix hostgroup id 'Linux servers')
118118
mamonsu zabbix host create $ZABBIX_CLIENT_HOST $hostgroup_id $template_id 127.0.0.1
119119

120120
su postgres -c 'createdb mamonsu'
121-
su postgres -c 'createuser mamonsu'
121+
su postgres -c "/usr/pgsql-9.5/bin/psql -Atc \"CREATE USER mamonsu WITH password 'supersecret'\""
122+
cat <<EOF > /var/lib/pgsql/9.5/data/pg_hba.conf
123+
local all all trust
124+
host zabbix zabbix 127.0.0.1/32 trust
125+
host zabbix zabbix ::1/128 trust
126+
host all all 127.0.0.1/32 md5
127+
EOF
128+
su postgres -c '/usr/pgsql-9.5/bin/pg_ctl reload -D /var/lib/pgsql/9.5/data'
129+
122130
# start mamonsu and sleep
123131
cat <<EOF > /etc/mamonsu/agent.conf
124132
[postgres]
125-
host = auto
133+
host = 127.0.0.1
126134
user = mamonsu
127135
database = mamonsu
136+
password = supersecret
128137
129138
[zabbix]
130139
enabled = True

0 commit comments

Comments
 (0)