5.2.11.2. ON Analytics scripts
On the ON Analytics, we can find different scripts on the following path:
ls /usr/share/opennac/analytics/scripts
5.2.11.2.1. script_reindex.sh
Description:
This script is used to reindex all the Elasticsearch data index excluding the .kibana, the misc- and the .tasks. We can reset the index template to 1 shard and 0 replicas passing per parameter the word reset.
Execution parameters:
/usr/share/opennac/analytics/scripts/script_reindex.sh [reset]
Example:
/usr/share/opennac/analytics/scripts/script_reindex.sh
/usr/share/opennac/analytics/scripts/script_reindex.sh reset
Note
In ON Analytics with many data, the execution can get to long.
5.2.11.2.2. read_only.sh
Description:
This script unlocks the indexes that are in read only state (when data can’t be injected to them).
Execution parameters:
/usr/share/opennac/analytics/scripts/read_only.sh
Example:
/usr/share/opennac/analytics/scripts/read_only.sh
5.2.11.2.3. read-custom-geoip-database.pl
Description:
Reads the information for a specific IP from the geoip mmdb database.
Execution parameters:
/usr/share/opennac/analytics/scripts/read-custom-geoip-database.pl <IP> <DATABASE_MMDB>
Example:
/usr/share/opennac/analytics/scripts/read-custom-geoip-database.pl 185.12.3.23 custo_geoip_database.mmdb
5.2.11.2.4. elasticsearch_purge_index_curator.sh
Description:
This script deletes the Elasticsearch indexes that are out of date corresponding to the Elasticsearch curator configured.
Execution parameters:
/usr/share/opennac/analytics/scripts/elasticsearch_purge_index_curator.sh
Example:
/usr/share/opennac/analytics/scripts/elasticsearch_purge_index_curator.sh
5.2.11.2.5. elasticsearch_purge_index.sh
Description:
This script deletes the Elasticsearch indexes starting by the oldest until the capacity is under 90%.
Execution parameters:
/usr/share/opennac/analytics/scripts/elasticsearch_purge_index.sh
Example:
/usr/share/opennac/analytics/scripts/elasticsearch_purge_index.sh
5.2.11.2.6. create-custom-geoip-database.pl
Description:
This script creates a geoip database in mmdb format from a CSV file. This database will relate the public IPs with their locations.
Execution parameters:
/usr/share/opennac/analytics/scripts/create-custom-geoip-database.pl [csv file]
CSV file format:
ip_network_range,city_geoname_id,city_name,continent_code,continent_geoname_id,continent_name,country_geoname_id,country_iso_code,country_name,accuracy_radius,latitude,longitude,time_zone,postal_code,,subdivision_1_geoname_id,subdivision_1_iso_code,subdivision_1_name
Example:
/usr/share/opennac/analytics/scripts/create-custom-geoip-database.pl custom_geoip.csv
CSV file example (custom_geoip.csv):
1.0.2.0/23,1814991,,AS,1814991,Asia,1814991,CN,China,1000,34.7732,113.7220,Asia/Shanghai,,1814991,,
1.0.4.0/24,2063523,Perth,OC,2077456,Oceania,2077456,AU,Australia,1000,-31.9474,115.8648,Australia/Perth,6000,2063523,WA,"Western Australia"
5.2.11.2.7. configUpdates.sh
Description:
This script permits configure the credentials for repository and proxy to permit updating the ON Analytics. There are two cases:
Repo: Configure credentials for accessing the repo.
Add: Adding the repo user and password it will configure the opennac.repo file.
Delete: Removes the credentials configured.
Proxy: Configure credentials for accessing the proxy.
Add: Adding the proxy url, user and password it will configure the yum.conf file.
Delete: Removes the credentials configured. The url is needed.
Execution parameters:
/usr/share/opennac/analytics/scripts/configUpdates.sh (--proxy|--repo) (--add|--delete) [OPTIONS]
OPTIONS:
- --repouser
username credentials for repo (asked interactively if absent)
- --repopass
password for repo (asked interactively if absent)
- --proxyurl
Mandatory when configuring proxy: ex: http://10.20.30.100:8080
- --proxyuser
username credentials for proxy (asked interactively if absent: optional)
- --proxypass
password credentials for proxy (asked interactively if absent: optional)
Example:
/usr/share/opennac/analytics/scripts/configUpdates.sh --proxy --add --proxyurl http://10.20.30.100:8080 --proxyuser admin --proxypass adminpass123!
/usr/share/opennac/analytics/scripts/configUpdates.sh --repo --add --repouser admin --repopass adminpass123!
/usr/share/opennac/analytics/scripts/configUpdates.sh --proxy --delete --proxyurl http://10.20.30.100:8080
/usr/share/opennac/analytics/scripts/configUpdates.sh --repo --delete
5.2.11.2.8. analytics_update.sh
Description:
This script updates a specific rpm packets. It also restart the ON Analytics services and stop and disable the ON Aggregator services.
Restarted services ON Analytics:
elasticsearch
kibana
Stopped and disabled services ON Aggregator:
- logstash
nprobe
ntopng
cento
memcached
Execution parameters:
/usr/share/opennac/utils/scripts/core_update.sh <packet>
Example:
/usr/share/opennac/utils/scripts/core_update.sh opennac-analytics-1.2.4-10.14490.el8.src
Note
It only works with local rpm packets
5.2.11.2.9. agg_anly_update.sh
Description:
This script updates a specific rpm packets. It also restart the ON Analytics/ON Aggregator services and stop and disable other services.
Restarted services ON Analytics:
elasticsearch
kibana
logstash
Stopped and disabled services ON Aggregator:
nprobe
ntopng
cento
memcached
Execution parameters:
/usr/share/opennac/utils/scripts/core_update.sh <packet>
Example:
/usr/share/opennac/utils/scripts/core_update.sh opennac-analytics-1.2.4-10.14490.el8.src
Note
It only works with local rpm packets
5.2.11.2.10. aggregator_update.sh
Description:
This script updates a specific rpm packets. It also restart the ON Aggregator services and stop and disable ON Analytics services.
Restarted services ON Analytics:
logstash
Stopped and disabled services ON Aggregator:
elasticsearch
- kibana
nprobe
ntopng
cento
memcached
Execution parameters:
/usr/share/opennac/utils/scripts/core_update.sh <packet>
Example:
/usr/share/opennac/utils/scripts/core_update.sh opennac-analytics-1.2.4-10.14490.el8.src
Note
It only works with local rpm packets
5.2.11.2.11. convertFile.sh
Description:
This script dumps the file /usr/share/opennac/analytics/kibana/kibana7.17.6-kibana-data.json with all the kibana objects to Elasticsearch. It also manage the Elasticsearch mappings, reindexing the non daily indexes.
Warning
Reindexing can take time if the index size is large.
Execution parameters:
/usr/share/opennac/utils/scripts/convertFile.sh <IP>
Note
If no IP is entered, it will take localhost as default.
Example:
/usr/share/opennac/utils/scripts/convertFile.sh
/usr/share/opennac/utils/scripts/convertFile.sh 10.250.102.107
5.2.11.2.12. elk8_update.sh
Description:
This script can update or migrate Elasticsearch and Kibana data. They do the following:
migrate: is used for migrating to ELK 7.17.6. The -s flag is required, and the -d is optional.
update: is used for updating mappings and dashboards in ELK 7.17.6. The -d flag is optional.
Warning
It can take time due to the convertFile.sh execution.
Execution parameters:
/usr/share/opennac/utils/scripts/elk8_update.sh -o (update|migrate) [OPTIONS]
OPTIONS:
- -o
executes this script option. There are two options: migrate and update.
- -s
define the source of the migration. It corresponds to an older ELK 7.17.6 version.
- -d
define the destination of the migration or the server to update. By default its value is “localhost”
- -h
give this help list
Example:
/usr/share/opennac/utils/scripts/elk8_update.sh -o update
/usr/share/opennac/utils/scripts/elk8_update.sh -o update -d 10.10.250.10
/usr/share/opennac/utils/scripts/elk8_update.sh -o migrate -s 10.10.250.9 -d 10.10.250.10