{% import "github.com/VictoriaMetrics/VictoriaMetrics/lib/prompbmarshal" %} {% stripspace %} {% func TargetsResponsePlain(jts []jobTargetsStatuses, emptyJobs []string, showOriginLabels bool) %} {% for _, js := range jts %} job={%q= js.job %} ({%d js.upCount %}/{%d js.targetsTotal %} up) {% newline %} {% for _, ts := range js.targetsStatus %} {% code labels := promLabelsString(ts.labels) ol := promLabelsString(ts.originalLabels) %} {%s= "\t" %}state={% if ts.up %}up{% else %}down{% endif %},{% space %} endpoint={%s= ts.endpoint %},{ %space %} labels={%s= labels %} {% if showOriginLabels %}, originalLabels={%s= ol %}{% endif %},{% space %} last_scrape={%f.3 ts.lastScrapeTime.Seconds() %}s ago,{% space %} scrape_duration={%f.3 ts.scrapeDuration.Seconds() %}s,{% space %} samples_scraped={%d ts.samplesScraped %},{% space %} error={%q= ts.errMsg %} {% newline %} {% endfor %} {% endfor %} {% for _, jobName := range emptyJobs %} job={%q= jobName %} (0/0 up) {% newline %} {% endfor %} {% endfunc %} {% func TargetsResponseHTML(jts []jobTargetsStatuses, emptyJobs []string, redirectPath string, onlyUnhealthy bool) %} Scrape targets

Scrape targets

{% for _, js := range jts %} {% if onlyUnhealthy && js.upCount == js.targetsTotal %}{% continue %}{% endif %}

{%s js.job %} ({%d js.upCount %}/{%d js.targetsTotal %} up)

{% for _, ts := range js.targetsStatus %} {% if onlyUnhealthy && ts.up %}{% continue %}{% endif %} {% endfor %}
Endpoint State Labels Last Scrape Scrape Duration Samples Scraped Error
{%s ts.endpoint %}
{% if ts.up %}UP{% else %}DOWN{% endif %} {%= formatLabel(ts.labels) %} {%f.3 ts.lastScrapeTime.Seconds() %}s ago {%f.3 ts.scrapeDuration.Seconds() %}s {%d ts.samplesScraped %} {%s ts.errMsg %}
{% endfor %} {% for _, jobName := range emptyJobs %}

{%s jobName %} (0/0 up)

Endpoint State Labels Last Scrape Scrape Duration Samples Scraped Error
{% endfor %} {% endfunc %} {% func formatLabel(labels []prompbmarshal.Label) %} {% for _, label := range labels %} {%s label.Name %}={%q label.Value %} {% space %} {% endfor %} {% endfunc %} {% endstripspace %}