Monthly reports with REST (timeout)

Hi all,
I’ve been generating monthly reports with a crontab script that
includes a line like this:
/opt/rt3/bin/rt list “created >= ‘2012-04-01’ AND status != 'rejected’
AND Queue = ‘whatever’ AND (owner = ‘user1’ OR owner = ‘user2’)” |
grep -v “No matching results.” | wc -l
As you can see, I’m only interested in the total number of tickets.
I’ve find out that with a large number of possible results, I get a
timeout so 0 tickets are returned.

However, using the web search, because of the paginated displays, the
search is much faster and also the web shows how many items are in the
whole list with a line “Found: xxx tickets”.

My intention is still using an automated way to obtain the numbers.
I’ve been reading the REST documentation and there is no way to query
only for totals.

Any ideas?

Ignacio.

Just a bet, but try to use “-t ticket” on search.

-----Mensagem original-----De: rt-users-bounces@lists.bestpractical.com [mailto:rt-users-bounces@lists.bestpractical.com] Em nome de Ignacio Vazquez
Enviada em: quarta-feira, 31 de outubro de 2012 09:26
Para: rt-users@lists.bestpractical.com
Assunto: [rt-users] Monthly reports with REST (timeout)

Hi all,
I’ve been generating monthly reports with a crontab script that includes a line like this:
/opt/rt3/bin/rt list “created >= ‘2012-04-01’ AND status != ‘rejected’
AND Queue = ‘whatever’ AND (owner = ‘user1’ OR owner = ‘user2’)” | grep -v “No matching results.” | wc -l As you can see, I’m only interested in the total number of tickets.
I’ve find out that with a large number of possible results, I get a timeout so 0 tickets are returned.

However, using the web search, because of the paginated displays, the search is much faster and also the web shows how many items are in the whole list with a line “Found: xxx tickets”.

My intention is still using an automated way to obtain the numbers.
I’ve been reading the REST documentation and there is no way to query only for totals.

Any ideas?

Ignacio.
We’re hiring! http://bestpractical.com/jobs

First of all, excuse me, there has been a misunderstanding, I’m
talking about the CLI, nor the REST interface but the question is
still valid.
Diaulas, “-t ticket” is the default:
/opt/rt3/bin/rt help list

-t type Specifies the type of object to look for. (The
default is “ticket”.)2012/10/31 Diaulas Castro diaulas.castro@intersolution.inf.br:

Just a bet, but try to use “-t ticket” on search.

-----Mensagem original-----
De: rt-users-bounces@lists.bestpractical.com [mailto:rt-users-bounces@lists.bestpractical.com] Em nome de Ignacio Vazquez
Enviada em: quarta-feira, 31 de outubro de 2012 09:26
Para: rt-users@lists.bestpractical.com
Assunto: [rt-users] Monthly reports with REST (timeout)

Hi all,
I’ve been generating monthly reports with a crontab script that includes a line like this:
/opt/rt3/bin/rt list “created >= ‘2012-04-01’ AND status != ‘rejected’
AND Queue = ‘whatever’ AND (owner = ‘user1’ OR owner = ‘user2’)” | grep -v “No matching results.” | wc -l As you can see, I’m only interested in the total number of tickets.
I’ve find out that with a large number of possible results, I get a timeout so 0 tickets are returned.

However, using the web search, because of the paginated displays, the search is much faster and also the web shows how many items are in the whole list with a line “Found: xxx tickets”.

My intention is still using an automated way to obtain the numbers.
I’ve been reading the REST documentation and there is no way to query only for totals.

Any ideas?

Ignacio.

We’re hiring! http://bestpractical.com/jobs

My solution:
save a session cookie using wget like is explained in
http://requesttracker.wikia.com/wiki/REST:

wget  --keep-session-cookies \
 --save-cookies cookies.txt \
 --post-data 'user=UUUU&pass=PPPP' \
 http://my.rt.server

The cookie is saved under "cookies.txt"

Build the desired Search in the web and click on “Show results”.
Copy the entire URL and paste in the file “url.txt” (this is for
avoiding problems with escaping characters in further wget usage).
Execute:
# wget -qO - --no-check-certificate --load-cookies cookies.txt -i
url.txt |grep -m 1 Found
Found 25,545 tickets

So, all we need to do now is a script that modifies the date with the
desired date in the url file and send the results via email.

Ignacio.2012/11/2 Ignacio Vazquez ivazquez@desdelaconsola.es:

First of all, excuse me, there has been a misunderstanding, I’m
talking about the CLI, nor the REST interface but the question is
still valid.
Diaulas, “-t ticket” is the default:
/opt/rt3/bin/rt help list

-t type Specifies the type of object to look for. (The
default is “ticket”.)

2012/10/31 Diaulas Castro diaulas.castro@intersolution.inf.br:

Just a bet, but try to use “-t ticket” on search.

-----Mensagem original-----
De: rt-users-bounces@lists.bestpractical.com [mailto:rt-users-bounces@lists.bestpractical.com] Em nome de Ignacio Vazquez
Enviada em: quarta-feira, 31 de outubro de 2012 09:26
Para: rt-users@lists.bestpractical.com
Assunto: [rt-users] Monthly reports with REST (timeout)

Hi all,
I’ve been generating monthly reports with a crontab script that includes a line like this:
/opt/rt3/bin/rt list “created >= ‘2012-04-01’ AND status != ‘rejected’
AND Queue = ‘whatever’ AND (owner = ‘user1’ OR owner = ‘user2’)” | grep -v “No matching results.” | wc -l As you can see, I’m only interested in the total number of tickets.
I’ve find out that with a large number of possible results, I get a timeout so 0 tickets are returned.

However, using the web search, because of the paginated displays, the search is much faster and also the web shows how many items are in the whole list with a line “Found: xxx tickets”.

My intention is still using an automated way to obtain the numbers.
I’ve been reading the REST documentation and there is no way to query only for totals.

Any ideas?

Ignacio.

We’re hiring! http://bestpractical.com/jobs

How many tickets are in the set? Your options are to use API instead of
rest or implement count command in rt cli and rt server side.

Ruslan from phone.

написал: