Skip to main content

Posts

Showing posts from October, 2014

Fetch Monitoring Data from Item to CSV file.

NOTE : Initial script was taken from http://doc.bonfire-project.eu/R2/monitoring/bonfire_monitoring_data_to_csv.html Location for the Original File : http://doc.bonfire-project.eu/R2/_static/scripts/fetch_items_to_csv.py Have done some minor changes as per my need. This script gets monitoring data from Items from Zabbix server and creates a CSV file. For a range of time given. Time range is given in ‘yyyy-mm-dd hh:mm:ss’ format. For the range we give start datetime and end datetime, if only start datetime is specified then time period will be start datetime to now() Script can do 2 things: Single key data into csv Multiple keys read from a file and creates a single csv, with all the keys (creates a .csv file). Single key data into csv This option will connect to Zabbix and collection a single key monitoring data. CSV file is created with the key_name.csv format. python -s 127.0.0.1 -h host-in-zabbix -u admin -p zabbix -k key-in-zabbix -t1 '2014-10-16 12:00:00

Zabbix Item Creation using OID and Name CSV files.

This script is to create a xml import file from a csv file. We use 2 csv file for this. First is the OID csv file . This OID file will contain all the range of OIDs which can be configured on the device. OID CSV will be similar to the CSV sample given below. Information (Name) configured in those OIDs above, with index . This file contains all the configuration information done on the device. Will give the index of the configured variable. CSV format as below Below is the OID csv file. (We will called it OID CSV File) module_name oid_name oid datatype start end description voip_destination status 1.3.6.1.2.1.2.2.18.0 string 0 1000 some description voip_destination flags 1.3.6.1.2.1.2.2.18.1 string 0 1000 some description voip_destination type 1.3.6.1.2.1.2.2.18.2 string 0 1000 some description Here is the sample csv output for the above file. module_name,oid_name,oid,datatype,start,end,description voip_destination,status,1.3.6.

Zabbix Import File from iReasoning Export CSV.

Module used to generate Zabbix import xml for snmp traps Below are steps to create a Zabbix Import for Traps. These traps are captured from the snmptrap function in Zabbix. Step 1: Select the Alarms from the iReasoning MIB browser and Export them as CSV. This Script expect MIB information to be in CSV format. Export from a iReasoning Browser will generate CSV as below. "Name","Full Name","OID","Type","Access","Indexes","MIB Module","Description" We use this information to create snmptrap items and corresponding Trigger in the XML. Which can be imported directly. Step 2: Below are the details to create the xml file from the CSV create above. python zabbix_snmp_trap_import_from_csv.py example: python zabbix_snmp_trap_import_from_csv.py \ -e export_csv_from_ireasoning_mib_browser.csv \ -n GGSN-1-LONDON -g GGSN-GROUP -i 127.0.0.1 usage: zabbix_snmp_trap_import_fr

Send KPI Data to Zabbix from XML KPI File

Send Zabbix metric by reading from a XML file. This needs package zbxsend from : https://github.com/zubayr/zbxsend Install zbxsend Install xmltodict Create items in zabbix using auto_zabbix_export_generator.py script. Import items to zabbix. Running the script zabbix_send_from_kpi_xml.py to send the data to zabbix server. Zabbix Item Creation Before we send the Data to Zabbix. We need to create Keys (Items) in Zabbix. Use the script called auto_zabbix_export_generator.py . Script can be found the same location as the sender script. This script will create a xml file, which can be imported into the zabbix directly. Below are the usage for the zabbix item xml import generator. To Generate XML Export file for Zabbix from a Properties file. This properties file can be generated from the sender script zabbix_send_from_kpi_xml.py as in the option (1) below. Once created then we can use this file to create specific KPI items import file, for the zabbix server which we

SFTP Data Collector

SFTP Data Collector Easy way to collect files recursively over a sftp server is to connect to the server over scp and do scp -r . Problem was that the device we were connecting to did not support recursive :( over a regEx expression. Example: scp -r ahmed@remote-host:/home/ahmed/*file_123* Was not working. Here is a simple SFTP Data Collector script. This script can be used, if the source device/server is unable to get file recursively. Step in this script: get listing of the files present. select files required from the list using a reg_ex or a pattern. Download select files. Below is the command usage. Usage: usage: sftp_data_collector.py [-h] -sh SRC_HOST_NAME -su SRC_USERNAME (-sp SRC_PASSWORD | -es) -dh DEST_HOST_NAME -du DEST_USERNAME (-dp DEST_PASSWORD | -ed) [-c SRC_DIRECTORY] [-y DEST_DIRECTORY] (-t YYYYMMDD_HH | -p PATTERN_IN_FILE) [