Probe to Determine Server Uptime
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-13-2013 02:33 PM
Has anyone developed a probe (or the capability) to determine system uptime? I'd like for Discovery to report back system uptime for Windows servers and populate the results in a custom field. Is this doable or far-fetched?
- Labels:
-
Discovery
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-13-2013 03:32 PM
You can get the last boot timeusing the Powershell command:
(Get-WmiObject -Class Win32_OperatingSystem).ConvertToDateTime($wmi.LastBootUpTime)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2013 08:13 PM
Win32_PerfFormattedData_PerfOS_System.SystemUpTime
I wrote a probe grab the uptime and populate a custom field on the server form, but the output from this probe is returned in seconds.
2595263
I had difficulty scripting it so that it converted properly into a GlideDate value (kept incrementing the date by the amount of time between by the time between the scans), so I ended up just converting it to days and hours and leaving it at that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-15-2013 12:17 PM
Appreciate the feedback, which was big help. Here's how I accomplished the task:
Created a custom probe:
Name: Windows - System Uptime
Probe Type: WMI Probe
ECC queue topic: WMIRunner
ECC queue name: WMI: System Uptime
WMI Fields
========
Probe: Windows - System Uptime
WMI path: Win32_PerfFormattedData_PerfOS_System.SystemUpTime
Sensors
======
Name: Windows - System Uptime
Reacts to probe: Windows - System Uptime
Sensor Type: Sensor
Sensor type: Javascript
Sensor Script
=========
new DiscoverySensor({
process: function(result) {
this.parseResult(result);
},
parseResult: function(result) {
current.u_system_uptime = result.Win32_PerfFormattedData_PerfOS_System.SystemUpTime;
},
type: "DiscoverySensor"
});
I then added the custom probe to the Discovery Definition --> CI Classification --> Windows classification ("Triggers Probes"). On the custom field u_system_uptime I set the "Attributes" field on the dictionary to "format=glide_duration" (no quotes) per the wiki (http://wiki.servicenow.com/index.php?title=Modifying_the_Glide_durations_Format). Testing extensively in our dev environment produced the desire results (see attached). However, additional tweaking may be needed in order to report off of the custom field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2022 02:58 AM
Very nice. I can use this for my Patch Management Team.