= QCG-Notification maintenance = Sometimes, in case of wrong configuration or rather wrongly tuned configuration for a certain scenario, it may be required to clean the notification data stored in the service. There are a number of possible ways of cleaning, but we will discuss only a few of them. == Flashing the database == If notification data is not critical, the most strightforward option may be to completly flash the database. In such a case, you should follow the following steps: 1. Turn off the service {{{ #!div style="font-size: 90%" {{{#!sh /sbin/service qcg-ntfd stop }}} }}} 2. Invoke the following command: {{{ #!div style="font-size: 90%" {{{#!sh psql -h localhost -d qcg-ntf -u qcg-ntf -a -f /usr/share/qcg-ntf/tools/qcg-ntf-psql.sql }}} }}} If you encounter the problem 'psql:/usr/share/qcg-ntf/tools/qcg-ntf-psql.sql:27: ERROR: syntax error at or near "EXISTS" at character 15', you should edit the script and remove all occurrences 'IF EXISTS' (this construction is not supported in older versions of PostreSQL). 3. Start the service again {{{ #!div style="font-size: 90%" {{{#!sh /sbin/service qcg-ntfd start }}} }}} == Removing selected objects == In some scenarios it may be abandoned to flash entire notification data. In such cases, you can selectively remove particullar objects. You may follow two directions: removeing objects 'online' using the QCG-Notification command line client or removeing object 'offline' in a database. Below we present these two options with the example of removeing all pullpoints (with different scripts you can even delete individual pullpoints). === Removing objects 'online' === The following command will remove all pullpoints when the service is running: {{{ #!div style="font-size: 90%" {{{#!sh for i in `qcg-ntf-client -u http://grass1.man.poznan.pl:19001 -2 "" | awk -F "'" '/address/ {print $2}'`; do qcg-ntf-client -u $i -T "" ; done }}} }}} === Removing objects 'offline' === In the offline mode, you can use psql client, e.g.: {{{ #!div style="font-size: 90%" {{{#!sh psql -h localhost qcg-ntf qcg-ntf -h localhost delete from pullpoints ; }}} }}} Note that removeing objects by the commandline client may implicate indirect delete on many database tables. It must be taken into account when using psql. For example, when we want to delete pullpoints and we know that the all pulpoints are created only by nagios tests, we should remove (carefully) also data from corresponding tables: {{{ #!div style="font-size: 90%" {{{#!sh delete from pullpoints ; #delete all pullpoints, we assume we CAN do this delete from subscriptions where consumeraddr LIKE '%ppID%' # delete subscriptions that contains ppID in the consumer reference. delete from notifications_buffer where msg LIKE '%nagios_test% # delete notifications that can be buffered }}} }}}