diff --git a/CHANGELOG.md b/CHANGELOG.md index 71e66c5..8bd44cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ All notable changes to this plugin are recorded here. The format follows [Keep a - Graphs made from earlier templates are brought to the installed ones by the main poller, 200 per cycle, or all at once with `cli/smokeping.php upgrade-graphs`. Each keeps its title and upper limit (#81). - The SmokePing targets page shows whether each target's device is in a Maint maintenance window, from Maint's `is_device_in_maintenance` hook (#31). - The health page lists targets that alert in both SmokePing and Thold, where one problem may notify twice. The inventory now records each target's SmokePing `alerts`; schema 6 stores them (#32). -- Smoke graph templates with SmokePing 2.7's loss colors, which match 2.7.3's graphs (Ubuntu 22.04). The Loss Colors setting picks them; Automatic, the default, follows the SmokePing version the reader finds in `Smokeping.pm`, which schema 7 records. The main poller moves smoke graphs to the configured colors, 200 per cycle, and `upgrade-graphs` moves them all. The health page shows the colors in use and why (#34). +- Smoke graph templates with SmokePing 2.7's loss colors, which match 2.7.3's graphs (Ubuntu 22.04). The Loss Colors setting picks them; Automatic, the default, follows the SmokePing version the reader finds in `Smokeping.pm`, which schema 7 records. The main poller moves smoke graphs to the configured colors, 200 per cycle, and `upgrade-graphs` moves them all. The health page shows the colors in use and why, and how many graphs are still to move or failed to move (#34). ### Changed diff --git a/docs/operations.md b/docs/operations.md index 45f267e..b618f28 100644 --- a/docs/operations.md +++ b/docs/operations.md @@ -42,7 +42,7 @@ The loss column reads `lost/pings` of the last round, and the median is in milli | `visibility` | The files the inventory lists are visible through the mount | Warning, naming how many are missing | | `templates` | The SmokePing templates are imported | Error with the cause; fix it and use **Retry Template Import** | | `device_pollers` | Every device with summary data sources is polled by the reader's poller | Error naming the devices: their summary values and alerts have no data until they are polled by that poller | -| `loss_colors` | Which loss colors the Loss Colors setting selects: those of the SmokePing the reader found, or the ones it names. After a change the main poller moves existing graphs over the next cycles, 200 per cycle; `upgrade-graphs` moves them at once | Unknown when the reader found no SmokePing version and the setting is Automatic: the graphs use 2.8 and later colors. Warning when the setting differs from the version found. See [loss colors](provisioning.md#loss-colors) | +| `loss_colors` | Which loss colors the Loss Colors setting selects: those of the SmokePing the reader found, or the ones it names. After a change the main poller moves existing graphs over the next cycles, 200 per cycle; `upgrade-graphs` moves them at once. The row counts the graphs still on the other colors, and warns about those whose move failed | Unknown when the reader found no SmokePing version and the setting is Automatic: the graphs use 2.8 and later colors. Warning when the setting differs from the version found. See [loss colors](provisioning.md#loss-colors) | | `dual_alerting` | No target has both a SmokePing `alerts` value and an enabled Thold threshold on its summary data source | Warning naming up to 10 targets: a problem that meets both alerts' conditions notifies twice. The check does not compare the conditions; a Thold `age` threshold, for example, can fire when no SmokePing loss alert does. Compare them before removing the target's SmokePing alert or disabling its threshold. OK when Thold is not installed | ## Typical situations diff --git a/lib/CactiObjectRepository.php b/lib/CactiObjectRepository.php index a234a6d..b99566b 100644 --- a/lib/CactiObjectRepository.php +++ b/lib/CactiObjectRepository.php @@ -114,6 +114,38 @@ public function summaryDevicesOffPoller(int $pollerId): array { return array_values(array_map(fn (array $row) => Row::string($row, 'description'), $rows)); } + /** + * How many live or archived smoke graphs are still on the templates of + * the loss colors other than $selected, split into those the main poller + * has yet to move and those whose last template change failed + * (template_failed), for the health page. + * + * @return array{pending: int, failed: int} + */ + public function graphsOnOtherLossColors(LossColors $selected): array { + $templateIds = []; + + foreach (TemplateInstaller::PINGS as $pings) { + $id = $this->graphTemplateId(TemplateInstaller::graphTemplateName($pings, $selected->other())); + + if ($id > 0) { + $templateIds[] = $id; + } + } + + if ($templateIds === []) { + return ['pending' => 0, 'failed' => 0]; + } + + $row = db_fetch_row_prepared('SELECT SUM(o.template_failed = 0) AS pending, SUM(o.template_failed > 0) AS failed + FROM plugin_smokeping_object AS o + INNER JOIN graph_local AS gl ON gl.id = o.local_graph_id + WHERE gl.graph_template_id IN (' . implode(', ', array_fill(0, count($templateIds), '?')) . ') + AND o.state IN (?, ?)', array_merge($templateIds, [ObjectRepository::ACTIVE, ObjectRepository::ARCHIVED]), true, $this->connection); + + return ['pending' => (int) ($row['pending'] ?? 0), 'failed' => (int) ($row['failed'] ?? 0)]; + } + /** * Paths of the poller's targets that alert in SmokePing (an alerts value * in its configuration) and have an enabled Thold threshold on one of diff --git a/lib/HealthCheck.php b/lib/HealthCheck.php index ede5bf9..524fbe3 100644 --- a/lib/HealthCheck.php +++ b/lib/HealthCheck.php @@ -38,13 +38,34 @@ public function check(Health $health, string $phpBinary): array { } /** - * Which loss colors the Loss Colors setting selects, and why - * (LossColors). Graphs still on the other colors move later. + * Which loss colors the Loss Colors setting selects and why (LossColors), + * then how many smoke graphs still draw the other colors: those the main + * poller has yet to move, and those whose move failed, which wait for + * upgrade-graphs (SmokeProvisioner::restyleDue()). * * @param string $setting the Loss Colors setting * @param string $version the SmokePing version the reader found, '' for none + * @param int $pending graphs on the other colors' templates, not failed + * @param int $failed graphs on the other colors' templates whose move failed */ - public static function lossColors(string $setting, string $version): Finding { + public static function lossColors(string $setting, string $version, int $pending = 0, int $failed = 0): Finding { + $selected = self::lossColorsSelected($setting, $version); + $message = $selected->message; + $level = $selected->level; + + if ($pending > 0) { + $message .= ' ' . __('%d smoke graphs still draw the other colors; the main poller moves up to 200 per cycle.', $pending, 'smokeping'); + } + + if ($failed > 0) { + $message .= ' ' . __('%d smoke graphs could not be moved; run upgrade-graphs to try them again, and see the Cacti log for the cause.', $failed, 'smokeping'); + $level = $level === HealthLevel::Ok || $level === HealthLevel::Unknown ? HealthLevel::Warning : $level; + } + + return new Finding('loss_colors', $level, $message); + } + + private static function lossColorsSelected(string $setting, string $version): Finding { $colors = LossColors::resolve($setting, $version); $detected = LossColors::ofVersion($version); $shown = LossColors::displayVersion($version); diff --git a/lib/HealthPage.php b/lib/HealthPage.php index a8d4bf5..48b47d0 100644 --- a/lib/HealthPage.php +++ b/lib/HealthPage.php @@ -30,6 +30,16 @@ public function __construct( ) { } + /** + * The loss_colors row, with the smoke graphs still on the other colors. + */ + private function lossColors(string $smokepingVersion): Finding { + $setting = (string) read_config_option(LossColors::SETTING); + $left = $this->cacti->graphsOnOtherLossColors(LossColors::resolve($setting, $smokepingVersion)); + + return HealthCheck::lossColors($setting, $smokepingVersion, $left['pending'], $left['failed']); + } + public function render(Settings $settings, string $rraPath, string $phpBinary, bool $readerHost): void { $health = $this->health->forPoller($settings->pollerId); $expected = []; @@ -46,7 +56,7 @@ public function render(Settings $settings, string $rraPath, string $phpBinary, b [HealthCheck::templates($this->templates->present(), $this->templates->failure())], [HealthCheck::devicePollers($this->cacti->summaryDevicesOffPoller($settings->pollerId), $settings->pollerId)], [HealthCheck::dualAlerting($this->cacti->dualAlerting($settings->pollerId))], - [HealthCheck::lossColors((string) read_config_option(LossColors::SETTING), $health->smokepingVersion)], + [$this->lossColors($health->smokepingVersion)], $this->mount->check($settings->mountPath, $rraPath, $expected) ); diff --git a/locales/LC_MESSAGES/de-DE.mo b/locales/LC_MESSAGES/de-DE.mo index a659f91..9618c31 100644 Binary files a/locales/LC_MESSAGES/de-DE.mo and b/locales/LC_MESSAGES/de-DE.mo differ diff --git a/locales/LC_MESSAGES/es-419.mo b/locales/LC_MESSAGES/es-419.mo index d1a9471..ce75caa 100644 Binary files a/locales/LC_MESSAGES/es-419.mo and b/locales/LC_MESSAGES/es-419.mo differ diff --git a/locales/LC_MESSAGES/es-ES.mo b/locales/LC_MESSAGES/es-ES.mo index 3c37e5d..58c108b 100644 Binary files a/locales/LC_MESSAGES/es-ES.mo and b/locales/LC_MESSAGES/es-ES.mo differ diff --git a/locales/LC_MESSAGES/fr-FR.mo b/locales/LC_MESSAGES/fr-FR.mo index 9bf6473..81dec23 100644 Binary files a/locales/LC_MESSAGES/fr-FR.mo and b/locales/LC_MESSAGES/fr-FR.mo differ diff --git a/locales/LC_MESSAGES/ja-JP.mo b/locales/LC_MESSAGES/ja-JP.mo index a0419c3..07751e6 100644 Binary files a/locales/LC_MESSAGES/ja-JP.mo and b/locales/LC_MESSAGES/ja-JP.mo differ diff --git a/locales/LC_MESSAGES/zh-CN.mo b/locales/LC_MESSAGES/zh-CN.mo index c7c2c6e..155e19f 100644 Binary files a/locales/LC_MESSAGES/zh-CN.mo and b/locales/LC_MESSAGES/zh-CN.mo differ diff --git a/locales/po/cacti.pot b/locales/po/cacti.pot index 2bb4f28..1b7496a 100644 --- a/locales/po/cacti.pot +++ b/locales/po/cacti.pot @@ -125,6 +125,16 @@ msgstr "" msgid "SmokePing Targets of this Device" msgstr "" +#: lib/HealthCheck.php +#, php-format +msgid "%d smoke graphs still draw the other colors; the main poller moves up to 200 per cycle." +msgstr "" + +#: lib/HealthCheck.php +#, php-format +msgid "%d smoke graphs could not be moved; run upgrade-graphs to try them again, and see the Cacti log for the cause." +msgstr "" + #: lib/HealthCheck.php #, php-format msgid "The Loss Colors setting asks for SmokePing %s loss colors, but the reader found SmokePing %s. Set it to Automatic unless the graphs should differ from SmokePing's." diff --git a/locales/po/de-DE.po b/locales/po/de-DE.po index 6521c42..beba959 100644 --- a/locales/po/de-DE.po +++ b/locales/po/de-DE.po @@ -123,6 +123,16 @@ msgstr "Dieses Zielsystem hat SmokePing-Ziele, aber der Reader, der deren Zusamm msgid "SmokePing Targets of this Device" msgstr "SmokePing-Ziele dieses Zielsystems" +#: lib/HealthCheck.php +#, php-format +msgid "%d smoke graphs still draw the other colors; the main poller moves up to 200 per cycle." +msgstr "%d Smoke-Graphen zeichnen noch die anderen Farben; der Hauptpoller stellt bis zu 200 pro Zyklus um." + +#: lib/HealthCheck.php +#, php-format +msgid "%d smoke graphs could not be moved; run upgrade-graphs to try them again, and see the Cacti log for the cause." +msgstr "%d Smoke-Graphen konnten nicht umgestellt werden; führen Sie upgrade-graphs aus, um es erneut zu versuchen, und sehen Sie die Ursache im Cacti-Protokoll." + #: lib/HealthCheck.php #, php-format msgid "The Loss Colors setting asks for SmokePing %s loss colors, but the reader found SmokePing %s. Set it to Automatic unless the graphs should differ from SmokePing's." diff --git a/locales/po/es-419.po b/locales/po/es-419.po index 31e3858..f30cb97 100644 --- a/locales/po/es-419.po +++ b/locales/po/es-419.po @@ -122,6 +122,16 @@ msgstr "Este dispositivo tiene destinos de SmokePing, pero el lector que complet msgid "SmokePing Targets of this Device" msgstr "Destinos de SmokePing de este dispositivo" +#: lib/HealthCheck.php +#, php-format +msgid "%d smoke graphs still draw the other colors; the main poller moves up to 200 per cycle." +msgstr "%d gráficas de humo aún dibujan los otros colores; el sondeador principal cambia hasta 200 por ciclo." + +#: lib/HealthCheck.php +#, php-format +msgid "%d smoke graphs could not be moved; run upgrade-graphs to try them again, and see the Cacti log for the cause." +msgstr "No se pudieron cambiar %d gráficas de humo; ejecute upgrade-graphs para intentarlo de nuevo y consulte la causa en el registro de Cacti." + #: lib/HealthCheck.php #, php-format msgid "The Loss Colors setting asks for SmokePing %s loss colors, but the reader found SmokePing %s. Set it to Automatic unless the graphs should differ from SmokePing's." diff --git a/locales/po/es-ES.po b/locales/po/es-ES.po index 4756ef9..2244116 100644 --- a/locales/po/es-ES.po +++ b/locales/po/es-ES.po @@ -122,6 +122,16 @@ msgstr "Este dispositivo tiene destinos de SmokePing, pero el lector que rellena msgid "SmokePing Targets of this Device" msgstr "Destinos de SmokePing de este dispositivo" +#: lib/HealthCheck.php +#, php-format +msgid "%d smoke graphs still draw the other colors; the main poller moves up to 200 per cycle." +msgstr "%d gráficas de humo aún dibujan los otros colores; el sondeador principal cambia hasta 200 por ciclo." + +#: lib/HealthCheck.php +#, php-format +msgid "%d smoke graphs could not be moved; run upgrade-graphs to try them again, and see the Cacti log for the cause." +msgstr "No se pudieron cambiar %d gráficas de humo; ejecute upgrade-graphs para intentarlo de nuevo y consulte la causa en el registro de Cacti." + #: lib/HealthCheck.php #, php-format msgid "The Loss Colors setting asks for SmokePing %s loss colors, but the reader found SmokePing %s. Set it to Automatic unless the graphs should differ from SmokePing's." diff --git a/locales/po/fr-FR.po b/locales/po/fr-FR.po index 25e14a3..3a31246 100644 --- a/locales/po/fr-FR.po +++ b/locales/po/fr-FR.po @@ -123,6 +123,16 @@ msgstr "Cet équipement possède des cibles SmokePing, mais le lecteur qui rense msgid "SmokePing Targets of this Device" msgstr "Cibles SmokePing de cet équipement" +#: lib/HealthCheck.php +#, php-format +msgid "%d smoke graphs still draw the other colors; the main poller moves up to 200 per cycle." +msgstr "%d graphes de fumée dessinent encore les autres couleurs ; l'agent de collecte principal en change jusqu'à 200 par cycle." + +#: lib/HealthCheck.php +#, php-format +msgid "%d smoke graphs could not be moved; run upgrade-graphs to try them again, and see the Cacti log for the cause." +msgstr "%d graphes de fumée n'ont pas pu être changés ; lancez upgrade-graphs pour réessayer, et consultez la cause dans le journal de Cacti." + #: lib/HealthCheck.php #, php-format msgid "The Loss Colors setting asks for SmokePing %s loss colors, but the reader found SmokePing %s. Set it to Automatic unless the graphs should differ from SmokePing's." diff --git a/locales/po/ja-JP.po b/locales/po/ja-JP.po index 2046b11..a989b2a 100644 --- a/locales/po/ja-JP.po +++ b/locales/po/ja-JP.po @@ -122,6 +122,16 @@ msgstr "このデバイスには SmokePing ターゲットがありますが、 msgid "SmokePing Targets of this Device" msgstr "このデバイスの SmokePing ターゲット" +#: lib/HealthCheck.php +#, php-format +msgid "%d smoke graphs still draw the other colors; the main poller moves up to 200 per cycle." +msgstr "%d 個のスモークグラフはまだ別の色で描画されています。メインポーラーは 1 サイクルあたり最大 200 個を切り替えます。" + +#: lib/HealthCheck.php +#, php-format +msgid "%d smoke graphs could not be moved; run upgrade-graphs to try them again, and see the Cacti log for the cause." +msgstr "%d 個のスモークグラフを切り替えられませんでした。upgrade-graphs を実行して再試行し、原因は Cacti ログで確認してください。" + #: lib/HealthCheck.php #, php-format msgid "The Loss Colors setting asks for SmokePing %s loss colors, but the reader found SmokePing %s. Set it to Automatic unless the graphs should differ from SmokePing's." diff --git a/locales/po/zh-CN.po b/locales/po/zh-CN.po index 1f07281..7faccb2 100644 --- a/locales/po/zh-CN.po +++ b/locales/po/zh-CN.po @@ -122,6 +122,16 @@ msgstr "此设备有 SmokePing 目标,但填充其汇总值的读取器运行 msgid "SmokePing Targets of this Device" msgstr "此设备的 SmokePing 目标" +#: lib/HealthCheck.php +#, php-format +msgid "%d smoke graphs still draw the other colors; the main poller moves up to 200 per cycle." +msgstr "%d 个烟雾图仍使用另一组颜色;主轮询器每个周期最多切换 200 个。" + +#: lib/HealthCheck.php +#, php-format +msgid "%d smoke graphs could not be moved; run upgrade-graphs to try them again, and see the Cacti log for the cause." +msgstr "%d 个烟雾图无法切换;请运行 upgrade-graphs 重试,并在 Cacti 日志中查看原因。" + #: lib/HealthCheck.php #, php-format msgid "The Loss Colors setting asks for SmokePing %s loss colors, but the reader found SmokePing %s. Set it to Automatic unless the graphs should differ from SmokePing's." diff --git a/tests/Unit/LossColorsTest.php b/tests/Unit/LossColorsTest.php index f0289a5..a909376 100644 --- a/tests/Unit/LossColorsTest.php +++ b/tests/Unit/LossColorsTest.php @@ -17,6 +17,7 @@ * more details. */ +use Somethingwithproof\Smokeping\CactiObjectRepository; use Somethingwithproof\Smokeping\HealthCheck; use Somethingwithproof\Smokeping\HealthRepository; use Somethingwithproof\Smokeping\InventoryStatus; @@ -216,3 +217,56 @@ function lc_dir(array $files): string { ->and($query['params'])->toBe([110, 120, 'active', 'archived', 3]); }); }); + +describe('restyle progress on the loss_colors row', function () { + beforeEach(function () { + $GLOBALS['__smokeping_db_queries'] = []; + $GLOBALS['__smokeping_db_row'] = []; + $GLOBALS['__smokeping_db_cell'] = 0; + }); + + it('names graphs still to move without changing the level', function () { + $row = HealthCheck::lossColors('2.7', '', 3, 0); + + expect($row->level)->toBe(HealthLevel::Ok) + ->and($row->message)->toContain('3 smoke graphs still draw the other colors') + ->not->toContain('could not be moved'); + }); + + it('warns about graphs whose move failed, even when no version was found', function () { + $failed = HealthCheck::lossColors('2.7', '', 0, 2); + $unknown = HealthCheck::lossColors(LossColors::AUTO, '', 1, 1); + $warned = HealthCheck::lossColors('2.7', '2.009000', 0, 1); + + expect($failed->level)->toBe(HealthLevel::Warning) + ->and($failed->message)->toContain('2 smoke graphs could not be moved')->toContain('upgrade-graphs') + ->and($unknown->level)->toBe(HealthLevel::Warning) + ->and($unknown->message)->toContain('1 smoke graphs still draw')->toContain('1 smoke graphs could not be moved') + ->and($warned->level)->toBe(HealthLevel::Warning) + ->and($warned->message)->toContain('2.9.0'); + }); + + it('says nothing more once every graph has moved', function () { + expect(HealthCheck::lossColors('2.7', '', 0, 0)->message)->not->toContain('smoke graphs still')->not->toContain('could not be moved'); + }); + + it('counts graphs on the other colors\' templates, split by failure', function () { + // Templates 110, 120 and 130 exist for the other (2.8) colors. + $GLOBALS['__smokeping_db_cell'] = fn (string $sql, array $params) => str_contains($sql, 'FROM graph_templates WHERE name') + ? (preg_match('/^SmokePing Smoke \((\d+) pings\)$/', (string) $params[0], $m) === 1 ? 100 + (int) $m[1] : 0) + : 0; + $GLOBALS['__smokeping_db_row'] = ['pending' => '4', 'failed' => '1']; + + expect((new CactiObjectRepository(false))->graphsOnOtherLossColors(LossColors::Legacy))->toBe(['pending' => 4, 'failed' => 1]); + + $query = end($GLOBALS['__smokeping_db_queries']); + + expect($query['sql'])->toContain('gl.graph_template_id IN (?, ?, ?)') + ->and($query['params'])->toBe([110, 120, 130, 'active', 'archived']); + }); + + it('counts nothing when the other templates are not imported', function () { + expect((new CactiObjectRepository(false))->graphsOnOtherLossColors(LossColors::Current))->toBe(['pending' => 0, 'failed' => 0]) + ->and($GLOBALS['__smokeping_db_queries'])->toBe([]); + }); +}); diff --git a/tests/bin/lifecycle.php b/tests/bin/lifecycle.php index 427847f..dd8ead5 100644 --- a/tests/bin/lifecycle.php +++ b/tests/bin/lifecycle.php @@ -307,6 +307,15 @@ function lifecycle_hook_probe($args) { list($graph, $version) = explode(':', $argument); db_execute_prepared('UPDATE plugin_smokeping_object SET template_version = ? WHERE local_graph_id = ?', array((int) $version, (int) $graph)); + break; + case 'loss_colors_row': + // The health page's loss_colors row, from the same calls the page makes. + $setting = (string) read_config_option(\Somethingwithproof\Smokeping\LossColors::SETTING); + $version = (new \Somethingwithproof\Smokeping\HealthRepository(false))->forPoller(1)->smokepingVersion; + $left = (new \Somethingwithproof\Smokeping\CactiObjectRepository(false))->graphsOnOtherLossColors(\Somethingwithproof\Smokeping\LossColors::resolve($setting, $version)); + $finding = \Somethingwithproof\Smokeping\HealthCheck::lossColors($setting, $version, $left['pending'], $left['failed']); + $result = $finding->level->value . ' ' . $finding->message; + break; case 'query': // Read-only inspection for the shell-driven checks. diff --git a/tests/bootstrap-unit.php b/tests/bootstrap-unit.php index d92e556..4e7d567 100644 --- a/tests/bootstrap-unit.php +++ b/tests/bootstrap-unit.php @@ -120,6 +120,8 @@ function db_table_exists($table, $log = true, $db_conn = false) { if (!function_exists('db_fetch_row_prepared')) { function db_fetch_row_prepared($sql, $params = [], $log = true, $db_conn = false, $log_function = null) { + $GLOBALS['__smokeping_db_queries'][] = ['sql' => $sql, 'params' => $params]; + return $GLOBALS['__smokeping_db_row']; } } diff --git a/tests/objects-e2e.sh b/tests/objects-e2e.sh index 204a420..f3ec638 100644 --- a/tests/objects-e2e.sh +++ b/tests/objects-e2e.sh @@ -172,6 +172,8 @@ tpl_name() { q "SELECT gt.name FROM graph_local AS gl INNER JOIN graph_templates matches() { q "SELECT (SELECT COUNT(*) FROM graph_templates_item WHERE local_graph_id = ${gr:-0}) - (SELECT COUNT(*) FROM graph_templates_item AS gi INNER JOIN graph_local AS gl ON gl.graph_template_id = gi.graph_template_id WHERE gl.id = ${gr:-0} AND gi.local_graph_id = 0)" | jcell; } before_graph=$(q "SELECT title_cache, upper_limit FROM graph_templates_graph WHERE local_graph_id = ${gr:-0}" | jcell) $L set_setting "smokeping_loss_colors=2.7" >/dev/null +row=$($L loss_colors_row | res) +case "$row" in "ok "*"1 smoke graphs still draw the other colors"*) result PASS health-loss-colors-pending "$row" ;; *) result FAIL health-loss-colors-pending "$row" ;; esac out=$(php $P/cli/smokeping.php upgrade-graphs 2>&1); rc=$? legacy=$(tpl_name); legacy_rendered=$($L render "${gr:-0}" | res) after_graph=$(q "SELECT title_cache, upper_limit FROM graph_templates_graph WHERE local_graph_id = ${gr:-0}" | jcell) @@ -197,9 +199,15 @@ kept=$(tpl_name); unbound=$(q "SELECT COUNT(*) FROM graph_templates_item AS gi I [ -n "$rrd" ] && [ $rc -eq 1 ] && [ "$kept" = "SmokePing Smoke (20 pings)" ] && [ "$unbound" = 0 ] \ && result PASS loss-colors-unbound-item-refused "graph keeps $kept with every item bound; $out" \ || result FAIL loss-colors-unbound-item-refused "data source item '$rrd', rc $rc, template '$kept', $unbound unbound items: $out" +row=$($L loss_colors_row | res) +case "$row" in "warning "*"1 smoke graphs could not be moved"*) case "$row" in *"still draw"*) result FAIL health-loss-colors-failed "$row" ;; *) result PASS health-loss-colors-failed "$row" ;; esac ;; *) result FAIL health-loss-colors-failed "$row" ;; esac ds_name median $L set_setting "smokeping_loss_colors=auto" >/dev/null php $P/cli/smokeping.php upgrade-graphs >/dev/null 2>&1 +row=$($L loss_colors_row | res) +# Automatic with no SmokePing found selects 2.8 and later (Unknown), and no +# graph is left on the 2.7 templates. +case "$row" in "unknown The reader found no SmokePing version"*) case "$row" in *"smoke graphs"*) result FAIL health-loss-colors-done "$row" ;; *) result PASS health-loss-colors-done "no graph left on the other colors: $row" ;; esac ;; *) result FAIL health-loss-colors-done "not the expected row: '$row'" ;; esac # Poller and boost ignore it: input method None means no poller_item rows. row=$(q "SELECT COUNT(*) FROM poller_item WHERE local_data_id = ${ds:-0}" | jcell)