PostgreSQL loadable plugin
Source
xxxxxxxxxx
** See the License for the specific language governing permissions and
** limitations under the License.
**/
package plugin
import (
"context"
"errors"
"git.zabbix.com/ap/plugin-support/zbxerr"
"github.com/jackc/pgx/v4"
"golang.zabbix.com/sdk/zbxerr"
)
// bgwriterHandler executes select with statistics from pg_stat_bgwriter
// and returns JSON if all is OK or nil otherwise.
func bgwriterHandler(ctx context.Context, conn PostgresClient,
_ string, _ map[string]string, _ ...string) (interface{}, error) {
var bgwriterJSON string
query := `
SELECT row_to_json (T)