]> git.openstreetmap.org Git - nominatim.git/blob - munin/nominatim_requests
Merge pull request #3367 from lonvia/address-word-counts
[nominatim.git] / munin / nominatim_requests
1 #!/bin/sh
2 #
3 # Plugin to monitor the types of requests made to the API
4 #
5 # Can be configured through libpq environment variables, for example
6 # PGUSER, PGDATABASE, etc. See man page of psql for more information.
7 #
8 # Parameters: 
9 #
10 #       config   (required)
11 #       autoconf (optional - used by munin-config)
12 #
13  
14 if [ "$1" = "config" ]; then
15  
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'
21         echo 'z1.draw AREA'
22         echo 'z1.type GAUGE'
23         echo 'z2.label search (successful)'
24         echo 'z2.draw STACK'
25         echo 'z2.type GAUGE'
26         echo 'z3.label search (no result)'
27         echo 'z3.draw STACK'
28         echo 'z3.type GAUGE'
29         echo 'z4.label details'
30         echo 'z4.draw STACK'
31         echo 'z4.type GAUGE'
32         exit 0
33 fi
34  
35
36 query="select count(*)/5.0 from new_query_log where starttime > (now() - interval '5 min') and "
37
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"`
42  
43 echo "z1.value $reverse"
44 echo "z2.value $searchy"
45 echo "z3.value $searchn"
46 echo "z4.value $details"