• Recent
    • Unsolved
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login
    1. Home
    2. nehsa
    3. Topics
    N
    • Profile
    • Following 0
    • Followers 0
    • Topics 2
    • Posts 6
    • Best 0
    • Controversial 0
    • Groups 0

    Topics created by nehsa

    • N

      Solved 504 Gateway Timeout hitting fog/scheduledtask/list

      Bug Reports
      • • • nehsa
      14
      0
      Votes
      14
      Posts
      832
      Views

      N

      @jj-fullmer

      Hi there, my apologies for not responding earlier. I was on a mini-vacation. As much as one can have in the US now anyway not being able to travel anywhere…

      I’m glad you weren’t stuck in my absense. I want to look at the PowerShell stuff you’ve created for FOG. I was just reading about it. I use PowerShell a lot in my work and can use it.

      Here’s what I did for your reference in JavaScript/JQuery:

      I have an HTML button set to hit this JavaScript function. It just passes the string name of the machine to create the task for. e.g. “LABMACHINE1”

      function create_fog_scheduled_task(node_name){ var hour_to_deploy = 1; // 1am // get the host list $.ajax({ url: "http://lab/fog/host/list", type: "GET", headers: { "fog-api-token": fog_api_token, "fog-user-token": fog_user_token }, contentType: 'application/json', success: function (data) { console.log("Retrieved host list:"); console.log(data); // get the host id var host_id = -1 for (x = 0; x <= data.hosts.length; x++) { if (data.hosts[x].name.toUpperCase() == node_name.toUpperCase()) { host_id = data.hosts[x].id; break; } } console.log("Creating scheduled task for: " + node_name + ", ID: " + host_id); // randomize when task starts to prevent all starting at once.. var minute = Math.floor(Math.random() * 60) // 0 to 59 var post_data = { "name": node_name, "description": "", "type": "C", "taskType": 1, "minute": parseInt(minute), "hour": hour_to_deploy, "dayOfMonth": "*", "month": "*", "dayOfWeek": "*", "isGroupTask": 0, "hostID": parseInt(host_id), "shutdown": 0, "other1": "", "other2": "-1", "other3": "fog", "other4": true, "other5": "", "scheduleTime": "", "isActive": 1, "imageID": 0 } $.ajax({ url: "http://lab/fog/scheduledtask/new", type: "POST", headers: { "fog-api-token": fog_api_token, "fog-user-token": fog_user_token }, contentType: 'application/json', data: JSON.stringify(post_data), success: function (data) { console.log("Scheduled task created for " + node_name); } }); } }); }

      @Sebastian-Roth, @JJ-Fullmer, @Tom-Elliott -
      In troubleshooting this issue, I noticed my code can end up passing minute as zero as well which also ends up as NULL in the database. This doesn’t appear to cause an issue like stHour.

      The UI/PHP set the minute to 0 in this case:
      2020-11-24 01:00

      Even though the database shows (look at SKYLAKE-PC):

      mysql> select stName, stHour, stMinute, stActive from scheduledTasks; +-----------------+--------+----------+----------+ | stName | stHour | stMinute | stActive | +-----------------+--------+----------+----------+ | EEAP-PC | 1 | 33 | 1 | | BEELINK-PC | 1 | 42 | 1 | | CALPELLA-PC | 1 | 49 | 1 | | EVGAQUAD-PC | 1 | 49 | 1 | | ICELAKE2-NUC | 1 | 13 | 1 | | JBMIX-PC | 1 | 53 | 1 | | MAMMOTH-PC | 1 | 51 | 1 | | MASTER-PC | 1 | 53 | 1 | | MITX-PC | 1 | 35 | 1 | | MODISC-PC | 1 | 27 | 1 | | OPTIPLEX7010-PC | 1 | 39 | 1 | | PRECISION-PC | 1 | 42 | 1 | | SKYLAKE-PC | 1 | | 1 | | SMC-X10SAE | 1 | 13 | 1 | | THERMALTAKE-PC | 1 | 19 | 1 | | THINK-PC | 1 | 24 | 1 | | SMC-X11SAE | 1 | 23 | 1 | | VALUELINEI7-PC | 1 | 39 | 1 | | ICELAKE-NUC | 1 | 17 | 1 | +-----------------+--------+----------+----------+ 19 rows in set (0.00 sec)

      I still added this just in case to my website:

      // randomize when task starts to prevent all starting at once.. var minute = Math.floor(Math.random() * 60) // 0 to 59 if (minute == 0) { minute = 1; };

      Thanks everyones for your help on this! It’s very much appreciated!

      Jesse

    • N

      Solved Create scheduledtask via POST to API

      FOG Problems
      • • • nehsa
      3
      0
      Votes
      3
      Posts
      337
      Views

      Tom ElliottT

      @nehsa said in Create scheduledtask via POST to API:

      “minute”: “30”,
      “hour”: “5”,
      “dayOfMonth”: “",
      “month”: "”,
      “dayOfWeek”: “*”,

      This all depends on the type of task this is to do:

      The json elements that you can set:

      { "name": 'Some Name', // Optional "description": 'Some Description', // Optional "type": "C", // C = Cron, S = Single "taskType": 1, // ID of the task type, 1 = deploy, 2 = capture, 3 = debug do not use this one, 4 = memtest, 5 = test disk, 6 = disk surface test, 7 = recover, 8 = multicast, 10 = inventory, 11 = password reset, 12 = all snapins, 13 = single snapin, 14 = wake up, 15 = debug deploy, 16 = debug capture, 17 = deploy no snapins, 18 = fast wipe, 19 = normal wipe, 20 = full wipe "minute": 30, "hour": 5, "dayOfMonth": '*', "month": '*', "dayOfWeek": '*', "isGroupTask": 0, // 0 = host only, 1 = group task "hostID": 1, // If is grouptask is 1 this will be the group id, otherwise the relevant hostID "shutdown": 0, // 0 = restart, 1 = shutdown "other1": "", "other2": "-1", // Snapins either the id of the individual snapin, or -1 for all. "other3": "fog", // The username who created the task "other4": true, // Wake On Lan? "other5": "", "scheduleTime": "", // Only used for delayed time in which case you will need a valid unix timestamp in the future. "isActive": 1, // 0 or false would mean the task is not active currently. "imageID": 1 // The image ID in the case it's an imaging task. Can be any imageID you want. }
    • 1 / 1