ServiceNow AVP Server Installation Guide

Manish24
Kilo Explorer

We would like to Build AVP Server for Exporting PDF in Servicenow. I have raised case with HI and they suggested to follow the steps as in KB Article https://hi.service-now.com/kb_view.do?sysparm_article=KB0661827. In the article we need to download a 3rd party binaries like PhantomJS & Highcharts to configure AVP server on on-premise servicenow instance. We would like to know if we need to buy highchart developer license to configure this or if there is any other approach.

______________________________________________________________________

ServiceNow AVP Installation Guide



Overview


This document provides instructions for deploying the ServiceNow AVP package.

AVP is an add-on service for rendering charts from the ServiceNow application as PNG and JPEG images. AVP is housed in a Tomcat container, to which the ServiceNow application connects via TCP/IP. This service is available starting with the Eureka release.

Typical audiences for this document include system administrators, database administrators (DBAs), network engineers, architects, and help desk management.

 

AVP Requirements and Infrastructure Considerations


Server Requirements

Deploy 2-3 dedicated AVP servers in your network to ensure availability. These servers can be physical or virtualized, depending on your environment. The recommended architecture is the ServiceNow model for hosted data centers, which deploys multiple AVP servers configured for redundancy with load-balancers. Deploying AVP directly on ServiceNow App servers is not recommended as there would be no redundancy. Also, AVP should not be installed on the same servers with WHTP as there would be TCP port conflicts on 8005 and 8009.

Environmental Considerations

SELinux

If this is enforced, necessary ports could be prevented from opening on start-up. Double-check your environment to make sure that the following ports are enabled:

  • 11000
  • 8009
  • 8005
  • 7777
  • 7778
  • 7779
  • 7780
  • 7781

IPTables

The default behavior in most CentOS and Redhat operating systems, when iptables is active, is to block high TCP ports over 1024 for inbound connections. The AVP application needs TCP port 11000 open for remote inbound connections.

 

AVP Server Configuration


Operating System Dependencies

These instructions have been tested on CentOS 6, so should install identically on RHEL 6 as well. CentOS/RHEL 7 should function the same but testing has been limited.

Install these RPM's on the server housing the AVP rendering server:

  • xorg-x11-font-utils-<version>.rpm
  • msttcore-fonts-installer-<version>.rpm

AVP user account

Create a service account named avp for the AVP process.

Directory Structure

At ServiceNow we strive to keep installation locations standardized. Installing AVP to /glide/avp/ on your AVP server makes troubleshooting easier in the event a support ticket is created for AVP.

To assist in this process, use the following commands to create the base directory structure on your AVP server:

 $ mkdir /glide/avp/ /glide/avp/bin/ /glide/avp/share/ /glide/avp/tmp/ /glide/avp/webapps/ /glide/avp/webapps/highcharts-export-web/

Environment Variable Setup

  1. Create this file on your Linux server:
    /etc/sysconfig/avp
  2. Add this content to the file:
    CATALINA_HOME=/glide/avp/tomcat
    export JAVA_HOME="/glide/avp/java"
    export JAVA_FONTS="/usr/share/fonts/msttcore/"
    JAVA_OPTS="-Xms1024m -Xmx2048m"
  3. Create this file on your Linux server:
    /etc/fonts/local.conf
  4. Add this content to the file:
    <?xml version="1.0"?>
    <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
    <fontconfig>
    <dir>/usr/share/fonts/msttcore</dir>
    </fontconfig>
  5. Execute the following command to build font information cache files:
    # fc-cache -fv

 

Java Configuration and Setup


AVP has been tested with OpenJDK 1.8.0 that installs from YUM repositories on CentOS 6.x.

  • At a minimum you must install the following RPM on the AVP server:
    java-1.8.0-openjdk-headless-<version>.rpm
  • By default, the RPM installation creates softlinks from this directory:
    /usr/lib/jvm/java-1.8.0-openjdk-1.8.0-<ver>.el6_10.x86_64/jre/ to /etc/alternatives/
  • AVP requires /glide/avp/java to be present which is a link to the directory. Create a softlink like this:
    $ ln -s /usr/lib/jvm/java-1.8.0-openjdk-1.8.0-<ver>.el6_10.x86_64 /glide/avp/java

 

HighCharts


Next is the HighCharts component which can be downloaded from GitHub. The necessary file will be named: "highcharts-export-web.war" and can be retrieved from the following location: highcharts-export-web.war

  1. After the highcharts-export-web.war file has been downloaded, extract it to the /glide/avp/webapps/highcharts-export-web/ directory on your AVP server.
    Extracting .war files can be done with the jar command as provided in a Java JDK.

  2. With the file downloaded and located in the /glide/avp/webapps/highcharts-export-web/ directory, extract it with these commands:
    $ cd /glide/avp/webapps/highcharts-export-web/
    $ jar xf highcharts-export-web.war
  3. Modify the app-convert.properties to match the recommended ServiceNow configuration. This configuration file is located here on the file system:
    /glide/avp/webapps/highcharts-export-web/WEB-INF/spring/app-convert.properties
  4. Locate these values:
    exec = /usr/local/bin/phantomjs
    poolSize = 10
    maxWait = 6000
    retentionTime = 60000
  5. Make the following changes:
    exec = /glide/avp/bin/phantomjs
    poolSize = 5
    maxWait = 2000
    retentionTime = 30000

 

PHANTOMJS


  1. Download the PhantomJS component for free from this location: http://phantomjs.org/download.html
  2. Extract the download package to the /glide/avp/share/ directory on your AVP server. This is an example extraction command:
    $ tar -C /glide/avp/share  -jxf  /<file location>/phantomjs-<version>-linux-x86_64.tar.bz2
  3. Verify that the files extracted to the proper location with the following ls command:
    $ ls -l /glide/avp/share/
  4. Ensure that the return value looks similar to this:
    drwxr-xr-x 4 root root 4096 Jan xx  20xx phantomjs-1.9.6-linux-x86_64
  5. Create a softlink to /glide/avp/bin/ for the phantomjs binary with this command:
    $ ln -s /glide/avp/share/phantomjs-1.9.6-linux-x86_64/bin/phantomjs  /glide/avp/bin/phantomjs
  6. Verify the softlink exists with the ls command:
    $ ls -l /glide/avp/bin/
  7. Ensure that the return value resembles this:
    lrwxrwxrwx 1 root root 59 Jan xx xx:xx phantomjs -> /glide/avp/share/phantomjs-1.9.6-linux-x86_64/bin/phantomjs

 

TOMCAT


Tomcat 8.5.23 was built and tested at the time of this knowledge article and performed as expected.

  1. To download a similar version, visit the Apache Tomcat site here: https://tomcat.apache.org/download-80.cgi
  2. Extract the compressed file to the /glide/avp/share/ directory on your AVP server. This is an example extraction command:
    $ tar -C /glide/avp/share -zxf /<file location>/apache-tomcat-<version>.tar.gz
  3. Verify the files extracted to the proper location with the following ls command:
    $ ls -l /glide/avp/share/
  4. Ensure that the return value resembles this:
    drwxr-xr-x 9 root  root  4096 Jan xx xx:xx apache-tomcat-8.5.xx
  5. Create a softlink for Tomcat. The command would look something like this:
    $ ln -s /glide/avp/share/apache-tomcat-8.5.xx  /glide/avp/tomcat
  6. Verify that the softlink exists with the following ls command:
    $ ls -l /glide/avp/tomcat
  7. Ensure that the return value resembles this:
    lrwxrwxrwx 1 root root 37 Jan xx xx:xx /glide/avp/tomcat -> /glide/avp/share/apache-tomcat-8.x.xx
  8. After the Tomcat files have been extracted with softlinks in place, make changes to the server.xml file in the default Tomcat ./conf/ directory.
  9. Open the server.xml file and locate these values:
    <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443"/>
  10. Change the default Connector port tag number and remove redirectPort, as follows:
    <Connector port="11000" protocol="HTTP/1.1" connectionTimeout="20000"/>
  11. Locate these values in the Host name tag:
    <Host name="localhost"  appBase="webapps" unpackWARs="true" autoDeploy="true"/>
  12. Make these changes:
    <Host name="localhost"  appBase="/glide/avp/webapps" unpackWARs="true" autoDeploy="true"/>

 

Final Installation Steps


To start and stop the AVP process, deploy the init control script on the server which houses AVP. Download the control script, avp-ctl-script.tar.gz, and copy it into /etc/init.d/ on the AVP server. When extracted, the file name will be avp. The script must be owned by the root user and must be executable. Additionally, the avp init script supports chkconfig for automated start-up upon server reboot.

This completes the component installation process. Run these two ls commands to show what your current file system layout looks like:

  • $ ls -l /glide/avp/
    	drwxr-xr-x 2 root root  4096 Jan xx xx:xx bin
    	lrwxrwxrwx 1 root root    27 Dec xx xx:xx java -> /etc/alternatives/jre_1.8.0	
    	drwxr-xr-x 4 root root  4096 Jan xx xx:xx share		
    	drwxr-x--- 2 root root  4096 Dec xx xx:xx tmp
    	lrwxrwxrwx 1 root root    37 Jan xx xx:xx tomcat -> /glide/avp/share/apache-tomcat-8.5.23
    	drwxr-xr-x 3 root root  4096 Dec xx xx:xx webapps
  • $ ls -l /glide/avp/*
            lrwxrwxrwx 1 root root    27 Dec xx xx:xx /glide/avp/java -> /etc/alternatives/jre_1.8.0
    	lrwxrwxrwx 1 root root    37 Jan xx xx:xx /glide/avp/tomcat -> /glide/avp/share/apache-tomcat-8.5.x
    	/glide/avp/bin:	
    	lrwxrwxrwx 1 root root    59 Jan xx xx:xx phantomjs -> /glide/avp/share/phantomjs-2.1.1-linux-x86_64/bin/phantomjs
    	/glide/avp/share:
    	drwxr-xr-x 9 root root  4096 Dec xx xx:xx apache-tomcat-8.5.23
    	drwxr-xr-x 4 root root  4096 Jan xx  201x phantomjs-2.1.1-linux-x86_64
    	/glide/avp/tmp:
    	/glide/avp/webapps:
    	drwxr-xr-x 5 root root  4096 Jan xx xx:xx highcharts-export-web

 

From this point, run the chown command to change ownership of all files under /glide/avp/ to be owned by the service account avp:

 $ chown -R avp:avp /glide/avp/

 

Configuring the ServiceNow Application to Access AVP


When the AVP server is running in your environment, configure the ServiceNow application to point to the AVP server. Create a new record in sys_properties table for the glide.chart.avp.host property and set the AVP hostname and TCP port.

After these changes are made, the system is ready to render graphs by performing a Save As to your local client. Note that starting with the Geneva release, you cannot modify this property by yourself.

In this example <AVP Host>:11000 is the hostname and port of the AVP server.

Operating the AVP Process

If you need to start or stop the AVP process, run the appropriate avp control script on your operating system.

  • To stop the AVP service, run:
     # /etc/init.d/avp stop
  • To start the AVP service, run:
     # /etc/init.d/avp start

To verify that the process is running, run either of these commands:

  • $ netstat -tnl: This command displays all the TCP listening ports, as in this example:
     Active Internet connections (only servers)
     Proto Recv-Q Send-Q Local Address               Foreign Address             State      
     tcp        0      0 127.0.0.1:7777              0.0.0.0:*                   LISTEN      
     tcp        0      0 127.0.0.1:7778              0.0.0.0:*                   LISTEN      
     tcp        0      0 127.0.0.1:7779              0.0.0.0:*                   LISTEN      
     tcp        0      0 127.0.0.1:7780              0.0.0.0:*                   LISTEN      
     tcp        0      0 127.0.0.1:7781              0.0.0.0:*                   LISTEN
     tcp        0      0 ::ffff:127.0.0.1:8005       :::*                        LISTEN      
     tcp        0      0 :::8009                     :::*                        LISTEN      
     tcp        0      0 :::11000                    :::*                        LISTEN
    
  • $ ps axf | grep avp: This command returns a list of the processes owned by the avp owner, as in this example:
    avp     1782 pts/0    Sl     0:12 /glide/avp/java/bin/java -Djava.util.logging.config.file=/glide/avp/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager 
    -Djava.endorsed.dirs=/glide/avp/tomcat/endorsed -classpath /glide/avp/tomcat/bin/bootstrap.jar -Dcatalina.base=/glide/avp/tomcat -Dcatalina.home=/glide/avp/tomcat 
    -Djava.io.tmpdir=/glide/avp/tomcat/temp org.apache.catalina.startup.Bootstrap start
     avp     1817 pts/0    Sl     0:00  \_ /glide/avp/bin/phantomjs /glide/avp/tomcat/temp/export859875933552429512/phantomjs/highcharts-convert.js -host 127.0.0.1 -port 7777
     avp     1832 pts/0    Sl     0:00  \_ /glide/avp/bin/phantomjs /glide/avp/tomcat/temp/export859875933552429512/phantomjs/highcharts-convert.js -host 127.0.0.1 -port 7778
     avp     1848 pts/0    Sl     0:00  \_ /glide/avp/bin/phantomjs /glide/avp/tomcat/temp/export859875933552429512/phantomjs/highcharts-convert.js -host 127.0.0.1 -port 7779
     avp     1863 pts/0    Sl     0:00  \_ /glide/avp/bin/phantomjs /glide/avp/tomcat/temp/export859875933552429512/phantomjs/highcharts-convert.js -host 127.0.0.1 -port 7780
     avp     1878 pts/0    Sl     0:00  \_ /glide/avp/bin/phantomjs /glide/avp/tomcat/temp/export859875933552429512/phantomjs/highcharts-convert.js -host 127.0.0.1 -port 7781
    

 

Troubleshooting


If you have any issues saving the graphs, you can troubleshoot the connection to the AVP server by using a simple connectivity test using the curl command on the Linux application server, as shown in the following example:

# curl http://<AVP Host>:11000 ; echo $?
Should return a "0"

If you do not have curl on your Linux application server, use the Linux binary telnet from the application server to reach the AVP host for testing purposes, as shown in the following example:

# telnet <AVP Host> 11000

The results should look like this:

Trying <AVP Host>...
 Connected to <AVP Host>.
 Escape character is '^]'.

If issues still persist, open an incident with Customer Support on the Hi system at https://hi.service-now.com.

0 REPLIES 0