]> git.openstreetmap.org Git - nominatim.git/blob - munin/nominatim_requests
make .osc files with osmosis
[nominatim.git] / munin / nominatim_requests
1 #!/bin/sh
2 #
3 # Plugin to monitor the types of requsts made to the API
4 #
5 # Parameters: 
6 #
7 #       config   (required)
8 #       autoconf (optional - used by munin-config)
9 #
10  
11 if [ "$1" = "config" ]; then
12  
13         echo 'graph_title Requests by API call' 
14         echo 'graph_args --base 1000 -l 0'
15         echo 'graph_vlabel requests per minute'
16         echo 'graph_category nominatim'
17         echo 'z1.label reverse'
18         echo 'z1.draw AREA'
19         echo 'z1.type GAUGE'
20         echo 'z2.label search (successful)'
21         echo 'z2.draw STACK'
22         echo 'z2.type GAUGE'
23         echo 'z3.label search (no result)'
24         echo 'z3.draw STACK'
25         echo 'z3.type GAUGE'
26         echo 'z4.label details'
27         echo 'z4.draw STACK'
28         echo 'z4.type GAUGE'
29         exit 0
30 fi
31  
32
33 query="select count(*)/5.0 from new_query_log where starttime > (now() - interval '5 min') and "
34
35 reverse=`psql -d nominatim -c "copy ($query type='reverse') to stdout"`
36 searchy=`psql -d nominatim -c "copy ($query type='search' and results>0) to stdout"`
37 searchn=`psql -d nominatim -c "copy ($query type='search' and results=0) to stdout"`
38 details=`psql -d nominatim -c "copy ($query type='details') to stdout"`
39  
40 echo "z1.value $reverse"
41 echo "z2.value $searchy"
42 echo "z3.value $searchn"
43 echo "z4.value $details"