1 /*----------------------------------------------------------------------------*/
2 /* Xymon RRD handler module. */
3 /* */
4 /* Copyright (C) 2004-2011 Henrik Storner <henrik@hswn.dk> */
5 /* */
6 /* This program is released under the GNU General Public License (GPL), */
7 /* version 2. See the file "COPYING" for details. */
8 /* */
9 /*----------------------------------------------------------------------------*/
10
11 static char citrix_rcsid[] = "$Id: do_citrix.c 7026 2012-07-13 14:05:20Z storner $";
12
do_citrix_rrd(char * hostname,char * testname,char * classname,char * pagepaths,char * msg,time_t tstamp)13 int do_citrix_rrd(char *hostname, char *testname, char *classname, char *pagepaths, char *msg, time_t tstamp)
14 {
15 static char *citrix_params[] = { "DS:users:GAUGE:600:0:U", NULL };
16 static void *citrix_tpl = NULL;
17
18 char *p;
19 int users;
20
21 if (citrix_tpl == NULL) citrix_tpl = setup_template(citrix_params);
22
23 p = strstr(msg, " users active\n");
24 while (p && (p > msg) && (*p != '\n')) p--;
25 if (p && (sscanf(p+1, "\n%d users active\n", &users) == 1)) {
26 setupfn("%s.rrd", "citrix");
27 snprintf(rrdvalues, sizeof(rrdvalues), "%d:%d", (int)tstamp, users);
28 return create_and_update_rrd(hostname, testname, classname, pagepaths, citrix_params, citrix_tpl);
29 }
30
31 return 0;
32 }
33
34