This article shows how to leverage ServiceNow API and Lumu Defender API to enhance your SecOps capabilities, pushing Lumu incidents into a ServiceNow deployment Incident Tickets, and syncing both systems.
Before you deploy and implement the Lumu Integration, you need to prepare your ServiceNow deployment to ensure integration works as is expected.
1. In your ServiceNow Web console, expand the All menu. Using the search bar, search for the System Plugins option.
2. The All Applications window will appear. Click on the Click here link in the notification bar.
3. Search for the OAuth plugin using the System Plugins search bar. Click on the OAuth row and click on the Activate link. Follow the on-screen instructions to activate the module. If it is already activated, leave it as it is.
1. After activating the OAuth plugin, you need to create a new OAuth registry for Lumu. To do so, use the search bar from the All menu. Search for OAuth. Click on the Application Registry option and then, click on the New button.
2. In the OAuth application window, click on the Create an OAuth API endpoint for external clients link. Fill in the required data. Click on the Submit button. Open the recently created registry to copy the Client ID and Client Secret. These will be used later for setting up the integration.
![]()
1. Go to the Credentials menu under the Configuration & Credentials section using the search bar. In the Credentials window, click on the New button. Fill in the required information.
1. It’s recommended to create a dedicated ServiceNow user to operate with the integration. This user will be used as the Caller in the created incidents in ServiceNow. Go to Users under the User Administration section using the search bar in the All menu.
2. In the Users window, click on the New button. Fill in the required data. Be sure that the Web service access only check is marked. Click on the Submit button.
3. To set the password for this user, search for it in the Users window. Open the record and click on the Set Password button. Generate and save the password for the user. Keep this information at hand, it will be required for setting the integration.
To ensure that actions performed in Lumu are accurately reflected in ServiceNow incidents, it's crucial for the integrated user account to possess both read and edit privileges within the ServiceNow console.
It is strictly necessary that the user has the necessary permissions to not only view incidents but also to modify key incident fields such as State and Urgency. Without these elevated editing capabilities, any updates or changes initiated from Lumu will fail to synchronize with the corresponding incidents in ServiceNow, leading to discrepancies and hindering effective incident management.1. You need to add a new category tree to work with Lumu integration. To do so, use the search bar to search for the Tables & Columns menu.
2. In the Tables & Columns window, search for the Incidents table, select it and click on the Edit bu tton.
3. Edit the columns Category, adding the item depicted in the following table:
|
Column |
Label |
Value |
Dependent value |
|
Category |
Lumu |
lumu |
NA |
For more details of how to add the category tree for Lumu, refer to
Add a category or a subcategory
reference.
To maintain incident records synchronized from ServiceNow to Lumu, you need to add a Script Action. This action will trigger after a Lumu incident record is updated. To do so, use the Search bar to search for Script actions. Click on the Script Actions link under the System Policy > Events section.
On the Script Actions window, click on the New button. Fill in the required data according to the following table:
|
Field |
Value |
|
Name |
LumuScript |
|
Event Name |
incident.updated |
|
Condition script |
current.short_description.toLowerCase().includes('lumu') || current.category.toLowerCase() == 'lumu' |
|
Script |
Take the content of the file named servicenow_scripts/script.js in the integration package |
#!/usr/bin/env bash
RED='\033[0;31m'
GREEN='\033[0;32m'
CYAN='\033[0;36m'
YELLOW='\033[1;33m'
BOLD='\033[1m'
RESET='\033[0m'
info() { echo -e "${CYAN}[INFO]${RESET} $*"; }
success() { echo -e "${GREEN}[OK]${RESET} $*"; }
warn() { echo -e "${YELLOW}[WARN]${RESET} $*"; }
error() { echo -e "${RED}[ERROR]${RESET} $*" >&2; }
prompt() { echo -e "${BOLD}${YELLOW}$*${RESET}"; }
IMG=lumutools/servicenow-itsm-ticketing:latest
INTEGRATION_NAME=lumu-servicenow-itsm-ticketing
INTEGRATION_DIR=${HOME}/ServicenowITSM
VOLUME_DATA=${INTEGRATION_DIR}/data:/app/data
VOLUME_CONFIG=${INTEGRATION_DIR}/data/.config.toml:/app/.config.toml:ro
mkdir -p "${INTEGRATION_DIR}/data"
chmod -R o+w "${INTEGRATION_DIR}/data" > /dev/null 2>&1
run_config() {
info "Running configuration script ..."
if docker run --rm -it -v "${INTEGRATION_DIR}/data:/app/data" "${IMG}" bash run_config; then
success "Configuration completed."
else
error "Configuration script failed."; return 1
fi
}
start_integration() {
if [[ ! -f "${INTEGRATION_DIR}/data/.config.toml" ]]; then
error "Please configure the integration first."; return 1
fi
info "Setting up integration '${INTEGRATION_NAME}' ..."
if ! docker container inspect "${INTEGRATION_NAME}" &>/dev/null; then
info "Integration '${INTEGRATION_NAME}' does not exist. Creating ..."
if ! docker create \
-v "${VOLUME_DATA}" \
-v "${VOLUME_CONFIG}" \
--restart unless-stopped \
--log-driver json-file \
--log-opt max-size=30m \
--log-opt max-file=3 \
--name "${INTEGRATION_NAME}" \
"${IMG}" bash run_component; then
error "Failed to create integration."; return 1
fi
else
warn "Integration '${INTEGRATION_NAME}' already exists. Skipping create."
fi
if docker start "${INTEGRATION_NAME}"; then
success "Integration started."
else
error "Failed to start integration."; return 1
fi
}
check_status() {
info "Checking status of integrations ..."
if [[ ! -f "${INTEGRATION_DIR}/data/.status.ndjson" ]]; then
error "Status check failed. Verify if your integration has been deployed."; return 1
fi
if docker run --rm -it -v "${VOLUME_DATA}":ro "${IMG}" bash run_status; then
success "Status check completed."
else
error "Status check failed."; return 1
fi
}
show_logs() {
info "Showing logs for '${INTEGRATION_NAME}' ..."
docker logs --tail 100 -f "${INTEGRATION_NAME}"
}
usage() {
echo ""
prompt " SERVICENOW INCIDENT INTEGRATION MANAGEMENT"
echo -e " ${BOLD}Usage:${RESET} $0 "
echo ""
echo -e " ${CYAN}config${RESET} Run configuration"
echo -e " ${CYAN}start${RESET} Start integration"
echo -e " ${CYAN}status${RESET} Check integration status"
echo -e " ${CYAN}logs${RESET} Show integration logs"
echo ""
}
case "${1}" in
config) run_config ;;
start) start_integration ;;
status) check_status ;;
logs) show_logs ;;
*) usage
[[ -n "${1}" ]] && error "Unknown command '${1}'."
exit 1 ;;
esac
You must fill in the configuration data carefully. If there are any mistakes or missing data, you’ll receive errors during the deployment and runtime of the integration.
We strongly recommend correcting any credential errors before attempting to start the integration using the start command.
If you have run this process before, you may receive warning messages about the existence of components. To ensure you have the latest version of the integration, we recommend removing the existing integration containers before entering the start command.
We kindly request you to, when issuing a support case, attach the integration logs collected using the steps described in this section.
After running the script, it will listen for incident updates on Lumu. After an incident is updated on Lumu, you will see a new incident in the Incidents window in the Service Desk section.
|
ServiceNow state/action |
Lumu state/action |
Comments |
|
New |
Open |
Applies for a new incident detected by Lumu |
|
On hold |
Muted |
|
|
In progress |
Unmute |
If the incident is unmuted, it will be marked as In progress in ServiceNow |
|
Closed |
Closed |
|
These transitions are supported in both directions. Each transition made in one of the services will be reflected in the other. Following, you can find some examples of how the operation between both services works.