Skip to content

Commit

Permalink
Improve procedure and scripts to build plugins (#86)
Browse files Browse the repository at this point in the history
* enh(readme): trying to improve the procedure

* fix source path

* enh: added the missing modules
  • Loading branch information
omercier authored Jan 5, 2024
1 parent d6ef20e commit a7ed5d0
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 32 deletions.
41 changes: 13 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ To use this repo, you must have:
* a Windows Server 2K8 or above, with a x64 architecture
* a 64bits version of Strawberry perl (http://strawberryperl.com/). The build env is tested with the version below:

Then you'll have to add `C:\Strawberry` to your **PATH** to be able to run the following commands.

```
C:\Strawberry>perl -v
perl -v
This is perl 5, version 26, subversion 0 (v5.26.0) built for MSWin32-x64-multi-thread
Expand All @@ -30,27 +32,10 @@ this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
```

* perl PAR::Packer module installed. Substitute 'C:\Strawberry' with your own perl installation dir:

```C:\Strawberry>cpan install PAR::Packer```

* Some additionnal perl libs installed
* Some additionnal perl libs must be installed

```
Authen::NTLM
Date::Manip
Email::Send::SMTP::Gmail
HTTP::ProxyPAC
IO::Socket::SSL
JE
JSON::XS
Net::FTPSSL
Net::NTP
Net::SSLeay
Pod::Simple::Search
Tie::RefHash::Weak
Win32::Job
XML::LibXML::SAX
cpan install PAR::Packer PAR::Packer Authen::NTLM Date::Manip Email::Send::SMTP::Gmail HTTP::ProxyPAC IO::Socket::SSL JE JSON::XS Net::FTPSSL Net::NTP Net::SSLeay Pod::Simple::Search Tie::RefHash::Weak Win32::Job XML::LibXML::SAX
```

## How to use it
Expand All @@ -59,12 +44,12 @@ XML::LibXML::SAX

There are a lot of files in this repository, but you just have to know a few to build your own centreon-nsclient flavour.

#### build_centreon_<32/64>.bat
#### build\_centreon\_32.bat and build\_centreon\_64.bat

Those two files allow you to generate a centreon_plugins.exe to be executed on a 32 or 64 bits Windows OS. You can bring your own modifications to the following lines if needed:
Those two files allow you to generate a centreon\_plugins.exe to be executed on a 32 or 64 bits Windows OS. You can bring your own modifications to the following lines if needed:

- ```SET VERSION_PLUGIN=20000101``` # set the version of centreon-plugins, we recommend to follow official centreon_plugins releases (https://github.com/centreon/centreon-plugins/releases)
- ```set PERL_INSTALL_DIR=C:\Strawberry``` # set the path to your Strawberry perl installation dir
- `SET VERSION_PLUGIN=20000101` # set the version of centreon-plugins, we recommend to follow official centreon_plugins releases (https://github.com/centreon/centreon-plugins/releases)
- `set PERL_INSTALL_DIR=C:\Strawberry` # set the path to your Strawberry perl installation dir

If you want to add more plugins, its associated modes and dependencies, you can modify the ```CMD /C %PERL_INSTALL_DIR%\perl\site\bin\pp --lib=centreon-plugins\ ^``` command_line parameters. Only modify by adding of removing lines starting by -M. An extract below shows how we add our WSUS plugin to centreon_plugins.exe binary:

Expand All @@ -76,17 +61,17 @@ If you want to add more plugins, its associated modes and dependencies, you can
-M apps::wsus::local::mode::serverstatistics ^
```

#### builddef-<x64/Win32>.nsi
#### builddef-Win32.nsi and builddef-x64.nsi

NullSoft Install Script system file. It will allow you to define some properties of your installer.

The three lines you may want to modify are:

```!define PRODUCT_VERSION "0.5.2.41"``` # Set the NSClient++ version, in this repository we are using 0.5.2.41, do not modify unless you know what you're doing
`!define PRODUCT_VERSION "0.5.2.41"` # Set the NSClient++ version, in this repository we are using 0.5.2.41, do not modify unless you know what you're doing

```!define PACKAGE_VERSION "20000101"``` # Set the release version, once again it's easier to stick to the official centreon-plugins release
`!define PACKAGE_VERSION "20000101"` # Set the release version, once again it's easier to stick to the official centreon-plugins release

```!define MSI_NSCLIENT "NSCP-0.5.2.41-Win32.msi"``` # If you modified the PRODUCT version, you may want to also tune this line to reflect the associated MSI
`!define MSI_NSCLIENT "NSCP-0.5.2.41-Win32.msi"` # If you modified the PRODUCT version, you may want to also tune this line to reflect the associated MSI

#### resources/nsclient.ini

Expand Down
6 changes: 4 additions & 2 deletions build_centreon_plugins_32.bat
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ COPY /Y %PAR_PACKER_SRC%\myldr\Static.pm %PERL_INSTALL_DIR%\perl\site\lib\PAR\St
CHDIR /d %~dp0
SET PAR_VERBATIM=1

CMD /C %PERL_INSTALL_DIR%\perl\site\bin\pp --lib=centreon-plugins\ ^
-o resources\scripts\win32\centreon\centreon_plugins.exe centreon-plugins\centreon_plugins.pl ^
CMD /C %PERL_INSTALL_DIR%\perl\site\bin\pp --lib=centreon-plugins\src\ ^
-o resources\scripts\win32\centreon\centreon_plugins.exe centreon-plugins\src\centreon_plugins.pl ^
--unicode ^
-X IO::Socket::INET6 ^
--link=%PERL_INSTALL_DIR%\c\bin\libxml2-2_.dll ^
Expand Down Expand Up @@ -213,6 +213,8 @@ CMD /C %PERL_INSTALL_DIR%\perl\site\bin\pp --lib=centreon-plugins\ ^
-M os::windows::local::mode::sessions ^
-M os::windows::local::mode::liststorages ^
-M os::windows::local::mode::updates ^
-M os::windows::local::mode::listcertificates ^
-M os::windows::local::mode::certificates ^
-M storage::dell::compellent::local::plugin ^
-M storage::dell::compellent::local::mode::hbausage ^
-M storage::dell::compellent::local::mode::volumeusage ^
Expand Down
6 changes: 4 additions & 2 deletions build_centreon_plugins_64.bat
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ COPY /Y %PAR_PACKER_SRC%\myldr\Static.pm %PERL_INSTALL_DIR%\perl\site\lib\PAR\St
CHDIR /d %~dp0
SET PAR_VERBATIM=1

CMD /C %PERL_INSTALL_DIR%\perl\site\bin\pp --lib=centreon-plugins\ ^
-o resources\scripts\x64\centreon\centreon_plugins.exe centreon-plugins\centreon_plugins.pl ^
CMD /C %PERL_INSTALL_DIR%\perl\site\bin\pp --lib=centreon-plugins\src\ ^
-o resources\scripts\x64\centreon\centreon_plugins.exe centreon-plugins\src\centreon_plugins.pl ^
--unicode ^
-X IO::Socket::INET6 ^
--link=%PERL_INSTALL_DIR%\c\bin\libxml2-2__.dll ^
Expand Down Expand Up @@ -211,6 +211,8 @@ CMD /C %PERL_INSTALL_DIR%\perl\site\bin\pp --lib=centreon-plugins\ ^
-M os::windows::local::mode::sessions ^
-M os::windows::local::mode::liststorages ^
-M os::windows::local::mode::updates ^
-M os::windows::local::mode::listcertificates ^
-M os::windows::local::mode::certificates ^
-M storage::dell::compellent::local::plugin ^
-M storage::dell::compellent::local::mode::hbausage ^
-M storage::dell::compellent::local::mode::volumeusage ^
Expand Down

0 comments on commit a7ed5d0

Please sign in to comment.