3 # Plugin to monitor the types of requests made to the API
 
   5 # Can be configured through libpq environment variables, for example
 
   6 # PGUSER, PGDATABASE, etc. See man page of psql for more information.
 
  11 #       autoconf (optional - used by munin-config)
 
  14 if [ "$1" = "config" ]; then
 
  16         echo 'graph_title Requests by API call' 
 
  17         echo 'graph_args --base 1000 -l 0'
 
  18         echo 'graph_vlabel requests per minute'
 
  19         echo 'graph_category nominatim'
 
  20         echo 'z1.label reverse'
 
  23         echo 'z2.label search (successful)'
 
  26         echo 'z3.label search (no result)'
 
  29         echo 'z4.label details'
 
  36 query="select count(*)/5.0 from new_query_log where starttime > (now() - interval '5 min') and "
 
  38 reverse=`psql -c "copy ($query type='reverse') to stdout"`
 
  39 searchy=`psql -c "copy ($query type='search' and results>0) to stdout"`
 
  40 searchn=`psql -c "copy ($query type='search' and results=0) to stdout"`
 
  41 details=`psql -c "copy ($query type='details') to stdout"`
 
  43 echo "z1.value $reverse"
 
  44 echo "z2.value $searchy"
 
  45 echo "z3.value $searchn"
 
  46 echo "z4.value $details"