Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Widgets on the dashboard, where "Pending jobs" is the most crucial #54

Open
elofu17 opened this issue May 19, 2016 · 5 comments
Open

Widgets on the dashboard, where "Pending jobs" is the most crucial #54

elofu17 opened this issue May 19, 2016 · 5 comments

Comments

@elofu17
Copy link

elofu17 commented May 19, 2016

In config.js(.example), please add something like this (I'm no programmer but I think you get the idea):

DASHBOARD_PANELS = [
  {"name":"Nodes with failures","type":"danger","query":"#node.latest_report_status=\"failed\""},
  {"name":"Nodes with pending jobs","type":"warning","query":"#report { latest_report?=true and noop_pending=true }"},
  {"name":"Unresponsive nodes (within last ${UNRESPONSIVE_HOURS}h)","type":"danger","query":"#node.report_timestamp < @\"now - $UNRESPONSIVE_HOURS hours\""},
  {"name":"Nodes in production env","type":"success","query":"#node.catalog_environment = production"},
  {{"name":"Nodes in non-production env",type:"warning",query:"#node.catalog_environment != production"}}
];

Add a dashboard for "Nodes with pending jobs".

I have cron run 'puppet agent -t --noop' every now and then on all my nodes.

Normally these noops show up as grey icons in the Nodes tab in Puppet Explorer, as there's nothing to do. The nodes are up to date. Everything is good.

However, if the noop-run show pending changes, this is indicated with a blue icon in the Node tab.

It is crucial to me to have this as a dashboard widget, as it will show how many of my nodes are NOT up to date.

Before you can add this dashboard, you need to fix the bug in dalen/node-puppetdbquery#1, since the query contain a questionmark.
#report { latest_report?=true and noop=true and status="unchanged" }

I almost consider the following a bug:

In the 'Unresponsive nodes' widget you're using a static query like this:
'#node.report_timestamp < @"now - 2 hours"'

This forces the widget to use 2 hours, even though the user can configure the UNRESPONSIVE_HOURS variable to e.g. 24h earlier in the file.

Update to something like this: '#node.report_timestamp < @"now - $UNRESPONSIVE_HOURS hours"'

This is a bit overkill, but it's just a simple if-statement:

If the puppet-db only deal with one single environment, "production", I think you should hide the 'Nodes in non-production env' widget from the dashboard. Otherwise it will always show "0" and just waste screen space for users like me. :-)

if ( total number of environments > 1 ) then
show the 'Nodes in non-production env' widget
fi

@elofu17
Copy link
Author

elofu17 commented Jun 21, 2016

Updated the text above a bit after dalen/node-puppetdbquery#1 was updated.

@elofu17
Copy link
Author

elofu17 commented Sep 22, 2016

Update:
Since the latest update of the puppet agent software (and puppetdb 4.2), we now have a new keyword for finding nodes with pending jobs: noop_pending=true.

So I've modified the original text with:
old: {"name":"Nodes with pending jobs","type":"warning","query":"#report { latest_report?=true and noop=true and status="unchanged" }"},
new: {"name":"Nodes with pending jobs","type":"warning","query":"#report { latest_report?=true and noop_pending=true }"},

@Loshea
Copy link

Loshea commented Apr 18, 2017

I have tried messing around with this some, and am finding that PE apparently doesn't understand latest_report?. When I try to query on it, Chrome reports:
`
app.js:58 Error: Lexical error on line 1. Unrecognized text.

...report.latest_report?=true and noop_pend
-----------------------^

at Parser.parseError (https://pe.vmlapps.com/app.js:107:5439)
at Object.parseError (https://pe.vmlapps.com/app.js:107:7768)
at Object.next (https://pe.vmlapps.com/app.js:107:11776)
at Object.lex (https://pe.vmlapps.com/app.js:107:11943)
at b (https://pe.vmlapps.com/app.js:107:5515)
at Parser.parse (https://pe.vmlapps.com/app.js:107:6207)
at Object.process.undefined.require.undefined.exports.parse 

(https://pe.vmlapps.com/app.js:107:13987)
at Object.exports.parse (https://pe.vmlapps.com/app.js:103:218)
at PuppetDB.parse (https://pe.vmlapps.com/app.js:26:1011)
at PuppetDB.parseAndQuery (https://pe.vmlapps.com/app.js:26:1447)


`

@Loshea
Copy link

Loshea commented Apr 18, 2017

looks like it was fixed in node-puppetdbquery
https://github.com/dalen/node-puppetdbquery/blob/master/lib/parser.jison

does this project depend on node-puppetdbquery?

@elofu17
Copy link
Author

elofu17 commented Apr 18, 2017

Yes, I bug-reported it in node-puppetdbquery.
Yes, PuppetExplorer depend on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants