plugin-coldfusion-queued: coldfusion_queued

File coldfusion_queued, 2.1 kB (added by jemtallon@yahoo.com, 6 years ago)

Coldfusion plugin to monitor queued requests

Line 
1 #!/usr/bin/perl
2 #
3 # Plugin to monitor the number of Coldfusion queued requests running on the machine
4 #
5 # By Jem Tallon
6 #
7 #
8 # Requirements:
9 #       - Needs access to the cfstat utility (definable in the munin-node file)
10 #
11 #
12 # Tip: To see if it's already set up correctly, just run this plugin
13 # with the parameter "autoconf". If you get a "yes", everything should
14 # work like a charm already.
15 #
16 # Parameters supported:
17 #
18 #       config
19 #       autoconf
20 #
21 # Configurable variables
22 #
23 #       cfdir    - The full path to the Coldfusion directory (default: /opt/coldfusionmx7)
24 #
25 #
26 # To configure, edit /etc/munin/plugin-conf.d/munin-node to include the following lines
27 #
28 #       [coldfusion*]
29 #           env.cfdir /opt/coldfusionmx7
30 #
31 #
32 #
33 # Magic markers:
34 #%# family=auto
35 #%# capabilities=autoconf
36
37 use strict;
38
39 ## Make the local variables either from the environment or from defaults
40 my $CFDIR = exists $ENV{'cfdir'} ? $ENV{'cfdir'} : "/opt/coldfusionmx7";
41 my $CFBIN = "$CFDIR/bin";
42 my $CFSTAT = "$CFBIN/cfstat";
43
44 ## If an "autoconf" argument was supplied, check to see if cfstat exists and report the results
45 if ( exists $ARGV[0] and $ARGV[0] eq "autoconf" )
46 {
47         if( -e "$CFSTAT" )
48         {
49                 print "yes\n";
50                 exit 0;
51         }
52         else
53         {
54                 print "no (cfstat not found)\n";
55                 exit 1;
56         }
57 }
58
59 ## If a "config" argument was supplied, show the config stuff and exit
60 if ( exists $ARGV[0] and $ARGV[0] eq "config" )
61 {
62         print "graph_title Coldfusion queued requests\n";
63         print "graph_args -l 0 --upper-limit 1000\n";
64         print "graph_category coldfusion\n";
65         print "graph_vlabel queued requests\n";
66         print "graph_period second\n";
67         print "graph_info This graph shows the queued requests running in Coldfusion\n";
68         print "coldfusion.label Queued requests\n";
69         print "coldfusion.min 0\n";
70         print "coldfusion.max 500\n";
71         exit 0;
72 }
73
74 ## I know this is a mess but it was the easiest way for me to do it. If anyone can improve on it, please do
75 my $cfstatresult = `cd $CFBIN; $CFSTAT|sed -e 's/#.*//;/^\$/d'|sed -e 's/  */ /g'|tail -1`;
76 my $requests = `echo "$cfstatresult" | cut -d" " -f7` + 0;
77
78 print "coldfusion.value $requests\n";