Closed discordianfish closed 7 years ago
Sorry, it looks like this was changed and not documented. Can you try this?
views {
enabled = true
frames = {
monitoring {
enabled = true
urlScript = """ function(asset) { return "https://prometheus/consoles/node-overview.html?instance=" + obj.ATTRIBS[0]["HOSTNAME"];}"""
}
}
}
I'll make a note to myself to document this.
Or if the person who wrote it cough @maddalab cough could submit docs, that would be awesome too 😝
@Primer42 This isn't working, it causes collins to fail with that misleading [error] application - Failed to create assetlog
error (see #398). So something is wrong with that config snippet..
Maybe try script
instead of urlScript
like it has in this example?
https://github.com/tumblr/collins/blob/master/conf/reference/views_reference.conf
It's very possible that urlScript
doesn't actually work - I made my code snippet before based on the FrameConfig class in the code so I'm probably wrong about that config.
In retrospect the change to arbitrary frames made is more flexible / script-able, do what you want - we used it at Tumblr, but made the common case more involved.
https://github.com/tumblr/collins/commit/7109b1e087a8f22e35c9b39548a2bfc75ff8de14
The difference was, you could now use this for any asset type.
The change implements the use of javascript call back to determine availability of the frame and supports arbitrary frame, which can be used for any asset type.
The commit message includes this, which should get you there.
Implementing the monitoring frame
views {
enabled = true
frames = {
monitoring {
enabled = true
title = "Monitoring"
style = "width: 100%;height: 1200px;"
script = """
function isEnabled(inp) {
var obj = JSON.parse(inp);
return ((obj.ASSET.TYPE === "SERVER_NODE") && ("HOSTNAME" in obj.ATTRIBS[0]));
}
function getUrl(inp) {
var obj = JSON.parse(inp);
return "https://icinga2.ewr01.tumblr.net/thruk/cgi-bin/status.cgi?host=" + obj.ATTRIBS[0]["HOSTNAME"];
}
"""
}
}
}```
Thanks! That worked. Would be great to see it in the docs :)
@maddalab @Primer42 @discordianfish FWIW we use the flexible frames as well, and it works fantastically. We should add it into docs (and possibly update the demo configs) as well.
Hi,
I have this monitoring section in my production.conf, yet the monitoring "tab" doesn't show up: