Skip to content

Commit

Permalink
Initial release
Browse files Browse the repository at this point in the history
  • Loading branch information
Hipska committed Dec 21, 2023
1 parent dde6fae commit 4c957b2
Show file tree
Hide file tree
Showing 7 changed files with 918 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Collector packaging
on:
push:
tags:
- '*'
jobs:
release:
name: Prepare release
runs-on: ubuntu-latest
steps:
- name: Checkout collector-base
uses: actions/checkout@v4
with:
repository: Combodo/itop-data-collector-base
ref: 1.3.0
sparse-checkout: |
conf
core
data
toolkit
path: ${{ github.repository }}
- name: Checkout current collector
uses: actions/checkout@v4
with:
path: ${{ github.repository }}/collectors
- name: Create package
uses: thedoctor0/[email protected]
with:
filename: ../${{ github.repository }}-${{ github.ref_name }}.zip
path: '*'
directory: ${{ github.repository_owner }}
exclusions: '*.git* */composer.json */exclude.txt */Jenkinsfile'
- name: Create draft release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: ${{ github.repository }}-${{ github.ref_name }}.zip
artifactErrorsFailBuild: true
draft: true
generateReleaseNotes: true
omitNameDuringUpdate: true
omitBodyDuringUpdate: true
omitPrereleaseDuringUpdate: true
updateOnlyUnreleased: true
token: ${{ secrets.ACCESS_TOKEN }}
283 changes: 283 additions & 0 deletions json/SnmpDiscoveryCollector.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,283 @@
{
"name": "$prefix$SNMP Discovery - $uuid$",
"description": "SNMP Discovery v$version$",
"status": "$synchro_status$",
"user_id": "$synchro_user$",
"notify_contact_id": "$contact_to_notify$",
"scope_class": "NetworkDevice",
"database_table_name": "",
"scope_restriction": "",
"full_load_periodicity": "$full_load_interval$",
"reconciliation_policy": "use_attributes",
"action_on_zero": "create",
"action_on_one": "update",
"action_on_multiple": "error",
"delete_policy": "update",
"delete_policy_update": "responds_to_snmp:no",
"delete_policy_retention": "0",
"attribute_list": [
{
"attcode": "applicationsolution_list",
"update": "0",
"reconcile": "0",
"update_policy": "master_unlocked",
"row_separator": "|",
"attribute_separator": ";",
"value_separator": ":",
"attribute_qualifier": "'",
"finalclass": "SynchroAttLinkSet"
},
{
"attcode": "asset_number",
"update": "0",
"reconcile": "0",
"update_policy": "master_unlocked",
"finalclass": "SynchroAttribute"
},
{
"attcode": "brand_id",
"update": "0",
"reconcile": "0",
"update_policy": "master_unlocked",
"reconciliation_attcode": "",
"finalclass": "SynchroAttExtKey"
},
{
"attcode": "business_criticity",
"update": "0",
"reconcile": "0",
"update_policy": "master_unlocked",
"finalclass": "SynchroAttribute"
},
{
"attcode": "clusternetwork_id",
"update": "0",
"reconcile": "0",
"update_policy": "master_unlocked",
"reconciliation_attcode": "",
"finalclass": "SynchroAttExtKey"
},
{
"attcode": "clusternetwork_role",
"update": "0",
"reconcile": "0",
"update_policy": "master_unlocked",
"finalclass": "SynchroAttribute"
},
{
"attcode": "connectablecis_list",
"update": "0",
"reconcile": "0",
"update_policy": "master_unlocked",
"row_separator": "|",
"attribute_separator": ";",
"value_separator": ":",
"attribute_qualifier": "'",
"finalclass": "SynchroAttLinkSet"
},
{
"attcode": "contacts_list",
"update": "0",
"reconcile": "0",
"update_policy": "master_unlocked",
"row_separator": "|",
"attribute_separator": ";",
"value_separator": ":",
"attribute_qualifier": "'",
"finalclass": "SynchroAttLinkSet"
},
{
"attcode": "description",
"update": "0",
"reconcile": "0",
"update_policy": "master_unlocked",
"finalclass": "SynchroAttribute"
},
{
"attcode": "documents_list",
"update": "0",
"reconcile": "0",
"update_policy": "master_unlocked",
"row_separator": "|",
"attribute_separator": ";",
"value_separator": ":",
"attribute_qualifier": "'",
"finalclass": "SynchroAttLinkSet"
},
{
"attcode": "end_of_warranty",
"update": "0",
"reconcile": "0",
"update_policy": "master_unlocked",
"finalclass": "SynchroAttribute"
},
{
"attcode": "iosversion_id",
"update": "0",
"reconcile": "0",
"update_policy": "master_unlocked",
"reconciliation_attcode": "",
"finalclass": "SynchroAttExtKey"
},
{
"attcode": "location_id",
"update": "0",
"reconcile": "0",
"update_policy": "master_unlocked",
"reconciliation_attcode": "",
"finalclass": "SynchroAttExtKey"
},
{
"attcode": "managementip_id",
"update": "1",
"reconcile": "1",
"update_policy": "master_unlocked",
"reconciliation_attcode": "",
"finalclass": "SynchroAttExtKey"
},
{
"attcode": "model_id",
"update": "0",
"reconcile": "0",
"update_policy": "master_unlocked",
"reconciliation_attcode": "",
"finalclass": "SynchroAttExtKey"
},
{
"attcode": "move2production",
"update": "0",
"reconcile": "0",
"update_policy": "master_unlocked",
"finalclass": "SynchroAttribute"
},
{
"attcode": "name",
"update": "1",
"reconcile": "0",
"update_policy": "write_if_empty",
"finalclass": "SynchroAttribute"
},
{
"attcode": "nb_u",
"update": "0",
"reconcile": "0",
"update_policy": "master_unlocked",
"finalclass": "SynchroAttribute"
},
{
"attcode": "networkdevice_list",
"update": "0",
"reconcile": "0",
"update_policy": "master_unlocked",
"row_separator": "|",
"attribute_separator": ";",
"value_separator": ":",
"attribute_qualifier": "'",
"finalclass": "SynchroAttLinkSet"
},
{
"attcode": "networkdevicetype_id",
"update": "1",
"reconcile": "0",
"update_policy": "write_if_empty",
"reconciliation_attcode": "",
"finalclass": "SynchroAttExtKey"
},
{
"attcode": "org_id",
"update": "1",
"reconcile": "1",
"update_policy": "write_if_empty",
"reconciliation_attcode": "",
"finalclass": "SynchroAttExtKey"
},
{
"attcode": "purchase_date",
"update": "0",
"reconcile": "0",
"update_policy": "master_unlocked",
"finalclass": "SynchroAttribute"
},
{
"attcode": "ram",
"update": "0",
"reconcile": "0",
"update_policy": "master_unlocked",
"finalclass": "SynchroAttribute"
},
{
"attcode": "replacement_date",
"update": "0",
"reconcile": "0",
"update_policy": "master_locked",
"finalclass": "SynchroAttribute"
},
{
"attcode": "responds_to_snmp",
"update": "1",
"reconcile": "0",
"update_policy": "master_locked",
"finalclass": "SynchroAttribute"
},
{
"attcode": "serialnumber",
"update": "1",
"reconcile": "0",
"update_policy": "master_unlocked",
"finalclass": "SynchroAttribute"
},
{
"attcode": "snmp_last_discovery",
"update": "1",
"reconcile": "0",
"update_policy": "master_locked",
"finalclass": "SynchroAttribute"
},
{
"attcode": "snmp_sysContact",
"update": "1",
"reconcile": "0",
"update_policy": "master_locked",
"finalclass": "SynchroAttribute"
},
{
"attcode": "snmp_sysDescr",
"update": "1",
"reconcile": "0",
"update_policy": "master_locked",
"finalclass": "SynchroAttribute"
},
{
"attcode": "snmp_sysLocation",
"update": "1",
"reconcile": "0",
"update_policy": "master_locked",
"finalclass": "SynchroAttribute"
},
{
"attcode": "snmp_sysName",
"update": "1",
"reconcile": "0",
"update_policy": "master_locked",
"finalclass": "SynchroAttribute"
},
{
"attcode": "snmpcredentials_id",
"update": "1",
"reconcile": "0",
"update_policy": "master_unlocked",
"reconciliation_attcode": "",
"finalclass": "SynchroAttExtKey"
},
{
"attcode": "status",
"update": "1",
"reconcile": "0",
"update_policy": "write_if_empty",
"finalclass": "SynchroAttribute"
}
],
"user_delete_policy": "administrators",
"url_icon": "",
"url_application": ""
}
13 changes: 13 additions & 0 deletions main.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php
/**
* @copyright Copyright (C) 2023 Super-Visions
* @license http://opensource.org/licenses/AGPL-3.0
* @noinspection PhpUnhandledExceptionInspection
*/

require_once(__DIR__.'/src/SnmpCredentials.class.inc.php');
require_once(__DIR__.'/src/SnmpDiscoveryCollector.class.inc.php');

Orchestrator::AddRequirement('8.1');
Orchestrator::AddRequirement('8.1', 'snmp');
Orchestrator::AddCollector(1, SnmpDiscoveryCollector::class);
11 changes: 11 additions & 0 deletions module.snmp-discovery-collector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php
/**
* @copyright 2023 Super-Visions BVBA
* @license http://opensource.org/licenses/AGPL-3.0
*/

SetupWebPage::AddModule(
__FILE__, // Path to the current file, all other file names are relative to the directory containing this file
'snmp-discovery-collector/1.0.0',
[]
);
38 changes: 38 additions & 0 deletions params.distrib.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Default values for parameters. Do NOT alter this file, use params.local.xml instead -->
<parameters>
<!-- IP Discovery Application UUID -->
<discovery_application_uuid>0123-4567-89AB-CDEF</discovery_application_uuid>

<!-- specify a matching system OID for which serial number detection mechanism to use -->
<serial_detection type="array">
<item>
<!-- HUAWEI-MIB::hwProducts -->
<system_oid_match>.1.3.6.1.4.1.2011.2</system_oid_match>
<!-- ENTITY-MIB::entPhysicalSerialNum -->
<serial_oid>.1.3.6.1.2.1.47.1.1.1.1.11</serial_oid>
<!-- get|getNextNonEmpty|getNextValidMAC -->
<method>getNextNonEmpty</method>
<use_as_serialnumber>yes</use_as_serialnumber>
</item>
<item>
<!-- Match all other systems -->
<system_oid_match>/.*/</system_oid_match>
<!-- IF-MIB::ifPhysAddress -->
<serial_oid>.1.3.6.1.2.1.2.2.1.6</serial_oid>
<!-- get|getNextNonEmpty|getNextValidMAC -->
<method>getNextValidMAC</method>
<use_as_serialnumber>no</use_as_serialnumber>
</item>
</serial_detection>

<!-- default status for newly discovered network devices -->
<default_status>implementation</default_status>

<json_placeholders>
<prefix/>
<uuid>$discovery_application_uuid$</uuid>
<synchro_status>implementation</synchro_status>
<full_load_interval>3600</full_load_interval>
</json_placeholders>
</parameters>
Loading

0 comments on commit 4c957b2

Please sign in to comment.