Working with NFO Service
Working with NFO service depends on OS type it installed on. Below are the methods can be used to start, stop, restart the service or get its status.
Working with NFO service depends on OS type it installed on. Below are the methods that can be used to start, stop, restart the underlying Tomcat service or get its status. To manage the NetFlow Optimizer (NFO) server process directly, you must use REST API requests.
- Linux
- Windows
Managing the Tomcat Service
OS Which Does Not Support systemd
/etc/init.d/tomcat_nfo start|stop|restart|status
Command status reports the state of the service (running or not) and its PID, if it is running.
OS Which Supports systemd
systemctl start|stop|kill|restart|status tomcat_nfo.service
Command status gives a verbose info about the service. To find the line with info in the style of OS which does not support systemd, you may use option -l:
systemctl -l status tomcat_nfo.service
This option prevents from replacing trailing portion of long strings by ellipsis.
Command systemctl provides more features compared to other methods. For details, see the documentation for this command.
Universal Method
service tomcat_nfo start|stop|restart|status
This method works on both types of OS but it is deprecated on OS which supports systemd. Actually, the service command is translated to the above commands depending on OS type.
Managing the NFO Server Process
To start, stop, or restart the NFO server process directly, you must send REST API requests. A sample script, nfo_svr_ctrl.sh
, is provided for convenience:
#!/bin/bash
# NFO host
NFO_HOST=localhost
# NFO port
NFO_PORT=8443
# NFO admin account password
NFO_ADMIN_PASSWORD=changeme
# -----------------------------
# If NFO version >= 2.11.1, the CSRF token is required
# for HTTP request types: POST, PUT, PATCH, and DELETE.
# For exampe:
# -H 'X-XSRF-TOKEN:QQA=' --cookie 'XSRF-TOKEN=A'
# -----------------------------
# loging
LOCATION=$(curl -sid "j_username=admin&j_password=${NFO_ADMIN_PASSWORD}" \
-H 'X-XSRF-TOKEN:QQA=' --cookie 'XSRF-TOKEN=A' \
-c cookies \
--insecure \
"https://${NFO_HOST}:${NFO_PORT}/j_security_check" \
| grep -i "Location:" | awk '{print $2}' | tr -d '\r')
if [ "$LOCATION" != "/" ]; then
echo "Invalid credentials"
exit 1
fi
# start/stop/restart NFO server
curl -X POST \
-H 'Accept:application/json' \
-H 'X-XSRF-TOKEN:QQA=' --cookie 'XSRF-TOKEN=A' \
-b cookies \
--insecure \
"https://${NFO_HOST}:${NFO_PORT}/nfirapi/server/control/$1"
# logout if NFO < 2.11.1
#curl -b cookies --insecure "https://${NFO_HOST}:${NFO_PORT}/logout"
# logout if NFO >= 2.11.1
curl --insecure -X POST -H 'X-XSRF-TOKEN:QQA=' --cookie 'XSRF-TOKEN=A' -b cookies "https://${NFO_HOST}:${NFO_PORT}/logout"
echo ""
# remove cookies file
rm cookies
Usage:
./nfo_svr_ctrl.sh start|stop|restart
This script uses cURL to send the necessary REST API requests to the NFO server. Ensure cURL is installed and the NFO server is accessible.
Managing the Tomcat Service
Below are the methods that can be used to start, stop, restart the Tomcat service (NFOSvc) or get its status. These commands manage the underlying service, not the NFO server process directly.
Command Line (Command Prompt)
To access the service manipulation options, run Command Prompt as an administrator:
- Click the Start menu
- Navigate to Windows System
- Right-click Command Prompt and select "Run as administrator"
- Follow below actions in the opened CMD window
Start or stop NFO Service
net start|stop NFOSvc
Get NFO Service status
sc query NFOSvc | find /N "STATE"
PowerShell
To proceed to service manipulations you need to run PowerShell on behalf administrator. Do the following:
- Click the Start menu
- Expand Windows PowerShell
- Right click Windows PowerShell then expand More
- Click "Run as administrator"
- Follow below actions in the opened PowerShell window
Start NFO Service
Start-Service -Name "NFOSvc"
Stop NFO Service
Stop-Service -Name "NFOSvc"
Restart NFO Service
Restart-Service -Name "NFOSvc"
Get NFO Service status
Get-Service -Name "NFOSvc"
Task Manager
To proceed to service manipulations you need to have local administrator access rights. Do the following:
- Press Ctrl+Shift+Esc
- In the opened window, click Services tab
- Click the header of Name column to order entries by the name of services
- Find name NFOSvc
- A status of the service could be found in Status column
- To proceed the necessary manipulations with the service, right-click the entry found then click the desired action
Services MMC Snap-in
To proceed to service manipulations you need to have local administrator access rights. Do the following:
- Press Win+R
- In the opened textbox, type
services.msc
then press Enter
- Click the header of Name column to order entries by the name of services
- Find name Netflow Optimizer Service
- A status of the service could be found in Status column
- To proceed the necessary manipulations with the service, right-click the entry found then click the desired action
Managing the NFO Server Process
To start, stop, or restart the NFO server process directly, you must send REST API requests. A similar script to the Linux nfo_svr_ctrl.sh can be created for Windows using tools like PowerShell with Invoke-RestMethod to send these API calls.