<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi Peter;<br>
<br>
There's no way 'out-of-the-box' to accomplish what you want, as far as
I know, but it wouldn't be terribly difficult to roll your own solution.<br>
<br>
There are a few approaches that come to mind, depending on the volume
of traffic you expect your site to get, since the simpler solution can
run into concurrency problems. All of them, however, involve
re-writing config files on the fly. With a decent scripting language
(my choice here would be Perl, YMMV), this is /very/ straightforward. <br>
<br>
I would recommend keeping a 'master' config file with e.g. your probe
and alert configurations, and then have one file as an 'include', which
gets rewritten on-the-fly, as below.<br>
<br>
The general 'lifecycle' of a simple solution would be something like:<br>
1) Accept new IPs as input.<br>
2) Append new 'host' entry in your config file; use a
specially-formatted comment line to indicate expiration time.<br>
3) Restart SmokePing daemon.<br>
4) In a separate scheduled process (say, once every 4 hours), scan the
config file for expired entries and remove them.<br>
4a) While removing the entries, remove the .rrd files at the same time.<br>
<br>
With a little forward-thinking, step (4) is trivial. If you were to
format your file (and each host in the file) in a specific manner (as
it would have to be, being machine-generated), something like:<br>
<br>
###BEGINHOST {insert_expiry_time_here} ###<br>
+smokepinghostname<br>
host = xx.xx.xx.xx<br>
menu = Foo<br>
title = Foo (xx.xx.xx.xx)<br>
<br>
then it becomes trivial to remove expired entries... as you're reading
each line of the file, check to see if the line matches the regex
/^###BEGINHOST/, parse out the expiry time and compare it to the
current time. If it has indeed expired, skip all lines of input until
/^###BEGINHOST/ matches again. If it hasn't expired, then read those
lines and just re-output them into the new config file.<br>
<br>
The above solution can run into concurrency problems if your site is
very busy, since you may end up with multiple processes trying to write
to the file at the same time.<br>
<br>
A slightly more advanced solution would follow a workflow something
like:<br>
1) Accept new IP as input.<br>
2) Enter new IP request into submission queue (e.g. an RDBMS).
Timestamp entries for submission and/or expiration times.<br>
3) Periodically (say, every 5 minutes), run a script that reads the
database, deletes (or disables) expired entries, and re-creates the
config file with the non-expired entries.<br>
3a) Stop SmokePing.<br>
3a) Delete .rrd files for expired hosts.<br>
3c) Start SmokePing.<br>
<br>
This solution has many, many advantages -- for example, no need to
write metadata (e.g. expiry time) into the config file, since it's all
in the database. Also, the use of a database is MUCH more web-friendly
in terms of your PHP/CGI/etc scripts. You also won't run into
concurrency problems since there's only a single process writing to the
file (the multiple-writes are moved to the RDMBS system, which is
designed for that).<br>
<br>
There are more tricks you could play to increase efficiency for a very
large system (e.g. 256 include files, with entries sorted based on the
mask 0.0.0.255 (NOT 255.0.0.0 since distribution on that set is heavily
biased)... you would only have to update changed files between cycles.
On very very large data sets, it could provide a performance boost
during the update cycle by allowing parallelism and not updating
unchanged data. I somehow get the feeling that this isn't the case for
you, however.<br>
<br>
There are many, many ways to implement the actual coding of all this,
depending on your environment, available scripting or programming
languages, and any defined requirements for the system. However, if
you use a reasonable language (Perl! :), it's actually very, very
straight-forward.<br>
<br>
Hope that helps!<br>
- Peter<br>
<br>
<br>
peter Mistich wrote:
<blockquote
cite="mid:1f7c31c00708091122s71d17774nc611d1eb1260a36@mail.gmail.com"
type="cite">Hello all,<br>
<br>
I'm new to smoke ping and have been trying to recreate the smokeping on
dslreports so you can enter a ip address and it auto adds it to the
smokeping config and runs it for one day.<br>
<br>
I have made several attempts but have failed. the issue I keep running
into is the config file you cannot include a directory of config files
just the config files itself.
<br>
<br>
if it would allow me to read a directory of configs I could write a
seprate config for each ip and then reload smokeping.<br>
<br>
one note I'd like to be able to do this with out modfying smokeping its
self so that in futher updates I do not have to modfiy each version.
<br>
<br>
any suggestions,<br>
Pete<br>
<pre wrap="">
<hr size="4" width="90%">
_______________________________________________
smokeping-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:smokeping-users@lists.oetiker.ch">smokeping-users@lists.oetiker.ch</a>
<a class="moz-txt-link-freetext" href="https://lists.oetiker.ch/cgi-bin/listinfo/smokeping-users">https://lists.oetiker.ch/cgi-bin/listinfo/smokeping-users</a>
</pre>
</blockquote>
</body>
</html>