For postgres backup monitoring I wrote a little script that gets the info for the last backup of all defined backups:
this gives output similar to:
(I removed most items trying to make this a bit shorter)
How can I use this data in a discovery rule to generate items like {#NAME}.type ?
How can I use this same data to fetch the value for "type" for all listed databases?
Should I change the output of the script to make it [easier] usable?
My idea is to collect this raw data in a text item and have the discovery rule and the generated items dependents of the raw data text item.
I am currently on v-5LTS.
I hope for some nice hints on this, thanks in advance.
Code:
#!/usr/bin/env bash
pgbackrest info --output json |
jq 'map([.backup[] + {name}]
| max_by(.timestamp.stop))'
'
Code:
[{
"timestamp": {
"start": 1642144388,
"stop": 1642144392
},
"type": "full",
"name": "db1"
},
{
"timestamp": {
"start": 1642144392,
"stop": 1642144394
},
"type": "incr",
"name": "db2"
}]
How can I use this data in a discovery rule to generate items like {#NAME}.type ?
How can I use this same data to fetch the value for "type" for all listed databases?
Should I change the output of the script to make it [easier] usable?
My idea is to collect this raw data in a text item and have the discovery rule and the generated items dependents of the raw data text item.
I am currently on v-5LTS.
I hope for some nice hints on this, thanks in advance.
Comment