The scripts in this repository can be run in Jenkins script console: Manage Jenkins > Script Console. Most work on any Jenkins Enterprise instance, while some are specific to CloudBees Jenkins Operations Center (CJOC).
The Count CJOC JSON script runs on CJOC's script console. The script captures the executor, cloud, and CPU core count attached to the platform. The script dynamically creates a Cluster Operation and executes the operation across all Client Masters connected to CJOC.
NOTE: The master branch version of the
count-cjoc-json.groovyscript is for the 1.7.1+ version of the Operations Center Cluster Operations Plugin. If you are on an older version (1.7.0-) then please use the 1.7.0 branch version of the script here.
Running the script
Log into CloudBees Jenkins Operations Center (CJOC)
Note: if you do not have CJOC's SSO Feature enabled (configured at: Manage Jenkins > Configure Global Security > Client master security, i.e.: if the setting is "Do not enforce security setting on masters"), you need to ensure the user logging into CJOC also has permissions to execute scripts on the Client Masters. Assuming your CJOC and Client Masters use the same Security Realm and thus a user exists between them with the appropriate permissions, the most straight forward way to do so is to add an Authentication Mapping for the username with those permissions:
Click 'Manage Jenkins' on the left-hand panel, followed by the 'Script Console' link
Copy + Paste the script into the console window and click the Run button
Copy + Paste the output into a file and send it to the CloudBees team