Advertisement
Guest User

Untitled

a guest
Oct 21st, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1.  
  2. /**
  3. * Add actual cost in `Normalized instance hours` column
  4. *
  5. * Q: How do you calculate the Normalized Instance Hours displayed on the
  6. * console ?
  7. *
  8. * On the AWS Management Console, every cluster has a Normalized Instance Hours
  9. * column that displays the approximate number of compute hours the cluster has
  10. * used. Normalized Instance Hours are hours of compute time based on the
  11. * standard of 1 hour of m1.small usage = 1 hour normalized compute time.
  12. *
  13. * As of 2016-10-20, m1.small costs $0.044/hr
  14. */
  15. function addNormalizedInstanceHoursCost() {
  16. var tbody = $('.GF2SJOLOO');
  17. // console.log(tbody);
  18. if (! tbody) {
  19. console.log("Didn't find tbody w/ class `GF2SJOLOO`");
  20. return;
  21. }
  22. var trs = tbody.find('tr');
  23. if (! trs) {
  24. console.log("Didn't find tbody trs");
  25. return;
  26. }
  27. console.log("Adding normalized instance hours costs for " + trs.length + " clusters ...");
  28. $.each(trs, function(index, tr) {
  29. var td = $(this).find('td').last();
  30. var hours = td.text();
  31. var cost = (0.044 * hours).toFixed(2);
  32. var tdStr = hours + " ($" + cost + ")";
  33. td.text(tdStr);
  34. })
  35. }
  36.  
  37. function main() {
  38. console.log("Running `~/.js/console.aws.amazon.com.js ...");
  39. // These things load asynchronously, so wait a few ticks before kicking it off
  40. window.setTimeout(addNormalizedInstanceHoursCost, 3000);
  41. }
  42.  
  43. main();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement