- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-29-2017 11:51 AM
Tried using simple python and curl programs to hit the xmlstats processor but it seems the response is always a HTML page. How do we get to the xml and downloadit.
import requests
r = requests.get('https://XXXXX.service-now.com/xmlstats', auth=('admin', 'XXXX'))
print(r.status_code)
print(r.headers['content-type'])
print(r.content)
//Response
200
text/html;charset=UTF-8
b'<!DOCTYPE html><html lang="en" class=" ltr " data-doctype="true" dir="ltr"><head><title>ServiceNow</title><meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"></meta><meta http-equiv="cache-control" content="public"></meta><meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no"></meta><script>\n\twindow.NOW = window.NOW || {};\n\tvar g_loadTime = new Date();\n\tvar lastActivity = new Date();\n\tvar g_lang = \'en\';\n\tvar g_system_lang = \'en\';\n\tvar g_enhanced_activated = \'true\';\n\t var g_popup_timeout = parseInt(100);\n\tvar g_export_warn_threshold = parseInt(10000);\n\t var g_event_handler_ids = {};\n\tvar g_event_handlers = [];\n\tvar g_event_handlers_onLoad = [];\n\tvar g_event_handlers_onSubmit = [];\n\tvar g_event_handlers_onChange = [];\n\tvar g_event_handlers_onCellEdit = {};\n\tvar g_event_handlers_localCache = {};\n\tvar g_event_handlers_queryTracking = true;\n\tvar g_user_date_time_format = "yyyy-MM-dd HH:mm:ss";\n\tvar g_user_date_format = "yyyy-MM-dd";\n\tvar g_user_decimal_separator = ".";\n\tvar g_user_grouping_separator = ",";\n\tvar g_glide_list_separator = ", ";\n\tvar g_tz_offset = -28800000;\n\t var g_tz_user_offset = true;\n\tvar g_first_day_of_week = parseInt(1, 10);\n\tvar g_date_picker_first_day_of_week = parseInt(0, 10);\n\t var g_full_calendar_edit = true;\n\tvar g_submitted = false;\n\tvar g_max_table_length = 80;\n\tvar g_fontSizePreference = "";\n\tvar g_fontSize = "10pt";\n\t// use to be the sys_property glide.ui.js_error_notify, hard coded for PRB603998\n\tvar g_jsErrorNotify = "true";\n\tvar g_cancelPreviousTransaction = true;\n\tvar g_text_direction = "ltr";\n\tvar g_glide_list_filter_max_length = parseInt("0", 10);\n\tvar g_accessibility = false;\n\tvar g_accessibility_visual_patterns = false;\n\tvar g_detail_row = false;\n\twindow.g_load_functions = [];\n\twindow.g_render_functions = [];\n\twindow.g_late_load_functions = [];\n\t\n\t\n\tvar g_ck = \'1c133a06db178300c492712ebf9619bfe0d68e664cddbab027e780a795e250c806d605e4\';\n\t\n\n\t\n\tvar g_acWaitTime = parseInt(250);\n\t\n\n\tvar g_autoRequest = \'\';\n\twindow.NOW.dateFormat = {timeAgo: false, dateBoth: false};\n\twindow.NOW.shortDateFormat = false;\n\twindow.NOW.listTableWrap = true;\n\twindow.NOW.compact = false;\n \twindow.NOW.templateToggle = false;\n\twindow.NOW.tabbed = false;\n\twindow.NOW.permalink = true;\n\twindow.NOW.useSimpleStorage = true;\n\twindow.NOW.simpleStorageSynch = "95731121db130300c492712ebf96192e";\n\twindow.NOW.language = \'en\';\n\twindow.NOW.listOpenInAppTab = false;\n\twindow.NOW.floatingScrollbars = false;\n\t\n\twindow.NOW.user = {};\n\twindow.NOW.user.preferences = [];\n\twindow.NOW.user.roles = \'\';\n\twindow.NOW.user.allRoles = \'\';\n\twindow.NOW.user.userID = \'5136503cc611227c0183e96598c4f706\';\n\twindow.NOW.user.departmentID = \'221db0edc611228401760aec06c9d929\';\n\twindow.NOW.user.firstName = \'\';\n\twindow.NOW.user.lastName = \'Guest\';\n\twindow.NOW.user.name = \'guest\';\n window.NOW.batch_glide_ajax_requests = \'true\' === \'true\';\n window.NOW.batch_glide_ajax_requests_max_time_in_queue = ~~\'50\';\n window.NOW.batch_glide_ajax_disable_time = ~~\'1000\';\n\n\twindow.NOW.currency = {};\n window.NOW.currency.code = \'USD\';\n window.NOW.locale = {};\n\twindow.NOW.locale.code = \'en_US\';\n </script><script>(function() {\n\t\t g_render_functions.push(setGlideUser);\n\t\tfunction setGlideUser() {\n\t\t\tif (window.g_user || !window.GlideUser)\n\t\treturn;\n\n\t\twindow.g_user = new GlideUser(NOW.user.name,\n\t\t\t NOW.user.firstName,\n\t\t\t NOW.user.lastName,\n\t\t\t NOW.user.roles,\n\t\t\t NOW.user.userID,\n\t\t\t NOW.user.departmentID);\n\t\twindow.g_user.setRoles(NOW.user.allRoles, true);\n\t\t}\n\t})();</script><script>window.NOW.filter_globals = "[[\\"This fiscal month\\",
Can someone help to me to understand how this java processor works....
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-21-2019 08:59 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-21-2019 08:59 AM
/sys_cluster_state_list.do?XML
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-18-2022 11:22 AM
My answer was accepted 4 days ago, but it was posted MANY years ago. Knowing what I know now, I would never advocate accessing sys_cluster_state in this way. My original answer would result in two potentially GIGANTIC fields (iostats and stats) being pulled from the Database and rendered through the application layer. I would no longer recommend downloading or accessing the sys_cluster_status table directly at all. Ever. Instead I would recommend accessing the specific part of the XML stats page itself rather than the sys_cluster_state. The xmlstats.do page will mostly pull information dynamically from application memory rather than requiring an expensive database hit. This can be done using an "include" argument. For example:
Throughput metrics
/xmlstats.do?include=servlet
AI Search metrics
/xmlstats.do?include=aisearch
Scheduled job stats
/xmlstats.do?include=scheduler
Semaphore stats
/xmlstats.do?include=semaphores
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-15-2022 09:59 AM
The original posting of the html output suggests that the request did not authenticate properly and got redirected to the login page. A properly authenticated call to xmlstats.do will return a properly formatted xml document which you can then parse.
Further to Matt's comment, be mindful that not all elements which are displayed on xmlstats.do get captured in the sys_cluster_state record. The content which is stored is controlled in a glide property "glide.cluster.xmlstats".
It is unusual, but possible that the value of this property may change from release to release (some internal ServiceNow monitoring and process rely on certain elements being present). You can see valid values by checking at xmlstats.do - look for the "includes" list.
Caution: These records are updated frequently. Do not modify what is being stored in sys_cluster_state without validating the impact with the Support team first... you almost certainly don't want to capture everything.