Will Hallam
ServiceNow Employee
ServiceNow Employee

Adding a Custom Plugin to ACC-M

ACC Overview

The Agent Client Collector (ACC) is ServiceNow's extensible server agent.  It provides a way to perform credential-less discovery of Linux and Windows devices (referred to as "ACC-V", for "Visibility").  It also supports a turnkey set of monitoring checks (which return "OK/WARNING/CRITICAL" results based on specified thresholds) and metrics (which return empirical data points) for operating systems and selected applications (referred to as "ACC-M", for "Monitoring").  All code and configuration for these out of the box checks are centrally managed and automatically distributed from your ServiceNow instance based on policies you define.  This allows you to automatically reconfigure monitoring based on CI state or other CMDB information without any home-grown scripting or customization.  

A brief video on ACC-M can be found here.

For customers wishing to tie their own service checks into that built-in monitoring management framework, ACC-M can also leverage plugins written to work with both Sensu and Nagios. 

This article provides an overview on how to increase the capability of your ACC-M configuration by adding Sensu or Nagios plugins.

Add Plugin

Create a new record in table sn_agent_asset (Agent Client Collector->ACC Plugins)

The record must include an attachment in tar.gz format, which contains the plugin code.

  • Create a folder on your local machine
  • Create sub-folder called bin
  • Place scripts and executables in the bin folder
  • In case of Linux/Mac scripts/executables run chmod +x filename on each of those files
  • If you have an allow list defined in your ACC configuration, create a folder called allow_list at thesame level as the bin directory)
  • Place in folder one or more valid JSON files with file extension of .json (e.g. “check-allow-list.json”) to specify allow list commands and their arguments.h
    • NOTE: You can generate the contents for the check allow .json file by clicking “Generate allow-list content” in the Related Links section of the record.
  • find_real_file.png
  • Fig. 1 - example contents of a plugin directory structure
  • find_real_file.png
  • Fig. 2 - example of a check allow list
  • Change directory to the parent folder (the one above the bin folder)
  • On Linux or Mac, run tar -C . -zcvf my-plugin-name.tar.gz *
    • NOTE: the plugin name will be generated based on the archive file name
  • On Windows, use any freely available archiving utility that supports the tar.gz format
  • On Windows, to create a plugin running a script other than batch, ensure that you have in the bin folder the following scripts:
    • A “wrapper” batch script that initiates the run (it will be configured to run on the check command), (for example - 'powershell %~dp0\test.ps1')
    • The relevant script (for example, test.ps1) that will be executed in the batch script

If you have the ACC parameter “verify-plugin-signature” set to its default of “true”, you will need to sign any custom plugins, e.g. https://docs.servicenow.com/bundle/washingtondc-it-operations-management/page/product/agent-client-c...

  •  

NOTE: creating a new record will fail unless the compressed tar file is attached

NOTE: once you create a plugin record, you will only be allowed one attachment and the name will have to match the name of the original attachment

To propagate the plugin to MID servers, check the “Active” box and save the updated record.

find_real_file.pngFig. 3 - creating a new ACC Plugin record

Add Check(s)

For each check which will use the new plugin, create a new record in sn_agent_check_def (Agent Client Collector->Check Definitions).  Reference your newly-created ACC Plugin record in the “Plugins” field.

 

find_real_file.png

Fig. 4 - creating a new Check Definition (cont'd below)

find_real_file.png

Fig. 5 - creating a new Check Definition

To test the check, navigate back to the Check Definition record and select “Test check” in the Related Links section.

find_real_file.png

Fig. 6 - testing a check

To activate your new check(s) on CIs, either create a new ACC Policy or add the new check(s) to an existing one.

find_real_file.png

Fig. 7 - creating/updating policy (cont'd below)

find_real_file.png

Fig. 8 - creating/updating policy

Debugging

To observe/diagnose/debug ACC activity, refer to the agent log file

  • Linux: /var/log/servicenow/agent-client-collector/acc.log
  • Windows: c:\ProgramData\ServiceNow\agent-client-collector\log\acc.log

To adjust the logging level, modify config setting “log-level” in the acc.yml config file

  • Linux: /etc/servicenow/agent-client-collector/acc.yml
  • Windows: c:\ProgramData\ServiceNow\agent-client-collector\config\acc.yml

 

Comments
Rahman3
Tera Expert

How do I install ACC-M into my PDI? I am trying to install the plugin into my PDI but it's telling me that I need to purchase something (sn_metrics_ng) from the Store?

find_real_file.png

 

Andy Lark
Kilo Guru

I have exactly the same issue, I want to investigate and develop in my own PDI but am unable to get store apps onto my PDI.

 

Did this get resolved?

Version history
Last update:
‎07-10-2024 01:45 PM
Updated by:
Contributors