pgstats - database "nobody" does not exist
michaelgrosh opened this issue · 5 comments
munin-run --pidebug pgstats.py
EXCEPTION: FATAL: database "nobody" does not exist
Traceback (most recent call last):
File "/etc/munin/plugins/pgstats.py", line 495, in ?
main()
File "/etc/munin/plugins/pgstats.py", line 491, in main
sys.exit(muninMain(MuninPgPlugin))
File "/usr/share/munin/plugins/pymunin/init.py", line 829, in muninMain
plugin = pluginClass(argv, env, debug)
File "/etc/munin/plugins/pgstats.py", line 111, in init
self._user, self._password)
File "/usr/share/munin/plugins/pysysinfo/postgresql.py", line 69, in init
self._connect()
File "/usr/share/munin/plugins/pysysinfo/postgresql.py", line 81, in _connect
self._conn = psycopg2.connect('')
psycopg2.OperationalError: FATAL: database "nobody" does not exist
cat /etc/munin/plugin-conf.d/pgstats
[pgstats]
user postgres
env.user postgres
env.db_include SIPXCDR
I am running this on CentOS 5.8(PyMunin 0.9.19 ) and CentOS 6.2(PyMunin 0.9.4-2)
Hi Michael,
There seems to be a problem connecting to the database. It is as if munin-run is not reading the configuration file and trying to run the plugin script with user nobody and trying to connect to the database with user nobody. What puzzles me is the fact that, when I do testing the error message is not "EXCEPTION: FATAL: database "nobody" does not exist", but "EXCEPTION: FATAL: database "nobody" does not exist"
The only way I can explain this is to assume that you have created the role "nobody" in the database. Could you verify if you have a database user / role with name nobody?
The next question is to verify if there is any reason for munin-run to ignore the configuration file, and I would check the following:
- Are you running munin-run with root user?
- Are you sure the configuration file is in the correct directory?
- Are you sure the symbolic link for the plugin is created with the correct name. (The configuration file will only apply if the symlink name is identical to pgstats.)
Moreover, with the default configuration of PostgreSQL on CentOS, just specifying the user parameter and leaving out env.user must be sufficient to establish a connection with the database.
To verify if the configuration file is really being used, you might try to set env.user to a user that does not exist in the database:
[pgstats]
env.user xyzxyz
On my system the following error is reported when running the plugin with the configuration above:
EXCEPTION: FATAL: Peer authentication failed for user "xyzxyz"
I would be waiting for the results of your testing, but I might be take a few days to respond as I will have limited access to Internet for a few days.
Good luck,
Ali
you hit the nail on the head with
•Are you sure the symbolic link for the plugin is created with the correct name. (The configuration file will only apply if the symlink name is identical to pgstats.)
I had used
ln -s /usr/share/munin/plugins/pgstats.py /etc/munin/plugins/
to create the symlink.
the correct command should be
ln -s /usr/share/munin/plugins/pgstats /etc/munin/plugins/
now when i run
munin-run -pidebug pgstats
EXCEPTION: column "tup_returned" does not exist
Traceback (most recent call last):
File "/etc/munin/plugins/pgstats", line 495, in ?
main()
File "/etc/munin/plugins/pgstats", line 491, in main
sys.exit(muninMain(MuninPgPlugin))
File "/usr/share/munin/plugins/pymunin/init.py", line 830, in muninMain
ret = plugin.run()
File "/usr/share/munin/plugins/pymunin/init.py", line 619, in run
ret = self.fetch()
File "/usr/share/munin/plugins/pymunin/init.py", line 596, in fetch
self.retrieveVals()
File "/etc/munin/plugins/pgstats", line 375, in retrieveVals
stats = self._dbconn.getDatabaseStats()
File "/usr/share/munin/plugins/pysysinfo/postgresql.py", line 218, in getDatabaseStats
cur.execute("SELECT %s, pg_database_size(datname) FROM pg_stat_database;"
psycopg2.ProgrammingError: column "tup_returned" does not exist
I think the tup_returned error is not with the plugin. Thanks for all your assistance.
Hi Michael,
The automated install procedure using "pip install" or by executing "setup.py" manually should have created plugin scripts without the .py extension in the first place. Are you installing the plugins manually?
The error message reporting that the column tup_returned does not exist seems to indicate that you are using a very old version of PostgreSQL. What version of PostgreSQL Database are you using?
The PostgreSQL rpms supplied by Red Hat are usually extremely outdated and the new versions of PostgreSQL bring significant improvements in performance, backup and recovery procedures. Newer stable versions of PostgreSQL are available for RHEL / CentOS:
http://www.postgresql.org/download/linux/
I would recommend you to use the latest stable version (9.1), but I would recommend you to check the Release Notes for potential compatibility problems and do some testing first. I have helped some clients migrate to PostgreSQL 9.0 and 9.1 and some minor fixes were required to some queries and stored procedures, but the improvements in disaster recovery procedures permitted by streaming replication were definitely worth it.
I would be waiting for you to confirm the database version, before closing the issue,
Thanks in advance,
Ali
Thanks for the suggestion. Our postgres is installed as part of OpenACD. We will look into the possibility of updating it.
Centos 5.8 psql (PostgreSQL) 8.1.23
Centos 6.2 psql (PostgreSQL) 8.4.9
We used yum install with the EPEL repo for the Centos 6.2 boxes but a manual install for 5.8 installs (hence the older version)
Hi Michael,
I actually consider any version older than 9.0 quite old. ;-) The streaming replication feature was introduced in 9.0, and I really liked it; and then in 9.1 you have the pg_basebackup for backups and synchronous replication.
I wouldn't expect OpenACD to have any compatibility problems with newer versions of PostgreSQL; free software projects are generally get a good level of testing with new software versions.
By the way it seems like you work with quite exciting technologies at PATlive, FreeSWITCH, OpenACD, SipX; sounds quite interesting.
I will be closing the issue for now, if you detect any other problem do not doubt to register a new issue and you have my personal e-mail if you need anything else.
Have a nice day,
Ali