idevelopment / serviceforce Goto Github PK
View Code? Open in Web Editor NEWLicense: GNU General Public License v3.0
License: GNU General Public License v3.0
A state represents the current operational state of an asset. The state may be status specific (e.g. 'Hardware Problem' is associated only with the Maintenance status), or available for any state (e.g. Running). While a status represents the lifecycle of an asset, the state represents the discrete states within a status. For instance, a machine that is Allocated may be Running or Terminated but in both cases still allocated.
The primary driver for this feature is to support discrete states within Maintenance, so that techs can determine easily why a machine is in maintenance. Additionally being able to hook ticket creation into changing the maintenance state is ideal. For instance if something is having a hardware problem you may want to create a hardware ticket in the datacenter queue, but if the asset is having a network problem you may want to create a ticket in the network queue.
Status | State Label | State Name | Description |
---|---|---|---|
Any | Failed | Failed | A service in this state has encountered a problem and may not be operational. It cannot be started nor stopped. |
Any | New | New | A service in this state is inactive. It does minimal work and consumes minimal resources. |
Any | Running | Running | A service in this state is operational. |
Any | Stopping | Stopping | A service in this state is transitioning to Terminated. |
Any | Terminated | Terminated | A service in this state has completed execution normally. It does minimal work and consumes minimal resources. |
Maintenance | Hardware Problem | Hardware Problem | An asset is experiencing a non-IPMI issue and needs to be examined. It needs investigation. |
Maintenance | Hardware Testing | Hardware Testing | Performing some testing that requires putting the asset into a maintenance state. |
Maintenance | Hardware Upgrade | Hardware Upgrade | An asset is in need or in process of having hardware upgraded. |
Maintenance | Network Problem | Network Problem | An asset is experiencing a network problem that may or may not be hardware related. It needs investigation. |
Maintenance | Relocation | Relocation | An asset is being physically relocated. |
Get all servers and insert hem into the DB true artisan tasks
resources/views/manage.blade.php
@Tjoosten i will create the view, can you add the guzzle magic to the ServersController?
we import the customers from the suitecrm api
<?php
$url = "https://staff.idevelopment.be/suitecrm/service/v4_1/rest.php";
$username = "admin";
$password = "";
//function to make cURL request
function call($method, $parameters, $url)
{
ob_start();
$curl_request = curl_init();
curl_setopt($curl_request, CURLOPT_URL, $url);
curl_setopt($curl_request, CURLOPT_POST, 1);
curl_setopt($curl_request, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
curl_setopt($curl_request, CURLOPT_HEADER, 1);
curl_setopt($curl_request, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl_request, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_request, CURLOPT_FOLLOWLOCATION, 0);
$jsonEncodedData = json_encode($parameters);
$post = array(
"method" => $method,
"input_type" => "JSON",
"response_type" => "JSON",
"rest_data" => $jsonEncodedData
);
curl_setopt($curl_request, CURLOPT_POSTFIELDS, $post);
$result = curl_exec($curl_request);
curl_close($curl_request);
$result = explode("\r\n\r\n", $result, 2);
$response = json_decode($result[1]);
ob_end_flush();
return $response;
}
//login -----------------------------------------
$login_parameters = array(
"user_auth" => array(
"user_name" => $username,
"password" => md5($password),
"version" => "1"
),
"application_name" => "RestTest",
"name_value_list" => array(),
);
$login_result = call("login", $login_parameters, $url);
/*
echo "<pre>";
print_r($login_result);
echo "</pre>";
*/
//get session id
$session_id = $login_result->id;
//get list of records --------------------------------
$get_entry_list_parameters = array(
//session id
'session' => $session_id,
//The name of the module from which to retrieve records
'module_name' => 'Accounts',
//The SQL WHERE clause without the word "where".
'query' => "",
//The SQL ORDER BY clause without the phrase "order by".
'order_by' => "",
//The record offset from which to start.
'offset' => '0',
/*
A list of link names and the fields to be returned for each link name.
Example: 'link_name_to_fields_array' => array(array('name' => 'email_addresses', 'value' => array('id', 'email_address', 'opt_out', 'primary_address')))
*/
'link_name_to_fields_array' => array(
),
//The maximum number of results to return.
'max_results' => '2',
//To exclude deleted records
'deleted' => '0',
//If only records marked as favorites should be returned.
'Favorites' => false,
);
$get_entry_list_result = call('get_entry_list', $get_entry_list_parameters, $url);
echo '<pre>';
print_r($get_entry_list_result);
echo '</pre>';
?>
When you run for example artisan forge:os
2 times it will save the data twice.
We still need to migrate the network mac addresses to the forge:servers
command
vagrant@homestead:~/serviceforce$ artisan db:seed
Seeded: UsersTableSeeder
Seeded: createCustomers
Seeded: ServiceStatusSeed
[ErrorException]
Undefined variable: table
Name | Type | Description |
---|---|---|
bareMetalId | integer | The identifier of the bare metal resource |
serverName | string | The name of the bare metal server |
serverType | string | The type of the bare metal resource |
reference | string | A reference for the bare metal server |
location | object | An object with location information |
server | object | An object with server information |
network | object | An object with network information |
serverHostingPack | object | An object with pack information |
serviceLevelAgreement | object | An object with SLA information |
DONE: The location object contains the following attributes:
Name | Type | Description |
---|---|---|
site | string | The site where the bare metal server is located |
cabinet | string | The cabinet the bare metal server is located in |
rackspace | string | DEPRICATED |
combinationLock | string | DEPRICATED |
DONE: The serviceLevel Agreement object contains the following attributes:
Name | Type | Description |
---|---|---|
sla | string | Human readable name of the SLA agreement |
pricePerMonth | float | Monthly price of the SLA agreement |
DONE: The server object contains the following attributes:
Name | Type | Description |
---|---|---|
ram | string | The amount of RAM in the bare metal server |
kvm | string | Flag to indicate KVM is available in the bare metal server (Yes/No) |
serverType | string | Type of bare metal server |
processorType | string | Processor type of the bare metal server |
processorSpeed | string | Clock speed of the processor |
numberOfCpus | integer | Number of processors in the bare metal server |
numberOfCores | integer | Number of cores per processor |
hardDisks | string | Amount and size of harddisks (eg: 1x1TB) |
hardwareRaid | string | Flag to indicate the bare metal server is equipped with hardware raid (Yes/No) |
DONE: The network object contains the following attributes:
Name | Type | Description |
---|---|---|
dataPack | string | Human readable name of the datapack |
ipsFreeOfCharge | integer | Amount of IPs you can get with your bare metal server free of charge |
ipsAssigned | integer | Amount of IPs assigned to the bare metal server |
excessIpsPrice | float | Price per IP for extra IPs |
dataPackExcess | object | An object with information about datapack over usage |
macAddresses | array | An array with key mac containing all mac adresses of the bare metal server |
pricePerMonth | float | Monthly price of the datapack |
Done: The dataPackExcess object contains the following attributes:
Name | Type | Description |
---|---|---|
type | string | The datapack type, either bandwidth or datatraffic |
value | float | Price used for overusage calcaction per measurement unit |
unit | string | Measuring unit used for overusage calculation |
DONE: The serverHostingPack object contains the following attributes:
Name | Type | Description |
---|---|---|
reference | string | Reference set for the bare metal server |
bareMetalId | integer | The identifier of the bare metal resource |
serverName | string | The name of the bare metal server |
serverType | string | The type of the bare metal resource |
startDate | date | Bare metal contract start date |
endDate | date | Bare metal contract end date |
contractTerm | string | Applied contract term |
Value | Description | Background |
---|---|---|
Running | Service is running | |
Provisioning | Service is currently being provisioned | info |
Provisioned | Service is provisioned | success |
Cancelled | Service is cancelled | danger |
Suspended | Service is suspended | warning |
Add <div class="container">
and <div class="row">
to the layout view not the section content
Change the static server list to dynamic
route /servers/lookup
view /resources/views/servers/index
Value | Description | Background |
---|---|---|
Active | success | |
Suspended | Suspended due billing or abuse issues | warning |
Terminated | All services are terminated for this account | danger |
Name | Type | Description |
---|---|---|
id | integer | The identifier for the Operating Systems resource |
name | string | The name of the Operating Systems resource |
Broken due merge conflict.
Call the server switch status and output this on the details page.
route: serviceforce.app/servers/details
view: resources/views/servers/details.blade.php
Status | class |
---|---|
open | success |
closed | danger |
To retrieve a list of all Pay-as-you-go instances send a GET request to /v1/payAsYouGo/bareMetals/instances.
The response will be a JSON object with key instances containing purchased Pay-as-you-go servers with the following attributes:
Name | Type | Description |
---|---|---|
bareMetalId | string | The identifier of the Bare Metal resource |
customerNumber | string | Your customer number |
model | integer | The number of the model that you purchased |
pricePerGb | number | Displays the price that is billed per Gb of traffic |
pricePerHour | number | Displays the price that is billed per hour of instance usage |
startedAt | string | String containing the time in which the instance started to run |
destroyedAt | string | (Optional) If the instance is destroyed, shows the time in which was destroyed |
vagrant@homestead:~/serviceforce$ artisan db:seed
Seeded: UsersTableSeeder
Seeded: createCustomers
Seeded: ServiceStatusSeed
Seeded: AssetStatesSeeder
Seeded: CountrySeeder
[ErrorException]
preg_match() expects parameter 2 to be string, array given
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.