Adicionando host, removendo mudando o nome adicionando e usuário na linha de comando do observium

Nesse artigo vou falar como adicionar host , remover , mudar o nome e adicionando usuário na linha de comando do observium .

Página do projeto . https://www.observium.org/

 

Vamos verificar a resposta de snmp,  caso não obtenha resposta você vai precisar configurar para os passos posteriores.

snmpwalk -v2c -c comunidade servidor-storage
root@cacti:~# snmpwalk -v2c   -c comunidade  servidor-storage|more
iso.3.6.1.2.1.1.1.0 = STRING: "Linux servidor-storage 2.6.32-696.13.2.el6.x86_64 #1 SMP Thu Oct 5 21:22:16 UTC 2017 x86_64"
iso.3.6.1.2.1.1.2.0 = OID: iso.3.6.1.4.1.8072.3.2.10
iso.3.6.1.2.1.1.3.0 = Timeticks: (113975) 0:18:59.75
iso.3.6.1.2.1.1.4.0 = STRING: "root@localhost"
iso.3.6.1.2.1.1.5.0 = STRING: "servidor-storage"
iso.3.6.1.2.1.1.6.0 = STRING: "Unknown"
iso.3.6.1.2.1.1.8.0 = Timeticks: (24) 0:00:00.24
iso.3.6.1.2.1.1.9.1.2.1 = OID: iso.3.6.1.6.3.11.2.3.1.1
iso.3.6.1.2.1.1.9.1.2.2 = OID: iso.3.6.1.6.3.15.2.1.1
iso.3.6.1.2.1.1.9.1.2.3 = OID: iso.3.6.1.6.3.10.3.1.1
iso.3.6.1.2.1.1.9.1.2.4 = OID: iso.3.6.1.6.3.1
iso.3.6.1.2.1.1.9.1.2.5 = OID: iso.3.6.1.2.1.49
iso.3.6.1.2.1.1.9.1.2.6 = OID: iso.3.6.1.2.1.4
iso.3.6.1.2.1.1.9.1.2.7 = OID: iso.3.6.1.2.1.50
iso.3.6.1.2.1.1.9.1.2.8 = OID: iso.3.6.1.6.3.16.2.2.1
iso.3.6.1.2.1.1.9.1.3.1 = STRING: "The MIB for Message Processing and Dispatching."
iso.3.6.1.2.1.1.9.1.3.2 = STRING: "The MIB for Message Processing and Dispatching."
iso.3.6.1.2.1.1.9.1.3.3 = STRING: "The SNMP Management Architecture MIB."
iso.3.6.1.2.1.1.9.1.3.4 = STRING: "The MIB module for SNMPv2 entities"
iso.3.6.1.2.1.1.9.1.3.5 = STRING: "The MIB module for managing TCP implementations"
iso.3.6.1.2.1.1.9.1.3.6 = STRING: "The MIB module for managing IP and ICMP implementations"
iso.3.6.1.2.1.1.9.1.3.7 = STRING: "The MIB module for managing UDP implementations"
iso.3.6.1.2.1.1.9.1.3.8 = STRING: "View-based Access Control Model for SNMP."

Caso obtenha sucesso vamos aos passos seguintes.

Adicionando um host, lembrando que o nome do servidor adicionado deve está disponível no servidor de dns que ele fará a consulta.

A sintaxe  do comando .

root@cacti:~#php /opt/observium/add_device.php 
Observium CE 0.16.9.8118
Add Device(s)


USAGE:
add_device.php <hostname> [community] [v1|v2c] [port] [udp|udp6|tcp|tcp6]
add_device.php <hostname> [any|nanp|anp|ap] [v3] [user] [password] [enckey] [md5|sha] [aes|des] [port] [udp|udp6|tcp|tcp6]
add_device.php <filename>

EXAMPLE:
SNMPv1/2c:                    add_device.php <hostname> [community] [v1|v2c] [port] [udp|udp6|tcp|tcp6]
SNMPv3   :         Defaults : add_device.php <hostname> any v3 [user] [port] [udp|udp6|tcp|tcp6]
           No Auth, No Priv : add_device.php <hostname> nanp v3 [user] [port] [udp|udp6|tcp|tcp6]
              Auth, No Priv : add_device.php <hostname> anp v3 <user> <password> [md5|sha] [port] [udp|udp6|tcp|tcp6]
              Auth,    Priv : add_device.php <hostname> ap v3 <user> <password> <enckey> [md5|sha] [aes|des] [port] [udp|udp6|tcp|tcp6]
FILE     :                    add_device.php <filename>

ADD FROM FILE:
 To add multiple devices, create a file in which each line contains one device with or without options.
 Format for device options, the same as specified in USAGE.

OPTIONS:
 -p                                          Skip icmp echo checks, device added only by SNMP checks

DEBUGGING OPTIONS:
 -d                                          Enable debugging output.
 -dd                                         More verbose debugging output.
 -t                                          Do not add device(s), only test auth options.

Para adicionar o servidor .

php /opt/observium/add_device.php  servidor-storage   comunidade  v2
root@cacti:~#php /opt/observium/add_device.php  servidor-storage   comunidade  v2       
Observium CE 0.16.9.8118
Add Device(s)

Try to add servidor-storage:
Trying v2c community comunidade ...
Now discovering servidor-storage (id = 122)
#####  servidor-storage [122]  #####

 o OS Type              linux
 o OS Group             unix
 o SNMP Version         v2c
 o Last discovery       
 o Last duration         seconds

#####  Module Start: ports  #####

 o Caching OIDs         ifDescr ifAlias ifName ifType ifOperStatus 
 o Caching DB           0 ports
 o Discovering ports     lo(1)[88848] eth0(2)[88849] eth1(3)[88850] eth2(4)[88851] eth3(5)[88852]
+---------+---------+--------+---------+------------------+-------------+---------+
| ifIndex | ifDescr | ifName | ifAlias | ifType           | Oper Status | Ignored |
+---------+---------+--------+---------+------------------+-------------+---------+
| 1       | lo      | lo     | ...     | softwareLoopback | up          | no      |
| 2       | eth0    | eth0   | ...     | ethernetCsmacd   | up          | no      |
| 3       | eth1    | eth1   | ...     | ethernetCsmacd   | down        | no      |
| 4       | eth2    | eth2   | ...     | ethernetCsmacd   | down        | no      |
| 5       | eth3    | eth3   | ...     | ethernetCsmacd   | down        | no      |
+---------+---------+--------+---------+------------------+-------------+---------+


 o Duration             0.6046s

#####  servidor-storage [122] completed discovery modules at 2019-11-20 10:14:41  #####

 o Discovery time       0.624 seconds

#####  servidor-storage [122]  #####

 o OS Type              linux
 o OS Group             unix
 o SNMP Version         v2c
 o Last discovery       
 o Last duration         seconds

#####  Module Start: ipv4-addresses  #####


 o Duration             0.0003s

#####  servidor-storage [122] completed discovery modules at 2019-11-20 10:14:41  #####

 o Discovery time       0.013 seconds

#####  servidor-storage [122]  #####

 o OS Type              linux
 o OS Group             unix
 o SNMP Version         v2c
 o Last discovery       
 o Last duration         seconds

#####  Module Start: ipv6-addresses  #####


 o Duration             0.0003s

#####  servidor-storage [122] completed discovery modules at 2019-11-20 10:14:41  #####

 o Discovery time       0.011 seconds

Added device servidor-storage (122).

Devices success: 1.

Imagem ilustrativa do servidor já no observium.

Renomeando o servidor .

Os dois endereços de dns do host devem existir na tabela de dns do servidor de dns consultado para essa operação.

A sintaxe do comando.

root@cacti:~#php /opt/observium/rename_device.php
Observium CE 0.16.9.8118
Rename Device


USAGE:
rename_device.php <old hostname> <new hostname>

OPTIONS:
 -p                                          Skip icmp echo checks, device renamed only by SNMP checks

DEBUGGING OPTIONS:
 -d                                          Enable debugging output.
 -dd                                         More verbose debugging output.

Invalid arguments!
php /opt/observium/rename_device.php servidor-storage servidor-storage-01
root@cacti:~# php /opt/observium/rename_device.php servidor-storage servidor-storage-01
Observium CE 0.16.9.8118
Rename Device

Host servidor-storage renamed to servidor-storage-01.

Removendo o servidor.

Sintaxe .

root@cacti:~# /opt/observium/delete_device.php 
Observium CE 0.16.9.8118
Remove Device


USAGE:
delete_device.php <hostname> [rrd]

EXAMPLE:
Keep RRDs:   delete_device.php <hostname>
Remove RRDs: delete_device.php <hostname> rrd
php /opt/observium/delete_device.php servidor-storage-01
root@cacti:~# php /opt/observium/delete_device.php servidor-storage-01
Observium CE 0.16.9.8118
Remove Device


 * Deleted interfaces: id=88848 (lo), id=88849 (eth0), id=88850 (eth1), id=88851 (eth2), id=88852 (eth3)
 * Deleted common entity entries linked to device: device
 * Deleted device entries from tables: devices_locations, devices_perftimes, device_graphs, eventlog, hrDevice, mempools, processors, storage, ucd_diskio, devices
 * Deleted device: servidor-storage-01
Device servidor-storage-01 removed.
root@cacti:~# php /opt/observium/delete_device.php servidor-storage-01 rdr
Observium CE 0.16.9.8118
Remove Device

Adicionando usuário .

A sintaxe .

root@cacti:~# php /opt/observium/adduser.php 
Observium CE 0.16.9.8118
Add User


USAGE:
adduser.php <username> <password> <level 1-10> [email]

EXAMPLE:
ADMIN:   adduser.php <username> <password> 10 [email]

USER LEVELS:
  0 - Disabled (This user disabled)
  1 - Normal User (This user has read access to individual entities)
  5 - Global Read (This user has global read access)
  7 - Global Secure Read (This user has global read access with secured info)
  8 - Global Secure Read / Limited Write (This user has secure global read access with scheduled maintenence read/write.)
  10 - Administrator (This user has full administrative access)

php /opt/observium/adduser.php  julio wIjkNHXPlNXtX2PnpXKo 10 julio@meuemail.com

 

Deixe uma resposta

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *