Code Monkey home page Code Monkey logo

rt-server-client's Introduction

RT-server-client

pipeline

UPDATE:

According to new version 0.3.0 there are few breaking changes. Be aware when upgrading.

CHANGELOG 0.3.0:

  • Removed Python 2.7 support, Python 3.x only is supported
  • Big redesign in SW installation. Use setup.py or pip to install
  • --init option for initializing custom Attributes in racktables
  • split code into few different classes

Description

This is server discovery script for Racktables project. It discover system, import or update infromation into racktables database

Script support following infromation

  • hostname
  • transfer comment field to server motd (message of the day)
  • commend-edit utility for editing comments on racktables directly from server
  • service tag
  • supermicro exeption for service tag (my supermicro servers has all same ST and Expres ST. I don't know why)
  • for Dell servers: get warranty and support information from Dell website based on server ST.
  • Physical and logical interfaces (eth,bond,bridges,venet and veth)
  • IPv4 and IPv6 IP addresses, import and update in database
  • Dell iDrac IP address (require Dell-OMSA Installed)
  • OS Dristribution and Release information
  • HW vendor and product type
  • Hypervisor recognition (Xen 4.x)
  • Hypervisor recognition (OpenVZ)
  • Virtual server recognition (Xen 4.x)
  • Virtual server recognition (OpenVZ)
  • Link Virtual server with hypervisor as container in Racktables
  • Racktables logging - when change ip addresses or virtual link with hypervisor
  • Interface Connection (LLDPD needed for this feature. System automaticly link server interfaces with switch ports in RackTables)

For some description, screenshots and examples visit https://www.cypherpunk.cz/automatic-server-audit-for-racktables-project/

Requirements

Required

  • racktables-api (install with pip >=0.2.7)
  • Python >= 3.5.x
  • lsb-release package(detection of Linux distribution and release)

Optional

  • smbios-utils (HW Vendor, Server model and Service-Tag)
  • if you don't use smbios-utils, script generate random servicetag in /etc
  • LLDPd (information about interface connection with switches and other devices)
  • Dell OMSA (for information about iDRAC configuration)

Installation

Install it as normal python sw using pip or setup.py.

PIP Install

pip install rt-server-client

Manual Install

git clone https://github.com/rvojcik/rt-server-client
cd ./rt-server-client
sudo python ./setup.py install

Configuration

Configuration file have to be located in /etc/rt-server-client/main.conf with content something like this:

[mysqldb]
user=racktables
password=mysecretpass
db=racktables_db
host=192.168.1.1
port=3306

When you have your configuration file you have to run initialization of the project. It requires number of custom attributes in racktables database. Initialization process check if these attributes are available and map them to correct object types.

Just run

    system-info -d --init

Normaly script ends without any output. If something go wrong it returns some output of the error.

Then you can run the system-info manualy, from crontab or timer.

rt-server-client's People

Contributors

bcsmith-fs avatar rvojcik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

rt-server-client's Issues

ToolBox is missing

When running python system-info.py it throws an exception about ToolBox:
Traceback (most recent call last):
File "system-info.py", line 66, in
from ToolBox import net, dell
ImportError: No module named ToolBox
for some reason this package isn't in pip / yum

OS CentOS Linux release 7.2.1511 (Core)
Python version 2.7.5

NameError: name 'init_run' is not defined

Hello, at the time of running the script I get the message:

Traceback (most recent call last):
File "./system-info.py", line 200, in
if init_run == "yes":
NameError: name 'init_run' is not defined

lsb-release not avaible on freebsd

Hi,

I have installed freebsd where racktables is running and i want to use your Automatic server audit for RackTables project but do I need the lab-release ?

base missing in /rt-server-client/lib/Toolbox

Hi there,
your project seems to be a very useful addition to racktables. Unfortunately, i can't get it to work on Ubuntu 16.04 because it can't import something named "base" from the ToolBox folder:

:/opt/rt-server-client$ ./system-info.py
Traceback (most recent call last):
File "./system-info.py", line 66, in
from ToolBox import net, dell, base
ImportError: cannot import name base

:/opt/rt-server-client/lib/ToolBox$ ll
total 20
drwxr-xr-x 4 root root 4096 Mar 15 16:28 ./
drwxr-xr-x 4 root root 4096 Mar 15 16:13 ../
drwxr-xr-x 2 root root 4096 Mar 15 16:26 dell/
-rw-r--r-- 1 root root 191 Mar 15 16:13 init.py
drwxr-xr-x 2 root root 4096 Mar 15 16:13 net/

any advise on that?

best,
Basti

DB Insertion Fails Foreign Key Constraint

[DEBUG] Inserting CPU attribute information
Traceback (most recent call last):
File "./system-info.py", line 419, in
rtobject.InsertAttribute(object_id,server_type_id,rtobject.GetAttributeId("CPUs Logical"),"NULL",cpu_logical_num,hostname)
File "/usr/lib/python2.7/site-packages/rtapi/init.py", line 353, in InsertAttribute
self.db_insert(sql)
File "/usr/lib/python2.7/site-packages/rtapi/init.py", line 77, in db_insert
self.dbresult.execute(sql)
File "/usr/lib64/python2.7/site-packages/MySQLdb/cursors.py", line 205, in execute
self.errorhandler(self, exc, value)
File "/usr/lib64/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
raise errorclass, errorvalue
_mysql_exceptions.IntegrityError: (1452, 'Cannot add or update a child row: a foreign key constraint fails (inventor_rt.AttributeValue, CONSTRAINT AttributeValue-FK-map FOREIGN KEY (object_tid, attr_id) REFERENCES AttributeMap (objtype_id, attr_id))')

RackTables 0.20.11

Script does not update the SW Type for Ubuntu systems

SW Type never is updated on ubuntu servers, I will debug to figure out the issue but I believe it has to do with os_codename as the query rather than os_version. I switch that but get a database duplicate error if the SW Type is set and a constraint error if it does not.

Code optimalization, debug

  • rewrite duplicated peace of codes
  • add debug option
  • check for dependencies and auto disable functions which requires them
  • add option "init attributes" - add option which check for required custom attributes and add them

/opt/server-audit/get-bios-ident.py missing

Hey,

I'm running RackTables 20.14 on CentOS 7.
When running ./system-info.py I get the following (anonymized) output:
Hostname server.domain.de already exist. I'm using service tag: sh: /opt/server-audit/get-bios-ident.py: No such file or directory
I couldn't find any reference to get-bios-ident.py on the internet except in your code here.

Where can I get that?

I get SyntaxError: invalid syntax

Hi,
I get SyntaxError: invalid syntax when i try to run System-info.py
Thank you.

./system-info.py

File "./system-info.py", line 212
elif line.find('lldp.'+interface+'.port.descr') > -1:
^
SyntaxError: invalid syntax

Usage with VM

Hello!

We are using Ubuntu on proxmox virtualization. And now we want to collect information from out infrastructure to racktables with auto-discovery.

When i started system-info, i got error:

# system-info -d [DEBUG] Opening config: /etc/rt-server-client/main.conf [DEBUG] Database connection [host, port, passwd, database, user] = [ maria01, 3306, xxxxxx, racktables, racktables ] [DEBUG] Initializing RT Api object [DEBUG] Device list: ['eth0'] [DEBUG] Processing interface eth0 [DEBUG] IPv4: [['172.10.11.213']] [DEBUG] IPv6: [[]] [DEBUG] Connection: ['', ''] /bin/sh: 1: omreport: not found /bin/sh: 1: ipmitool: not found [DEBUG] Drac IP: [DEBUG] Product name: Standard PC (i440FX + PIIX, 1996) [DEBUG] Service Tag: Not [DEBUG] Vendor: QEMU Traceback (most recent call last): File "/usr/local/bin/system-info", line 142, in <module> server_object.DiscoverAll() File "/usr/local/lib/python3.6/dist-packages/rt_server_client/sysinfo/__init__.py", line 64, in DiscoverAll self.DiscoverSystem() File "/usr/local/lib/python3.6/dist-packages/rt_server_client/sysinfo/__init__.py", line 153, in DiscoverSystem elif vendor == 'QEMU': NameError: name 'vendor' is not defined
What's wrong? There are not omreport and ipmi and can't be.

Problem with first installation

root@test:/opt/test1/test_build# ./system-info.py
Traceback (most recent call last):
File "./system-info.py", line 399, in
rtobject.InsertAttribute(object_id,server_type_id,rtobject.GetAttributeId("CPU Model"),cpu_model_name,"NULL",hostname)
File "./lib/rtapi/init.py", line 203, in InsertAttribute
sql = "SELECT string_value,uint_value FROM AttributeValue WHERE object_id = %d AND object_tid = %d AND attr_id = %d" % (object_id, object_tid, attr_id)
TypeError: %d format: a number is required, not NoneType

I have adjusted the config accordingly, something I am missing?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.