pgsnmpd is an SNMP agent that can return hierarchical information about the current state of Advanced Server on a Linux system.
pgsnmpd is distributed with and installed by the Advanced Server installer as part of the database server component. The
pgsnmpd agent can operate as a stand-alone SNMP agent, as a pass-through sub-agent, or as an AgentX sub-agent.
After installing Advanced Server, you will need to update the
LD_LIBRARY_PATH variable. Use the command:
This command does not persistently alter the value of
LD_LIBRARY_PATH. Consult the documentation for your distribution of Linux for information about persistently setting the value of
The examples that follow demonstrate the simplest usage of
pgsnmpd, implementing read only access.
pgsnmpd is based on the net-snmp library; for more information about net-snmp, visit:
pgsnmpd configuration file is named
snmpd.conf. For information about the directives that you can specify in the configuration file, please review the
snmpd.conf man page (
You can create the configuration file by hand, or you can use the
snmpconf perl script to create the configuration file. The perl script is distributed with net-snmp package.
net-snmp is an open-source package available from:
To use the snmpconf configuration file wizard, download and install net-snmp. When the installation completes, open a command line and enter:
When the configuration file wizard opens, it may prompt you to read in an existing configuration file. Enter
none to generate a new configuration file (not based on a previously existing configuration file).
snmpconf is a menu-driven wizard. Select menu item
1: snmpd.conf to start the configuration wizard. As you select each top-level menu option displayed by
snmpconf, the wizard walks through a series of questions, prompting you for information required to build the configuration file. When you have provided information in each of the category relevant to your system, enter
Finished to generate a configuration file named
snmpd.conf. Copy the file to:
Setting the Listener Address
pgsnmpd listens on port
161. If the listener port is already being used by another service, you may receive the following error:
You can specify an alternate listener port by adding the following line to your
The example instructs
pgsnmpd to listen on UDP port
$host_address is the IP address of the server (e.g.,
Ensure that an instance of Advanced Server is up and running (
pgsnmpd will connect to this server). Open a command line and assume superuser privileges, before invoking pgsnmpd with a command that takes the following form:
POSTGRES_INSTALL_HOME specifies the Advanced Server installation directory.
-b option to specify that
pgsnmpd should run in the background.
-c option, specifying the path and name of the
pgsnmpd configuration file.
Include connection information for your installation of Advanced Server (in the form of a
libpq connection string) after the
Viewing pgsnmpd Help
--help option when invoking the
pgsnmpd utility to view other
pgsnmpd command line options:
Requesting Information from pgsnmpd
You can use
net-snmp commands to query the
pgsnmpd service. For example:
In the above example:
-v 2c option instructs the
snmpgetnext client to send the request in SNMP version 2c format.
-c public specifies the community name.
localhost indicates the host machine running the
.126.96.36.199.4.1.54188.8.131.52.1.1.0 is the identity of the requested object. To see a list of all databases, increment the last digit by one (e.g. .1.1, .1.2, .1.3 etc.).
The encodings required to query any given object are defined in the MIB (Management Information Base). An SNMP client can monitor a variety of servers; the server type determines the information exposed by a given server. Each SNMP server describes the exposed data in the form of a MIB (Management information base). By default, pgsnmpd searches for MIB's in the following locations: