OPMDG / check_pgactivity

Nagios remote agent
http://opm.readthedocs.io/probes/check_pgactivity.html
PostgreSQL License
175 stars 51 forks source link

hit_ratio : "uninitialized value $ratio" when a database has no activity, and there are threshholds #160

Closed Krysztophe closed 6 years ago

Krysztophe commented 6 years ago

On a new database, or a database on a slave with no activity, pg_database.blk_hit/read are zero, $ratio is not defined, and it fails when compared with a threshold:

$ /opt/check_pgactivity/check_pgactivity --service hit_ratio --dbservice nagios_pignouf_piaf  --status-file /tmp/check_pgactivity.pignouf.piaf -w 50% -c 20% --debug
...DEBUG: Query result: $VAR1 = [
          [
            'honk2',
            '0',
            '0'
          ],
          [
            'postgres',
            '132495',
            '229'
          ]
        ];

Use of uninitialized value $ratio in numeric lt (<) at /opt/check_pgactivity/check_pgactivity line 3553.
Use of uninitialized value $ratio in sprintf at /opt/check_pgactivity/check_pgactivity line 3554.
frost242 commented 6 years ago

Seems I forgot to close this issue. PR is merged, thanks !