How to execute ping command from scheduled job?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-03-2017 08:07 PM
Hello
I am new bee to scripting in SNOW. We are on Jakarta.
I have following snippet from a scheduled job and need to run a ping command on a host to find out if the host responses or not. If ping fails I set host to retired.
I have some vision that this command has to run on a MID server and get the response back in the script, but no clue on how to do that.
Any help is greatly appreciated.
Thank you very much in advance.
while(rec.next()){
var lastDisco =rec.getValue('last_discovered');
var host = rec.getValue('name');
gs.addInfoMessage('Last Discovery Date:'+lastDisco+' Host:'+host);
//Ping logic starts here
// if(!PING){
// rec.setValue('short_description','Retired');
// rec.update();
// gs.info('Host set for Retired');
// }else{
// gs.info("Host recently Discovered");
// }
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-03-2017 08:13 PM
You would have to have Orchestration to do this, I believe. You can run a command in a cmd prompt that will do it for you. Just create a workflow that does it and call the workflow in the script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-05-2017 05:46 PM
Thanks Mike. Appreciate your response.
I have created a workflow which does a ping job on a host passed as a parameter.
Could you please let me know, how can I call that workflow in my above script?
Thanks,
Rajan Mehta

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-05-2017 05:58 PM
Please check if this helps: http://wiki.servicenow.com/index.php?title=Workflow_Script#startFlow.28workflowId.2C_current.2C_oper...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-07-2017 04:57 PM