mkdocs
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
apiVersion: backstage.io/v1alpha1
|
||||
kind: Component
|
||||
metadata:
|
||||
name: dev-backstage
|
||||
title: Backstage (dev)
|
||||
description: Backstage instance running in Kubernetes
|
||||
annotations:
|
||||
backstage.io/kubernetes-id: backstage
|
||||
argocd.argoproj.io/ignore-differences: "true"
|
||||
backstage.io/techdocs-ref: dir:.
|
||||
links:
|
||||
- url: https://github.com/AllardKrings/kubernetes/dev/backstage
|
||||
title: backstage-configuratie
|
||||
docs:
|
||||
- url: ./README.md
|
||||
spec:
|
||||
type: service
|
||||
lifecycle: production
|
||||
owner: group:default/allarddcs
|
||||
subcomponentOf: component:default/DEV-cluster
|
||||
techdocs:
|
||||
builder: local
|
||||
@@ -7,12 +7,10 @@ metadata:
|
||||
annotations:
|
||||
backstage.io/kubernetes-id: backstage
|
||||
argocd.argoproj.io/ignore-differences: "true"
|
||||
backstage.io/techdocs-ref: dir:.
|
||||
backstage.io/techdocs-ref: dir:. # points to root
|
||||
links:
|
||||
- url: https://github.com/AllardKrings/kubernetes/dev/backstage
|
||||
- url: https://github.com/AllardKrings/kubernetes
|
||||
title: backstage-configuratie
|
||||
docs:
|
||||
- url: ./README.md
|
||||
spec:
|
||||
type: service
|
||||
lifecycle: production
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
site_name: Backstage Dev
|
||||
repo_url: "https://github.com/AllardKrings/kubernetes"
|
||||
edit_uri: "edit/master/dev/backstage"
|
||||
docs_dir: "." # <-- root folder
|
||||
theme:
|
||||
name: mkdocs
|
||||
plugins:
|
||||
- techdocs-core
|
||||
@@ -1,19 +0,0 @@
|
||||
apiVersion: backstage.io/v1alpha1
|
||||
kind: Component
|
||||
metadata:
|
||||
name: dev-deptrack
|
||||
title: Deptrack (dev)
|
||||
description: Dependency Track instance running in Kubernetes
|
||||
annotations:
|
||||
backstage.io/kubernetes-label-selector: "app=deptrack-frontend"
|
||||
links:
|
||||
- url: https://github.com/AllardKrings/kubernetes/dev/deptrackback
|
||||
title: deptrack-configuration
|
||||
docs:
|
||||
- url: ./README.md
|
||||
spec:
|
||||
type: service
|
||||
lifecycle: production
|
||||
owner: group:default/allarddcs
|
||||
subcomponentOf: component:default/DEV-cluster
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
sudo microk8s kubectl exec itop-66c56dd4bd-bb2t6 -- chown www-data:www-data /var/www/html/conf
|
||||
exec my-itop /install-toolkit.sh
|
||||
exec my-itop conf-w
|
||||
exec my-itop conf-ro
|
||||
@@ -1,19 +0,0 @@
|
||||
apiVersion: backstage.io/v1alpha1
|
||||
kind: Component
|
||||
metadata:
|
||||
name: dev-itop
|
||||
title: Itop (dev)
|
||||
description: Harbor instance running in Kubernetes
|
||||
annotations:
|
||||
backstage.io/kubernetes-label-selector: "app=itop"
|
||||
links:
|
||||
- url: https://github.com/AllardKrings/kubernetes/dev/itop
|
||||
title: itop-configuration
|
||||
docs:
|
||||
- url: ./README.md
|
||||
spec:
|
||||
type: service
|
||||
lifecycle: production
|
||||
owner: group:default/allarddcs
|
||||
subcomponentOf: component:default/DEV-cluster
|
||||
|
||||
@@ -2,15 +2,14 @@
|
||||
##################################################################################
|
||||
# #
|
||||
# Example script for creating a UserRequest ticket via the REST/JSON webservices #
|
||||
# #
|
||||
##################################################################################
|
||||
|
||||
# iTop location and credentials, change them to suit your iTop installation
|
||||
ITOP_URL="https://itop.alldcs.nl"
|
||||
ITOP_USER="tekton"
|
||||
ITOP_PWD="Itop01@@@"
|
||||
ORGANIZATION="0002"
|
||||
TITLE="Change registration"
|
||||
##################################################################################
|
||||
ITOP_URL="https://itop-dev.allarddcs.nl"
|
||||
ITOP_USER="admin"
|
||||
ITOP_PWD="Itop01@"
|
||||
ORGANIZATION="0001"
|
||||
TITLE="UserRequest"
|
||||
DESCRIPTION="Container created"
|
||||
CALLER="0001"
|
||||
COMMENT="commentaar"
|
||||
@@ -21,8 +20,8 @@ RESULT=`wget -q --post-data='auth_user='"${ITOP_USER}"'&auth_pwd='"${ITOP_PWD}"'
|
||||
PATTERN='"key":"([0-9])+"'
|
||||
if [[ $RESULT =~ $PATTERN ]]; then
|
||||
echo "Change created successfully"
|
||||
echo $RESULT
|
||||
else
|
||||
echo "ERROR: failed to create change"
|
||||
echo $RESULT
|
||||
exit 1
|
||||
fi
|
||||
@@ -0,0 +1,33 @@
|
||||
apiVersion: batch/v1
|
||||
kind: CronJob
|
||||
metadata:
|
||||
name: itop-cron
|
||||
namespace: itop
|
||||
spec:
|
||||
schedule: "*/1 * * * *" # every minute (recommended by Combodo)
|
||||
successfulJobsHistoryLimit: 1
|
||||
failedJobsHistoryLimit: 3
|
||||
jobTemplate:
|
||||
spec:
|
||||
backoffLimit: 1
|
||||
template:
|
||||
spec:
|
||||
restartPolicy: Never
|
||||
containers:
|
||||
- name: itop-cron
|
||||
image: vbkunin/itop:latest
|
||||
imagePullPolicy: IfNotPresent
|
||||
|
||||
command:
|
||||
- php
|
||||
- /var/www/html/webservices/cron.php
|
||||
|
||||
volumeMounts:
|
||||
- name: itop
|
||||
mountPath: /var/www/html/conf
|
||||
subPath: conf
|
||||
|
||||
volumes:
|
||||
- name: itop
|
||||
persistentVolumeClaim:
|
||||
claimName: itop-pvc
|
||||
@@ -1,3 +0,0 @@
|
||||
FROM ubuntu
|
||||
RUN apt update && apt upgrade -y
|
||||
RUN apt install wget -y
|
||||
@@ -1,2 +0,0 @@
|
||||
php webservices/import.php --auth_user=login --auth_pwd=password --csvfile="location.csv"
|
||||
--charset="UTF-8" --no_localize=1 --class="Location" --reconcialiationkeys="name,org_id->name"
|
||||
@@ -1,135 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
class itopApi {
|
||||
|
||||
|
||||
|
||||
// Define API details
|
||||
|
||||
public function __construct() {
|
||||
|
||||
$this->itopApi = array(
|
||||
|
||||
"url" => "http://itop.alldcs.nl",
|
||||
|
||||
"user" => "allard",
|
||||
|
||||
"pass" => "Itop01@"
|
||||
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Get details function
|
||||
|
||||
|
||||
public function get($class,$key) {
|
||||
|
||||
|
||||
$params['operation'] = 'core/get';
|
||||
|
||||
$params['class'] = $class;
|
||||
|
||||
$params['key'] = $key;
|
||||
|
||||
|
||||
$execute = $this->execute($params);
|
||||
|
||||
RETURN $execute;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Apply stimulus to an object
|
||||
|
||||
|
||||
|
||||
public function stimulus($param,$fields) {
|
||||
|
||||
|
||||
$params['operation'] = 'core/apply_stimulus';
|
||||
|
||||
$params['comment'] = $param['comment'];
|
||||
|
||||
$params['stimulus'] = $param['stimulus'];
|
||||
|
||||
$params['class'] = $param['class'];
|
||||
|
||||
$params['key'] = $param['key'];
|
||||
|
||||
$params['fields'] = $fields;
|
||||
|
||||
|
||||
$execute = $this->execute($params);
|
||||
|
||||
|
||||
RETURN $execute;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Hit data to itop server
|
||||
|
||||
private function execute($params) {
|
||||
|
||||
|
||||
$param['auth_user'] = $this->itopApi['user'];
|
||||
|
||||
$param['auth_pwd'] = $this->itopApi['pass'];
|
||||
|
||||
$param['json_data'] = json_encode($params);
|
||||
|
||||
|
||||
$ch = curl_init();
|
||||
|
||||
curl_setopt($ch, CURLOPT_URL, $this->itopApi['url']);
|
||||
|
||||
curl_setopt($ch, CURLOPT_POST, count($param));
|
||||
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($param));
|
||||
|
||||
curl_setopt($ch, CURLOPT_HEADER, false);
|
||||
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
|
||||
$result = json_decode(curl_exec($ch),true);
|
||||
|
||||
curl_close($ch);
|
||||
|
||||
|
||||
RETURN $result; // Returning data on array format
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Testing purpose function
|
||||
|
||||
|
||||
public function test() {
|
||||
|
||||
|
||||
|
||||
echo $this->itopApi['url'];
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"operation":"core/create",
|
||||
"comment":"Synchronization from blah...",
|
||||
"class":"RoutineChange",
|
||||
"fields":
|
||||
{
|
||||
"org_id":"SELECT Organization WHERE name = 'ALLDCS'",
|
||||
"caller_id":{"name":"Krings","first_name":"Allard"},
|
||||
"title":"container",
|
||||
"description":"container gebouwd"
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
curl -X POST -F 'version=1.3' -F 'auth_user=allard' -F 'auth_pwd=Itop01@@@' http://itop.alldcs.nl/webservices/rest.php -F 'json_data=@./change.json'
|
||||
@@ -1,3 +0,0 @@
|
||||
FROM ubuntu
|
||||
RUN apt update && apt upgrade -y
|
||||
RUN apt install wget -y
|
||||
@@ -1,2 +0,0 @@
|
||||
php webservices/import.php --auth_user=login --auth_pwd=password --csvfile="location.csv"
|
||||
--charset="UTF-8" --no_localize=1 --class="Location" --reconcialiationkeys="name,org_id->name"
|
||||
@@ -1,135 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
class itopApi {
|
||||
|
||||
|
||||
|
||||
// Define API details
|
||||
|
||||
public function __construct() {
|
||||
|
||||
$this->itopApi = array(
|
||||
|
||||
"url" => "http://itop.alldcs.nl",
|
||||
|
||||
"user" => "allard",
|
||||
|
||||
"pass" => "Itop01@"
|
||||
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Get details function
|
||||
|
||||
|
||||
public function get($class,$key) {
|
||||
|
||||
|
||||
$params['operation'] = 'core/get';
|
||||
|
||||
$params['class'] = $class;
|
||||
|
||||
$params['key'] = $key;
|
||||
|
||||
|
||||
$execute = $this->execute($params);
|
||||
|
||||
RETURN $execute;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Apply stimulus to an object
|
||||
|
||||
|
||||
|
||||
public function stimulus($param,$fields) {
|
||||
|
||||
|
||||
$params['operation'] = 'core/apply_stimulus';
|
||||
|
||||
$params['comment'] = $param['comment'];
|
||||
|
||||
$params['stimulus'] = $param['stimulus'];
|
||||
|
||||
$params['class'] = $param['class'];
|
||||
|
||||
$params['key'] = $param['key'];
|
||||
|
||||
$params['fields'] = $fields;
|
||||
|
||||
|
||||
$execute = $this->execute($params);
|
||||
|
||||
|
||||
RETURN $execute;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Hit data to itop server
|
||||
|
||||
private function execute($params) {
|
||||
|
||||
|
||||
$param['auth_user'] = $this->itopApi['user'];
|
||||
|
||||
$param['auth_pwd'] = $this->itopApi['pass'];
|
||||
|
||||
$param['json_data'] = json_encode($params);
|
||||
|
||||
|
||||
$ch = curl_init();
|
||||
|
||||
curl_setopt($ch, CURLOPT_URL, $this->itopApi['url']);
|
||||
|
||||
curl_setopt($ch, CURLOPT_POST, count($param));
|
||||
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($param));
|
||||
|
||||
curl_setopt($ch, CURLOPT_HEADER, false);
|
||||
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
|
||||
$result = json_decode(curl_exec($ch),true);
|
||||
|
||||
curl_close($ch);
|
||||
|
||||
|
||||
RETURN $result; // Returning data on array format
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Testing purpose function
|
||||
|
||||
|
||||
public function test() {
|
||||
|
||||
|
||||
|
||||
echo $this->itopApi['url'];
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"operation":"core/create",
|
||||
"comment":"Synchronization from blah...",
|
||||
"class":"RoutineChange",
|
||||
"fields":
|
||||
{
|
||||
"org_id":"SELECT Organization WHERE name = 'ALLDCS'",
|
||||
"caller_id":{"name":"Krings","first_name":"Allard"},
|
||||
"title":"container",
|
||||
"description":"container gebouwd"
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
#!/bin/bash
|
||||
##################################################################################
|
||||
# #
|
||||
# Example script for creating a UserRequest ticket via the REST/JSON webservices #
|
||||
# #
|
||||
##################################################################################
|
||||
|
||||
# iTop location and credentials, change them to suit your iTop installation
|
||||
ITOP_URL="https://itop.alldcs.nl"
|
||||
ITOP_USER="allard"
|
||||
ITOP_PWD="Itop01@@@"
|
||||
ORGANIZATION="0001"
|
||||
TITLE="UserRequest"
|
||||
DESCRIPTION="Container created"
|
||||
CALLER="0001"
|
||||
COMMENT="commentaar"
|
||||
CHANGE="RoutineChange"
|
||||
# Let's create the ticket via the REST/JSON API
|
||||
JSON_DATA='{"operation":"core/create", "class":"'"${CHANGE}"'", "fields": {"org_id":"'"${ORGANIZATION}"'", "title":"'"$TITLE"'", "description":"'"$DESCRIPTION"'"}, "caller": "'"$CALLER"'", "comment": "'"$COMMENT"'"}'
|
||||
RESULT=`wget -q --post-data='auth_user='"${ITOP_USER}"'&auth_pwd='"${ITOP_PWD}"'&json_data='"${JSON_DATA}" --no-check-certificate -O - "${ITOP_URL}/webservices/rest.php?version=1.0"`
|
||||
#PATTERN='"key":"([0-9])+"'
|
||||
#if [[ $RESULT =~ $PATTERN ]]; then
|
||||
# echo "Change created successfully"
|
||||
# else
|
||||
# echo "ERROR: failed to create change"
|
||||
# echo $RESULT
|
||||
#fi
|
||||
@@ -1 +0,0 @@
|
||||
curl -X POST -F 'version=1.3' -F 'auth_user=allard' -F 'auth_pwd=Itop01@@@' http://itop.alldcs.nl/webservices/rest.php -F 'json_data=@./change.json'
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"operation":"core/create",
|
||||
"comment":"Synchronization from blah...",
|
||||
"class":"UserRequest",
|
||||
"output_fields":"id, friendlyname",
|
||||
"fields":
|
||||
{
|
||||
"org_id":"SELECT Organization WHERE name = 'ALLDCS'",
|
||||
"caller_id":{"name":"Krings","first_name":"Allard"},
|
||||
"title":"issue blah",
|
||||
"description":"something happened"
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
Last Name,Status,Organization->Name,Email,Phone,Notification,Function,First Name
|
||||
"Monet","Active","Demo","monet@demo.com","","yes","","Claude"
|
||||
"Flaubert","Active","IT Department","flaubert@it.com","","yes","","Gustave"
|
||||
|
@@ -1,65 +0,0 @@
|
||||
#!/bin/bash
|
||||
##################################################################################
|
||||
# #
|
||||
# Example script for creating a UserRequest ticket via the REST/JSON webservices #
|
||||
# #
|
||||
##################################################################################
|
||||
|
||||
# iTop location and credentials, change them to suit your iTop installation
|
||||
ITOP_URL="https://itop.alldcs.nl"
|
||||
ITOP_USER="allard"
|
||||
ITOP_PWD="Itop01@@@"
|
||||
|
||||
|
||||
# Parameters checking, see below for default values
|
||||
if [ "$1" == "" ]; then
|
||||
echo "Missing parameter 1: host"
|
||||
exit -1
|
||||
else
|
||||
HOST="$1"
|
||||
fi
|
||||
|
||||
if [ "$2" == "" ]; then
|
||||
echo "Missing parameter 2: Service"
|
||||
exit -1
|
||||
else
|
||||
SERVICE="$2"
|
||||
fi
|
||||
|
||||
if [ "$3" == "" ]; then
|
||||
echo "Missing parameter 3: Service Status"
|
||||
exit -1
|
||||
else
|
||||
SERVICE_STATUS="$3"
|
||||
fi
|
||||
|
||||
if [ "$4" == "" ]; then
|
||||
echo "Missing parameter 4: Service State Type"
|
||||
exit -1
|
||||
else
|
||||
SERVICE_STATUS_TYPE="$4"
|
||||
fi
|
||||
|
||||
# Default values, adapt them to your configuration
|
||||
TICKET_CLASS="UserRequest"
|
||||
ORGANIZATION="SELECT Organization JOIN FunctionalCI AS CI ON CI.org_id=Organization.id WHERE CI.name='"${HOST}"'"
|
||||
TITLE="Service Down on $1"
|
||||
DESCRIPTION="The service $SERVICE is in state $SERVICE_STATUS on $HOST"
|
||||
|
||||
# Let's create the ticket via the REST/JSON API
|
||||
if [[ ( "$SERVICE_STATUS" != "OK" ) && ( "$SERVICE_STATUS" != "UP" ) && ( "$SERVICE_STATUS_TYPE" == "HARD" ) ]]; then
|
||||
CIS_LIST='[{"functionalci_id":"SELECT FunctionalCI WHERE name=\"'"$1"'\"", "impact_code": "manual"}]'
|
||||
JSON_DATA='{"operation":"core/create", "class":"'"${TICKET_CLASS}"'", "fields": {"functionalcis_list":'"${CIS_LIST}"', "org_id":"'"${ORGANIZATION}"'", "title":"'"$TITLE"'", "description":"'"$DESCRIPTION"'"}, "comment": "Created by the Monitoring", "output_fields": "id"}'
|
||||
|
||||
RESULT=`wget -q --post-data='auth_user='"${ITOP_USER}"'&auth_pwd='"${ITOP_PWD}"'&json_data='"${JSON_DATA}" --no-check-certificate -O - "${ITOP_URL}/webservices/rest.php?version=1.0"`
|
||||
|
||||
PATTERN='"key":"([0-9])+"'
|
||||
if [[ $RESULT =~ $PATTERN ]]; then
|
||||
echo "Ticket created successfully"
|
||||
else
|
||||
echo "ERROR: failed to create ticket"
|
||||
echo $RESULT
|
||||
fi
|
||||
else
|
||||
echo "Service State Type != HARD, doing nothing"
|
||||
fi
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
HTTP POST itop.alldcs.nl/webservices/rest.php?version=1.3
|
||||
auth_user=Itop_admin
|
||||
auth_pwd=Itop01@
|
||||
json_data=
|
||||
{
|
||||
"operation": "list_operations"
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
include('apifunction.php');
|
||||
|
||||
$itopApi = new itopApi;
|
||||
|
||||
/** GET Function Test **/
|
||||
|
||||
/**
|
||||
|
||||
$api = $itopApi->get("Incident","1620");
|
||||
|
||||
echo "<pre>";
|
||||
|
||||
print_r($api);
|
||||
|
||||
echo "</pre>";
|
||||
|
||||
**/
|
||||
|
||||
|
||||
/** ASSIGN (Stimulus) Function Test **/
|
||||
|
||||
/* $param['comment'] = "Assigned from API";
|
||||
|
||||
$param['stimulus'] = "ev_assign";
|
||||
|
||||
$param['class'] = "Incident";
|
||||
|
||||
$param['key'] = "1620";
|
||||
|
||||
$fields['team_id'] = "39";
|
||||
|
||||
$fields['agent_id'] = "3";
|
||||
|
||||
$api = $itopApi->stimulus($param,$fields);
|
||||
|
||||
echo "<pre>";
|
||||
|
||||
print_r($api);
|
||||
|
||||
echo "</pre>"; */
|
||||
|
||||
|
||||
/** RESOLVE (Stimulus) Function Test **/
|
||||
|
||||
|
||||
|
||||
/* $param['comment'] = "Resolved from API";
|
||||
|
||||
$param['stimulus'] = "ev_resolve";
|
||||
|
||||
$param['class'] = "Incident";
|
||||
|
||||
$param['key'] = "1653";
|
||||
|
||||
$fields['solution'] = "PC Sudah terinstall iReap";
|
||||
|
||||
|
||||
$api = $itopApi->stimulus($param,$fields);
|
||||
|
||||
|
||||
echo "<pre>";
|
||||
|
||||
print_r($api);
|
||||
|
||||
echo "</pre>"; */
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"operation":"core/create",
|
||||
"comment":"Synchronization from blah...",
|
||||
"class":"UserRequest",
|
||||
"output_fields":"id, friendlyname",
|
||||
"fields":
|
||||
{
|
||||
"org_id":"SELECT Organization WHERE name = 'ALLDCS'",
|
||||
"caller_id":{"name":"Krings","first_name":"Allard"},
|
||||
"title":"issue blah",
|
||||
"description":"something happened"
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
Last Name,Status,Organization->Name,Email,Phone,Notification,Function,First Name
|
||||
"Monet","Active","Demo","monet@demo.com","","yes","","Claude"
|
||||
"Flaubert","Active","IT Department","flaubert@it.com","","yes","","Gustave"
|
||||
|
@@ -1,65 +0,0 @@
|
||||
#!/bin/bash
|
||||
##################################################################################
|
||||
# #
|
||||
# Example script for creating a UserRequest ticket via the REST/JSON webservices #
|
||||
# #
|
||||
##################################################################################
|
||||
|
||||
# iTop location and credentials, change them to suit your iTop installation
|
||||
ITOP_URL="https://itop.alldcs.nl"
|
||||
ITOP_USER="allard"
|
||||
ITOP_PWD="Itop01@@@"
|
||||
|
||||
|
||||
# Parameters checking, see below for default values
|
||||
if [ "$1" == "" ]; then
|
||||
echo "Missing parameter 1: host"
|
||||
exit -1
|
||||
else
|
||||
HOST="$1"
|
||||
fi
|
||||
|
||||
if [ "$2" == "" ]; then
|
||||
echo "Missing parameter 2: Service"
|
||||
exit -1
|
||||
else
|
||||
SERVICE="$2"
|
||||
fi
|
||||
|
||||
if [ "$3" == "" ]; then
|
||||
echo "Missing parameter 3: Service Status"
|
||||
exit -1
|
||||
else
|
||||
SERVICE_STATUS="$3"
|
||||
fi
|
||||
|
||||
if [ "$4" == "" ]; then
|
||||
echo "Missing parameter 4: Service State Type"
|
||||
exit -1
|
||||
else
|
||||
SERVICE_STATUS_TYPE="$4"
|
||||
fi
|
||||
|
||||
# Default values, adapt them to your configuration
|
||||
TICKET_CLASS="UserRequest"
|
||||
ORGANIZATION="SELECT Organization JOIN FunctionalCI AS CI ON CI.org_id=Organization.id WHERE CI.name='"${HOST}"'"
|
||||
TITLE="Service Down on $1"
|
||||
DESCRIPTION="The service $SERVICE is in state $SERVICE_STATUS on $HOST"
|
||||
|
||||
# Let's create the ticket via the REST/JSON API
|
||||
if [[ ( "$SERVICE_STATUS" != "OK" ) && ( "$SERVICE_STATUS" != "UP" ) && ( "$SERVICE_STATUS_TYPE" == "HARD" ) ]]; then
|
||||
CIS_LIST='[{"functionalci_id":"SELECT FunctionalCI WHERE name=\"'"$1"'\"", "impact_code": "manual"}]'
|
||||
JSON_DATA='{"operation":"core/create", "class":"'"${TICKET_CLASS}"'", "fields": {"functionalcis_list":'"${CIS_LIST}"', "org_id":"'"${ORGANIZATION}"'", "title":"'"$TITLE"'", "description":"'"$DESCRIPTION"'"}, "comment": "Created by the Monitoring", "output_fields": "id"}'
|
||||
|
||||
RESULT=`wget -q --post-data='auth_user='"${ITOP_USER}"'&auth_pwd='"${ITOP_PWD}"'&json_data='"${JSON_DATA}" --no-check-certificate -O - "${ITOP_URL}/webservices/rest.php?version=1.0"`
|
||||
|
||||
PATTERN='"key":"([0-9])+"'
|
||||
if [[ $RESULT =~ $PATTERN ]]; then
|
||||
echo "Ticket created successfully"
|
||||
else
|
||||
echo "ERROR: failed to create ticket"
|
||||
echo $RESULT
|
||||
fi
|
||||
else
|
||||
echo "Service State Type != HARD, doing nothing"
|
||||
fi
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
HTTP POST itop.alldcs.nl/webservices/rest.php?version=1.3
|
||||
auth_user=Itop_admin
|
||||
auth_pwd=Itop01@
|
||||
json_data=
|
||||
{
|
||||
"operation": "list_operations"
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
include('apifunction.php');
|
||||
|
||||
$itopApi = new itopApi;
|
||||
|
||||
/** GET Function Test **/
|
||||
|
||||
/**
|
||||
|
||||
$api = $itopApi->get("Incident","1620");
|
||||
|
||||
echo "<pre>";
|
||||
|
||||
print_r($api);
|
||||
|
||||
echo "</pre>";
|
||||
|
||||
**/
|
||||
|
||||
|
||||
/** ASSIGN (Stimulus) Function Test **/
|
||||
|
||||
/* $param['comment'] = "Assigned from API";
|
||||
|
||||
$param['stimulus'] = "ev_assign";
|
||||
|
||||
$param['class'] = "Incident";
|
||||
|
||||
$param['key'] = "1620";
|
||||
|
||||
$fields['team_id'] = "39";
|
||||
|
||||
$fields['agent_id'] = "3";
|
||||
|
||||
$api = $itopApi->stimulus($param,$fields);
|
||||
|
||||
echo "<pre>";
|
||||
|
||||
print_r($api);
|
||||
|
||||
echo "</pre>"; */
|
||||
|
||||
|
||||
/** RESOLVE (Stimulus) Function Test **/
|
||||
|
||||
|
||||
|
||||
/* $param['comment'] = "Resolved from API";
|
||||
|
||||
$param['stimulus'] = "ev_resolve";
|
||||
|
||||
$param['class'] = "Incident";
|
||||
|
||||
$param['key'] = "1653";
|
||||
|
||||
$fields['solution'] = "PC Sudah terinstall iReap";
|
||||
|
||||
|
||||
$api = $itopApi->stimulus($param,$fields);
|
||||
|
||||
|
||||
echo "<pre>";
|
||||
|
||||
print_r($api);
|
||||
|
||||
echo "</pre>"; */
|
||||
|
||||
|
||||
|
||||
?>
|
||||
+47
-54
@@ -1,44 +1,8 @@
|
||||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: itop-pv
|
||||
spec:
|
||||
storageClassName: ""
|
||||
capacity:
|
||||
storage: 1Gi
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
persistentVolumeReclaimPolicy: Retain
|
||||
mountOptions:
|
||||
- hard
|
||||
- nfsvers=4.1
|
||||
nfs:
|
||||
server: 192.168.2.110
|
||||
path: /mnt/nfs_share/itop/
|
||||
readOnly: false
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: itop-pvc
|
||||
namespace: itop
|
||||
spec:
|
||||
storageClassName: ""
|
||||
volumeName: itop-pv
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
volumeMode: Filesystem
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: itop
|
||||
namespace: itop
|
||||
labels:
|
||||
app: itop
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
@@ -49,26 +13,55 @@ spec:
|
||||
labels:
|
||||
app: itop
|
||||
spec:
|
||||
securityContext:
|
||||
fsGroup: 33 # ensures www-data can write to volumes
|
||||
containers:
|
||||
- name: itop
|
||||
image: allardkrings/itop:external
|
||||
env:
|
||||
- name: ITOP_DB_HOST
|
||||
value: mariadb.mariadb
|
||||
- name: ITOP_DB_NAME
|
||||
value: itop
|
||||
- name: ITOP_DB_USER
|
||||
value: itop
|
||||
- name: ITOP_DB_PASS
|
||||
value: itop
|
||||
volumeMounts:
|
||||
- mountPath: /var/www/html/conf
|
||||
name: itop
|
||||
subPath: conf
|
||||
- name: itop
|
||||
image: vbkunin/itop:latest
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 80
|
||||
env:
|
||||
- name: ITOP_DB_HOST
|
||||
value: mariadb.mariadb
|
||||
- name: ITOP_DB_NAME
|
||||
value: itop
|
||||
- name: ITOP_DB_USER
|
||||
value: itop
|
||||
- name: ITOP_DB_PASS
|
||||
value: itop
|
||||
volumeMounts:
|
||||
- name: conf
|
||||
mountPath: /var/www/html/conf
|
||||
- name: env-production
|
||||
mountPath: /var/www/html/env-production
|
||||
- name: data
|
||||
mountPath: /var/www/html/data
|
||||
- name: log
|
||||
mountPath: /var/www/html/log
|
||||
- name: extensions
|
||||
mountPath: /var/www/html/extensions
|
||||
- name: apache2-logs
|
||||
mountPath: /var/log/apache2
|
||||
volumes:
|
||||
- name: itop
|
||||
persistentVolumeClaim:
|
||||
claimName: itop-pvc
|
||||
- name: conf
|
||||
persistentVolumeClaim:
|
||||
claimName: itop-conf-pvc
|
||||
- name: env-production
|
||||
persistentVolumeClaim:
|
||||
claimName: itop-env-pvc
|
||||
- name: data
|
||||
persistentVolumeClaim:
|
||||
claimName: itop-data-pvc
|
||||
- name: log
|
||||
persistentVolumeClaim:
|
||||
claimName: itop-log-pvc
|
||||
- name: extensions
|
||||
persistentVolumeClaim:
|
||||
claimName: itop-extensions-pvc
|
||||
- name: apache2-logs
|
||||
persistentVolumeClaim:
|
||||
claimName: itop-apache2-logs-pvc
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
|
||||
Executable
+183
@@ -0,0 +1,183 @@
|
||||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: pv-itop-conf
|
||||
spec:
|
||||
storageClassName: ""
|
||||
capacity:
|
||||
storage: 1Gi
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
persistentVolumeReclaimPolicy: Retain
|
||||
mountOptions:
|
||||
- hard
|
||||
- nfsvers=4.1
|
||||
nfs:
|
||||
server: 192.168.2.110
|
||||
path: /mnt/nfs_share/itop/conf
|
||||
readOnly: false
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: itop-conf-pvc
|
||||
namespace: itop
|
||||
spec:
|
||||
storageClassName: ""
|
||||
volumeName: pv-itop-conf
|
||||
volumeMode: Filesystem
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: pv-itop-env
|
||||
spec:
|
||||
storageClassName: ""
|
||||
capacity:
|
||||
storage: 1Gi
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
nfs:
|
||||
server: 192.168.2.110
|
||||
path: /mnt/nfs_share/itop/env-production
|
||||
readOnly: false
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: itop-env-pvc
|
||||
namespace: itop
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
storageClassName: ""
|
||||
volumeName: pv-itop-env
|
||||
volumeMode: Filesystem
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: pv-itop-data
|
||||
spec:
|
||||
storageClassName: ""
|
||||
capacity:
|
||||
storage: 5Gi
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
nfs:
|
||||
server: 192.168.2.110
|
||||
path: /mnt/nfs_share/itop/data
|
||||
readOnly: false
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: itop-data-pvc
|
||||
namespace: itop
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
resources:
|
||||
requests:
|
||||
storage: 5Gi
|
||||
storageClassName: ""
|
||||
volumeName: pv-itop-data
|
||||
volumeMode: Filesystem
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: pv-itop-log
|
||||
spec:
|
||||
storageClassName: ""
|
||||
capacity:
|
||||
storage: 1Gi
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
nfs:
|
||||
server: 192.168.2.110
|
||||
path: /mnt/nfs_share/itop/log
|
||||
readOnly: false
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: itop-log-pvc
|
||||
namespace: itop
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
storageClassName: ""
|
||||
volumeName: pv-itop-log
|
||||
volumeMode: Filesystem
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: pv-itop-extensions
|
||||
spec:
|
||||
storageClassName: ""
|
||||
capacity:
|
||||
storage: 1Gi
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
nfs:
|
||||
server: 192.168.2.110
|
||||
path: /mnt/nfs_share/itop/extensions
|
||||
readOnly: false
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: itop-extensions-pvc
|
||||
namespace: itop
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
storageClassName: ""
|
||||
volumeName: pv-itop-extensions
|
||||
volumeMode: Filesystem
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: pv-itop-apache2-logs
|
||||
spec:
|
||||
storageClassName: ""
|
||||
capacity:
|
||||
storage: 1Gi
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
nfs:
|
||||
server: 192.168.2.110
|
||||
path: /mnt/nfs_share/itop/apache2-logs
|
||||
readOnly: false
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: itop-apache2-logs-pvc
|
||||
namespace: itop
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
storageClassName: ""
|
||||
volumeName: pv-itop-apache2-logs
|
||||
volumeMode: Filesystem
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
HTTP POST itop.alldcs.nl/webservices/rest.php?version=1.3
|
||||
auth_user=Itop_admin
|
||||
auth_pwd=Itop01@
|
||||
json_data=
|
||||
{
|
||||
"operation": "list_operations"
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
User: root
|
||||
Password: jamesbrown
|
||||
@@ -0,0 +1,88 @@
|
||||
#!/bin/bash
|
||||
set -o pipefail
|
||||
|
||||
ITOP_URL="https://itop-dev.allarddcs.nl"
|
||||
ITOP_USER="tekton"
|
||||
ITOP_PWD="Itop01@@@"
|
||||
ORGANIZATION="0001"
|
||||
TITLE="Containerchange"
|
||||
DESCRIPTION="Container created"
|
||||
CALLER="0001"
|
||||
COMMENT="new version of container olproperties has been pushed"
|
||||
CHANGE="RoutineChange"
|
||||
|
||||
JSON_DATA=$(jq -c <<EOF
|
||||
{
|
||||
"operation": "core/create",
|
||||
"class": "${CHANGE}",
|
||||
"fields": {
|
||||
"org_id": "${ORGANIZATION}",
|
||||
"title": "${TITLE}",
|
||||
"description": "${DESCRIPTION}"
|
||||
},
|
||||
"caller": "${CALLER}",
|
||||
"comment": "${COMMENT}"
|
||||
}
|
||||
EOF
|
||||
)
|
||||
|
||||
echo "=== DEBUG: JSON payload (compact) ==="
|
||||
echo "$JSON_DATA"
|
||||
echo "====================================="
|
||||
|
||||
POST_DATA=$(printf \
|
||||
'auth_user=%s&auth_pwd=%s&json_data=%s' \
|
||||
"$ITOP_USER" \
|
||||
"$ITOP_PWD" \
|
||||
"$(printf '%s' "$JSON_DATA" | jq -sRr @uri)"
|
||||
)
|
||||
|
||||
echo "=== DEBUG: POST data (URL-encoded) ==="
|
||||
echo "$POST_DATA"
|
||||
echo "====================================="
|
||||
|
||||
echo "=== DEBUG: Sending request to iTop ==="
|
||||
|
||||
HTTP_RESPONSE=$(wget \
|
||||
--timeout=15 \
|
||||
--tries=1 \
|
||||
--server-response \
|
||||
--no-check-certificate \
|
||||
--header="Content-Type: application/x-www-form-urlencoded" \
|
||||
--post-data="$POST_DATA" \
|
||||
-O - \
|
||||
"${ITOP_URL}/webservices/rest.php?version=1.0" 2>&1)
|
||||
|
||||
WGET_RC=$?
|
||||
|
||||
echo "=== DEBUG: wget exit code ==="
|
||||
echo "$WGET_RC"
|
||||
|
||||
echo "=== DEBUG: Raw response ==="
|
||||
echo "$HTTP_RESPONSE"
|
||||
echo "==========================="
|
||||
|
||||
JSON_BODY=$(echo "$HTTP_RESPONSE" | sed -n '/^{/,$p')
|
||||
|
||||
if [[ -z "$JSON_BODY" ]]; then
|
||||
echo "ERROR: No JSON returned from iTop"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "=== DEBUG: Parsed JSON ==="
|
||||
echo "$JSON_BODY" | jq .
|
||||
echo "=========================="
|
||||
|
||||
CODE=$(echo "$JSON_BODY" | jq -r '.code // -1')
|
||||
MESSAGE=$(echo "$JSON_BODY" | jq -r '.message // empty')
|
||||
|
||||
if [[ "$CODE" == "0" ]]; then
|
||||
KEY=$(echo "$JSON_BODY" | jq -r '.objects[].key')
|
||||
echo "SUCCESS: Change created, key=$KEY"
|
||||
exit 0
|
||||
else
|
||||
echo "ERROR: iTop rejected the request"
|
||||
echo "Code : $CODE"
|
||||
echo "Message: $MESSAGE"
|
||||
exit 1
|
||||
fi
|
||||
@@ -1,4 +1,4 @@
|
||||
apiVersion: tekton.dev/v1 # or tekton.dev/v1beta1
|
||||
apiVersion: tekton.dev/v1beta1 # or tekton.dev/v1beta1
|
||||
kind: Task
|
||||
metadata:
|
||||
name: register-change
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
ITOP_URL="http://itop.alldcs.nl"
|
||||
ITOP_URL="https://itop-dev.allarddcs.nl"
|
||||
ITOP_USER="tekton"
|
||||
ITOP_PWD="Itop01@@@"
|
||||
ORGANIZATION="0001"
|
||||
|
||||
Reference in New Issue
Block a user