Well, the concept is so simple, that of course there is no limit in language and database. You should modify paths and other credentials in code. This is just basic example how you could achieve such thing.

PHP file that will generete part of our smokeping config with Probes and Targets on server with database:

<?php

  // Connect to database
  if(!($GLOBALS["DBC"] = mysqli_connect("server",  "user_db",  "pass_db"))) die ("Cannot connect to database.");
  if(!((bool)mysqli_query($GLOBALS["DBC"], "USE $db"))) die ("Cannot choose database {$db}.");

  // Get devices to monitor
  $q = mysqli_query($GLOBALS["DBC"], "SELECT ID, IP, name 
                                      FROM devices;");

  $rows = mysqli_num_rows($q);

  // How many probes do we need? One for 100 devices
  $probes = floor($rows / 100) + 1;

  // Output
  $o = "";

  // Basic probes configuration - We will keep it with Targets in one file
  $o .= "*** Probes ***\n\n";

  // Be sure that you have fping installed and in right location
  $o .= "+ FPing\n";
  $o .= "binary = /usr/bin/fping\n\n";

  for($a = 0; $a < $probes; $a++)
  {

    $o .= "++FPing{$a}\n\n";

    $o .= "blazemode = true\n";
    $o .= "hostinterval = 1.5\n";
    $o .= "mininterval = 0.001\n";
    $o .= "offset = 50% \n";
    $o .= "packetsize = 56\n";
    $o .= "pings = 20\n";
    $o .= "step = 60\n";
    $o .= "timeout = 1.5\n";
    $o .= "tos = 0x20\n";
    $o .= "#usestdout = true\n\n";

  }

  // There goes our targets
  $o .= "*** Targets ***\n\n";

  $o .= "probe = FPing0\n\n";

  $o .= "menu = Top\n";
  $o .= "title = SmokePing\n";
  $o .= "remark = \n\n";

  $o .= "+ SMOKE\n";
  $o .= "menu = Hosts\n\n";

  // Let's count to determine probe number
  $a = 0;

  while($r = mysqli_fetch_assoc($q))
  {

    $probe = floor($a / 100);

    $o .= "++ ID{$r['ID']}\n\n";

    $o .= "probe = FPing{$probe}\n";
    $o .= "menu = {$r['name']}\n";
    $o .= "title = {$r['name']} (IP: {$r['IP']}, ID: {$r['ID']})\n";
    $o .= "host = {$r['IP']}\n\n";

    $a++;

  }

  echo $o;

Script to download configuration and restart smokeping if something changes:

#!/bin/bash

# Download file with our configuration
wget -q --no-check-certificate -O /etc/tricker/smoketricker.conf https://monitoring.tricker.cz/scripts/export/smokeping/ProbesTargets.php

# How large our file is? Do we have something?
velikost=$(wc -c "/etc/tricker/smoketricker.conf" | cut -f 1 -d ' ')

# Have sometnig? Continue
if [ $velikost -ge 500 ]; then

  # Checking if our files are the same, use correct paths!
  md5one=$(md5sum /etc/tricker/smoketricker.conf | cut -f 1 -d ' ')
  md5two=$(md5sum /opt/smokeping-2.6.11/etc/smoketricker.conf | cut -f 1 -d ' ')

  # Do we have something different? Reload smokeping.
  if [ $md5one != $md5two ]
  then

    # Again - Check paths! I used compiled smokeping with version in path
    cp /etc/tricker/smoketricker.conf /opt/smokeping-2.6.11/etc/smoketricker.conf
    kill -TERM $(cat /opt/smokeping-2.6.11/var/smokeping.pid)
    /opt/smokeping-2.6.11/bin/smokeping --config=/opt/smokeping-2.6.11/etc/config --logfile=/var/log/smoke.log

  fi

fi

CRON to periodically call smokepingUpdate.sh:

*/10 * * * * /home/tricker/smokepingUpdate.sh

In smokeping/etc/config you should remove section „Targets“ and „Probes“, because they are generated by script and add this line at the end of file to start loading our config:

@include smoketricker.conf

I use this to start Smokeping:

/opt/smokeping-2.6.11/bin/smokeping --config=/opt/smokeping-2.6.11/etc/config --logfile=/var/log/smoke.log

That’s all! Just one more tip – For those who need (just as I) to show graphs in remote system and you can’t (or just simply want) generate all graphs static (Smokeping can do that for you, possible SSD killer)… Generate graphs by calling something like this before showing them:

<?php

  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, $n['smokeping_url']."smokeping.cgi?target=SMOKE.ID".intval($_GET['id']));
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  $r = curl_exec($ch);
  $e = curl_error($ch);
  curl_close($ch);