我有以下consul-template。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>@ViewBag.Title - My ASP.NET Application</title>
<link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
@Styles.Render("~/ClientApp/Dist/Dev/vendor.css");
</head>
<body >
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>@Html.ActionLink("Home", "Index", "Home", new { area = "" }, null)</li>
</ul>
@Html.Partial("_LoginPartial")
</div>
</div>
</div>
<div class="container body-content">
@RenderBody()
@RenderSection("scripts", required: false)
</div>
<script src="~/ClientApp/Dist/Dev/vendor.js"></script>
<script src="~/ClientApp/Dist/Dev/main.js"></script>
</body>
</html>
我想添加,如果我的主机名匹配&#34;数据库-1&#34;然后命令&#34; check_procs_1&#34;和其他人命令&#34; check_procs_2&#34;
输出
<script src="~/ClientApp/Dist/Dev/vendor.js"></script>
<script src="~/ClientApp/Dist/Dev/main.js"></script>
答案 0 :(得分:3)
要解决此问题,我们可以使用以下修复。
{{ range service "mysql_slave.mysql" "any" }}
{{ if eq .Node "database-1" }}
host_name {{.Node}}
command check_nrpe!check_procs_1
{{else}}
host_name {{.Node}}
command check_nrpe!check_procs_2
{{end}}
{{end}}