forked from proche-rainmaker/phplicensewatcher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.html
265 lines (201 loc) · 9.81 KB
/
README.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<meta http-equiv="CONTENT-TYPE"
content="text/html; charset=iso-8859-15">
<title>phplicensewatcher</title>
<meta name="GENERATOR" content="OpenOffice.org 1.0 (Linux)">
<meta name="AUTHOR" content="Vladimir Vuksan">
<meta name="CREATED" content="20020802;9025900">
<meta name="CHANGEDBY" content="Vladimir Vuksan">
<meta name="CHANGED" content="20020918;15325300">
<style>
<!--
P { color: #000000 }
H2 { color: #000000 }
PRE { color: #000000 }
H3 { color: #000000 }
H4 { color: #000000 }
A:link { color: #0000ff }
A:visited { color: #ff0000 }
-->
</style>
</head>
<body text="#000000" link="#0000ff" vlink="#ff0000"
bgcolor="#ffffff">
<h2>License</h2>
<p>This program is licensed under the terms of GNU Public License. You can
read it at<br>
<br>
<a href="http://www.gnu.org/copyleft/gpl.html#SEC1">http://www.gnu.org/copyleft/gpl.html#SEC1</a>
<br>
<br>
or you can find a file LICENSE in this directory with a plain text copy of
it.</p>
<h2>Thanks</h2>
<p>This package would be impossible if it weren't for these software project</p>
<ul>
<li>
<p>PHP and PHP's PEAR classes - a marvelous scripting language (http:<a
href="../../../../../../">//www.php.net/</a>)</p>
</li>
<li>
<p>PHP-Diagram class - simple diagramming class (http://www.tuxxland.de/php/cdiagram)</p>
</li>
</ul>
<h2>What this program does:</h2>
<ul>
<li>
<p>Shows the health of a license server or a group of them</p>
</li>
<li>
<p>Check which licenses are being used and who is currently using them</p>
</li>
<li>
<p>Get a listing of licenses, their expiration days and number of days
to expiration</p>
</li>
<li>
<p>E-mail alert of licenses that will expire within certain time period
ie. within next 10 days.</p>
</li>
<li>
<p>Monitors server utilization</p>
</li>
</ul>
<h2>Warning:</h2>
<p>There is no warranty on this package. I wrote this scripts to help myself
keep tabs on my FlexLM servers. I am not a FlexLM developer and base my scripts
on using the publicly available commands such as lmstat, lmdiag so this may
not work for you. I do most of my testing using FlexLM server version 8.0d
under RedHat Linux.</p>
<p>Please do not run these scripts on a publicly available Internet server
because phplicensewatcher has not been audited to make sure it is secure.
It likely isn't. You have been warned.</p>
<h2>Limitations:</h2>
<p>Currently only FlexLM servers are supported but in the future a wider
array of license servers may be supported. A very basic LUM (License use mangagement) support was added on 2005-10-31. </p>
<p>Requirements:</p>
<ul>
<li>
<p style="margin-bottom: 0cm;">PHP enabled web server (most Linux distributions
come with Apache and PHP installed)</p>
</li>
<li>
<p style="margin-bottom: 0cm;">FlexLM lmstat/lmutil/lmdiag binaries
for the OS you are running the web server on. Latest FlexLM can be obtained
at <a
href="http://www.globetrotter.com/flexlm/lmgrd.shtml#unixdownload">http://www.globetrotter.com/flexlm/lmgrd.shtml#unixdownload</a></p>
<ul>
<p>You don't have to run this on the same machine that you are running
the web server on. My license server runs on Solaris and I use a Linux
box with Linux lmstat binary to query it remotely.</p>
</ul>
</li>
</ul>
<h2>Basic Install process</h2>
<p>I assume you already unpacked this archive to a directory ie. phplicensewatcher.
All you have to do now is modify the values in config.php. Config.php contains
comments on and then point your browser to <br>
<br>
http://your.host.com/phplicensewatcher/</p>
<p>or other location where you installed it. This will enable only basic
options such as displaying the list of features, current usage. If you need
options such as email alerts you have to follow the extended install process</p>
<h3>Webinterface for configuration:</h3>
There is also a Webinterface, point your browser to <tt>http://your.host.com/phplicensewatcher/config/</tt> to use it.
<h2>Extended Install process</h2>
<p>I consider all of the extended install options to be for Administrators
only. To access them please go to</p>
<p>http://your.host.com/phplicensewatcher/admin.php</p>
<h3><b>License Alerts e-mail</b></h3>
<p>This is probably the most important part of managing licenses :-). Being
notified when licenses are due to expire. E-mails come as HTML mail since
I wanted to use tables and colors.</p>
<h4>Installation</h4>
<p>The way I use it is to run license_alert.php report every night at 2 a.m.
This report will query all specified license servers and figure out which
licenses are due to expire. There are two ways to run license_alert.php script.
You can use PHP interpreter directly if you have it installed in on your
machine ie. RedHat distributes php interpreter as php-*.rpm packages. You
can then have one of the following entries in your crontab</p>
<pre style="margin-bottom: 0.5cm;">0 2 * * * php /var/www/html/phplicensewatcher/license_alert.php >> /dev/null</pre>
<p> The other way to invoke it is to use wget which is a web retrieval tool.
You can also use curl if you prefer that</p>
<pre style="margin-bottom: 0.5cm;">0 2 * * * wget -O - http://your.apachehost.com/phplicensewatcher/license_alert.php >> /dev/null</pre>
<h3> License utilization</h3>
<p>In order to evaluate license utilization at your site you need to start
collecting data usage statistics. PHPLicensewatcher does this by querying
the license server periodically and storing the data in a SQL database. For
example I have a cron job that queries the FlexLM server every 15 minutes.</p>
<p>In the config.php you would specify which keys you are interested in monitoring
and that is what will show up on the Utilization page.</p>
<p>Limitation: Generate graph has a number of different limitations which
I will document at some later date. One of the biggest ones is that the X-scale
is dependent on values being consecutive ie. it will start plotting values
from time 0 no matter when you started recording values so once you install
it it will appear that you started logging since midnight. You will have
“realistic” usage only after that day. Sorry.</p>
<h4>Installation</h4>
<p><b>DB setup</b></p>
<p>First you have to decide where you are going to store the database files.
I use mysql. To create my own database as mySQL administrator I entered</p>
<pre style="margin-bottom: 0.5cm;">mysqladmin create licenses</pre>
<p> Create a user or use an existing user and then as such execute something
along these lines</p>
<pre style="margin-bottom: 0.5cm;">mysql -f licenses < phplicensewatcher.sql</pre>
<p> This will create appropriate SQL. You should also create a database user
ie. Username=nobody password=nopasswd. To do that type</p>
<pre style="margin-bottom: 0.5cm;">mysql mysql<br>grant select,insert on licenses.* to nobody@”localhost” identified by 'nopasswd';</pre>
<p> Then edit config.php to suit your site.</p>
<p><b>Crontab setup</b></p>
<p>Last but not least is to set up data collection crontabs. There are two
scripts that need to be executed ie. license_util.php and license_cache.php.
</p>
<ul>
<li>
<p>License_util.php is used to get current license usage. It should
be run periodically throughout the day ie. every 15 minutes.</p>
</li>
<li>
<p>License_cache.php stores the total number of available licenses on
particular day. This script is necessary because you may have temporary
keys that may expire on a particular day and you want to capture that. It
should be run once a day preferably soon after the midnight after which
license server should invalidate all the expired keys.</p>
</li>
</ul>
<p>My crontab looks like this</p>
<pre style="margin-bottom: 0.5cm;">0,15,30,45 * * * * wget -O - http://your.apachehost.com/phplicensewatcher/license_util.php >> /dev/null<br>15 0 * * * wget -O - http://your.apachehost.com/phplicensewatcher/license_cache.php >> /dev/null</pre>
<h3> License denials / per user usage</h3>
<p>An important metric in evaluating your licenses is license denials ie.
how many people were denied access to a certain feature because we were out
of licenses. To do that we have to analyze FlexLM logs. FlexLM logs are enabled
during FlexLM start up. For example we start our FlexLM servers with following
options</p>
<pre style="margin-bottom: 0.5cm;">su nobody -c '/tools/lmgrd -l /usr/tmp/27000-at-licenserv -c /tools/license/license.dat'</pre>
<p>This will create /usr/tmp/27000-at-licenserv which will contain information
such as when the license has been checked out, when it was checked in plus
any time a license has been denied ie.</p>
<pre style="margin-bottom: 0.5cm;">16:01:20 (daemond) DENIED: "viewer" jack@server (Licensed number of users already reached (-4,342))</pre>
<p>We want to capture this information since a high number of denials would
indicate that we should consider getting additional licenses since a lot
of people are being denied access.</p>
<h4>Installation</h4>
<p>If you haven't set up databases for license utilization please follow
DB setup instructions under License utilization. Phplicensewatcher.sql creates
the table structure necessary for Denials as well.</p>
<p><b>Crontab setup</b></p>
<p>FlexLM logs can be very large so it may take a long time to analyze them.
I run the analysis scripts around 2 a.m. every morning. To run them put something
like this in your crontab</p>
<pre style="margin-bottom: 0.5cm;">0 2 * * * wget -O - http://your.apachehost.com/phplicensewatcher/parselog.php >> /dev/null</pre>
<p> You are done now.</p>
<h2>Questions, Comments, Accolades, Patches</h2>
<p>Please address any questions, comments or patches to<br>
<br>
Vladimir Vuksan <<a href="mailto:vuksan-php@veus.hr">vuksan-php@veus.hr</a>
><br>
</p>
</body>
</html>