
[[logstash-geoip-database-management-metrics]]
==== Database Metrics

You can monitor the managed database's status through the <<node-stats-api,Node Stats API>>.

The following request returns a JSON document containing database manager stats,
including:

* database status and freshness
** `geoip_download_manager.database.*.status`
*** `init` : initial CC database status
*** `up_to_date` : using up-to-date EULA database
*** `to_be_expired` : 25 days without calling service
*** `expired` : 30 days without calling service
** `fail_check_in_days` : number of days Logstash fails to call service since the last success
* info about download successes and failures
** `geoip_download_manager.download_stats.successes` number of successful checks and downloads
** `geoip_download_manager.download_stats.failures` number of failed check or download
** `geoip_download_manager.download_stats.status`
*** `updating` : check and download at the moment
*** `succeeded` : last download succeed
*** `failed` : last download failed

[source,js]
--------------------------------------------------
curl -XGET 'localhost:9600/_node/stats/geoip_download_manager?pretty'
--------------------------------------------------

Example response:

[source,js]
--------------------------------------------------
{
  "geoip_download_manager" : {
    "database" : {
      "ASN" : {
        "status" : "up_to_date",
        "fail_check_in_days" : 0,
        "last_updated_at": "2021-06-21T16:06:54+02:00"
      },
      "City" : {
        "status" : "up_to_date",
        "fail_check_in_days" : 0,
        "last_updated_at": "2021-06-21T16:06:54+02:00"
      }
    },
    "download_stats" : {
      "successes" : 15,
      "failures" : 1,
      "last_checked_at" : "2021-06-21T16:07:03+02:00",
      "status" : "succeeded"
    }
  }
}
--------------------------------------------------
