How to Install & Enable Plugins in OCSng

What are OCS Plugins?:

     OCS-Plugins are extra features, offered for free that are built by companies or developers that can add new or enhanced features to OCSng. These plugins span across a wide range of categories and improvement sets. Some of my favorite ones, would include Uptime, Windows Users, and the Shared Folders plugins. Each one of these plugins opens up a whole new way to use OCSng for both digital and physical inventory needs. 

Goal of this Article:?

     In this article, my goal is to go over how to install & enable plugins in OCSng.  This will be a very basic configuration as just to give you a proof of concept. To learn more about OCS plugins please check back later, as I plan on making a lot more articles on the ins and outs of OCS plugins and their management. 

  • Please Note:
    • I take a few extra steps when it comes to installing plugins, as I found this to be the best way for keeping track of them.

Initial Setup:

     To start you will need to open an ssh session to your CentOS 7 machine, if you are on windows you can use putty to achieve this. Once you are logged into your system run the following commands:

mkdir OCS-Plugins

Command Explanation
mkdir is a command to “Make A Directory”

cd OCS-Plugins

Command Explanation
cd is a command to “Change Directory”

     The reason we are creating an OCS folder for plugins, is because this will give you a place to stage and organize your OCS plugins later on.

Download Plugins:

     Open up a web browser and head to OCS’s plugin site. Once you are on the website, search for a plugin that you would like to install and copy the web address. In this example I will be installing the popular “Uptime” plugin created by Guillaume PRIOU & Gilles DUBOIS.

     Once you have copied the plugins web address, head back over to your SSH session and run the following commands.

mkdir Uptime

Command Explanation
mkdir is a command to “Make A Directory”

cd Uptime
Command Explanation
cd is a command to “Change Directory”
wget https://github.com/PluginsOCSInventory-NG/uptime/releases/download/1.0/uptime.zip

Command Explanation

  • wget
    • This command tells the system to download a package from a web address

Install Plugins:

     Now that you have the plugin downloaded in a zip format, you will need to copy that zipped folder to OCS’s plugin directory.

cp -R uptime.zip /usr/share/ocsinventory-reports/ocsreports/download/

Command Explanation

  • CP
    • CP means to copy files or folders
      • -R means to recursively copy files and folders

     Now before you install this plugin, we need to make a temp change, to SELinux so that this plugin can install correctly. In the next step we will temporary set SELinux into a permissive state. When enforcing, SELinux will block the “mkdir” command to the ocsinventory folder and the plugin will not install correctly . Since you wont be installing plugins a lot it makes more sense to temporally bypass SELinux rather then setup a special rule and then never use it again. 

setenforce 0

Command Explanation

  • setenforce
    • setenforce is an selinux modification tool
      • “0” means to put SELinux into a permissive state. This does not require a reboot to take into affect.
sestatus

sestatus results

  • SELinux status: enabled
  • SELinuxfs mount: /sys/fs/selinux
  • SELinux root directory: /etc/selinux
  • Loaded policy name: targeted
  • Current mode: permissive
  • Mode from config file: enforcing
  • Policy MLS status: enabled
  • Policy deny_unknown status: allowed
  • Max kernel policy version: 31

     In a web browser go to your OCS site, and select the “Plugins” drop down and choose “Plugins Manager”. You will now see “uptime” as a plugin that you can install. Select the “Install” option to the right, and once the page refreshes, you will now see the “uptime” plugin in the table below. 

Windows Agent Usage:

     Now that you have installed and setup the plugin on the server, you will need to make a change to your clients “plugin” folder. Rather you need to add a “.vbs” file to the agent, so that it can gather the information from the machine it is on and send it back to the server for consolidation.

     To do this you will need to extract the contents of the .zip file you downloaded. This can be accomplished a lot of ways but the easiest for some would be downloading the plugin on a windows machines and extracting the folder like you normal would. Inside  you will see an “agent” folder which contains a windows subfolder. Click into the windows folder and copy the “uptime.vbs” file.

     After you copy “uptime.vbs” path out to the following directory and paste the file into it.

C:\Program Files (x86)\OCS Inventory Agent\Plugins

     That’s it, from here you can wait for the agent to naturally report or you can right-click the OCS icon in windows and choose to run now. Once the agent reports in you can select the computer in the OCS interface and head into the “Miscellaneous” section on the right hand column.

Don’t Forget:

Once you have verified that all the plugins you want, are installed and working correctly go ahead and set SELinux back to enforcing mode.

setenforce 1

Command Explanation

  • setenforce
    • setenforce is an selinux modification tool
      • “0” means to put SELinux into a permissive state. This does not require a reboot to take into affect.

sestatus results

  • SELinux status: enabled
  • SELinuxfs mount: /sys/fs/selinux
  • SELinux root directory: /etc/selinux
  • Loaded policy name: targeted
  • Current mode: enforcing
  • Mode from config file: enforcing
  • Policy MLS status: enabled
  • Policy deny_unknown status: allowed
  • Max kernel policy version: 31

Thoughts?:

     Thank you for taking the time to read this article, I hope that it was helpful in some way to you. If you noticed anything wrong or have a better way of doing this please don’t hesitate to comment below or send me a email. Thank you!


Celerium.Org Logo


 

Leave a Reply