Package: exalead-exporter
exalead_exporterDescriptionPrometheus exporter for Exalead solutionThis exporter collect metrics from Exalead HTTP API.It is a python HTTP server that exposes metrics to http (default port 9271) that can be then scrapped byPrometheus.Several Exalead servers can be polled by adding them to the YAML config file, by adding a host section:Config: (see config.yml)exaleads:-host:host.domainport:9398#   protocol: https#   verify_ssl: false#   timeout: 20#   keep_session: true # default#   default_labels:#     - name: veeam_em#       value: my_veeam_em_server.domain#   proxy:#     url: http://my.proxy.domain:port/#     protocol: httpsweblisten:address:0.0.0.0port:9247logger:level:infofacility:syslogmetrics_file:"metrics/*_metrics.yml"UsageThe exporter may run as a unix command with module installation or as standalone python script without instalation.Usage as a system commandthe easiest way is to install from pip:pip3install--upgradeexalead-exporterthen you can use the entry point create by the installer of the module in /usr/local/bin/exalead_exporter or in [venv]/bin/exalead_exporter for venv context.
The commanded usage is in venv.Usage as a Python ScriptTo use the exporter, few packages needs to be installed. This can be done using:pip3install-rpip_requirements.txtContents of requirements.txtxmltodict==0.12.0tenacity==6.2.0requests>=2.20.0Jinja2==3.0.3urllib3==1.24.2prometheus_client==0.14.1PyYAML>=5.3.1python-dateutil>=2.7.0Consider, to extract the archiv file in /tmp folder; this will generate a folder /tmp/exalead_exporter_[version].create a directory where you want by example /opt/exalead_exporter_[version],move the /tmp/exalead_exporter_[version]/exalead_exporter_package directory to /opt/eeam_exporter_[version]create a command file to launch the exporter in dir /opt/exalead_exporter_[version]vi/opt/exalead_exporter_X.Y.Z/exalead_exporter_cmd#!/usr/libexec/platform-python# -*- coding: utf-8 -*-importre
importsys

fromexalead_exporter.exalead_exporterimportmainif__name__=='__main__':sys.argv[0]=re.sub(r'(-script\.pyw?|\.exe)?$','',sys.argv[0])sys.exit(main())Then edit the conf/config.yml file and add your settings.Try your config by executing the command in try modeexample with the default dumy config file:python3exalead_exporter_cmd-n-v

exalead_exporter[227114]:level=INFO-exalead_exporter0.0.2starting....
exalead_exporter[227114]:level=DEBUG-configis{'exaleads':[{'host':'host.domain','port':9398,'verify_ssl':False,'timeout':20}],'weblisten':{'address':'0.0.0.0','port':9271},'logger':{'level':'info','facility':'syslog'},'metrics_file':'metrics/*.yml'}exalead_exporter[227114]:level=WARNING-[Errno2]Nosuchfileordirectory:'/home/users/d107684/python/exalead-exporter-package/exalead_exporter/metrics'exalead_exporter[227114]:level=ERROR-nometricsfound
exalead_exporter[227114]:level=INFO-exalead_exporter0.0.2stopped.[/home/users/d107684/python/exalead-exporter-package]d107684@dal-v-survdadc$python3cli.py-v-n
exalead_exporter[228511]:level=INFO-exalead_exporter0.0.2starting....
exalead_exporter[228511]:level=DEBUG-configis{'exaleads':[{'host':'host.domain','port':9398,'verify_ssl':False,'timeout':20}],'weblisten':{'address':'0.0.0.0','port':9271},'logger':{'level':'info','facility':'syslog'},'metrics_file':'conf/metrics/*.yml'}exalead_exporter[228511]:level=ERROR-ConnectionException:Hosthost.domain:HTTPConnectionPool(host='host.domain',port=9398):Maxretriesexceededwithurl:/mami/(CausedbyNewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f02ab6be7f0>: Failed to establish a new connection: [Errno -2] Name or service not known',))exalead_exporter[228511]:level=DEBUG-# HELP exalead_up probe success  login status: 0 Down / 1 Upexalead_exporter[228511]:level=DEBUG-# TYPE exalead_up gaugeexalead_exporter[228511]:level=DEBUG-exalead_up0.0
exalead_exporter[228511]:level=INFO-exalead_exporter0.0.2stoppedexporter command line optionsto start the exporter:./exalead_exporter&By default, it will load the file config.yml to perform action.Detail optionsUsage:exalead_exporter[-h][-bBASE_PATH][-cCONFIG_FILE][-fLOGGER.FACILITY][-l{error,warning,info,debug}][-oMETRICS_FILE][-mMETRIC][-n][-tTARGET][-wWEB.LISTEN_ADDRESS][-V][-v]collectorforexalead.

optionalarguments:-h,--helpshowthishelpmessageandexit-bBASE_PATH,--base_pathBASE_PATHsetbasedirectorytofinddefaultfiles.-cCONFIG_FILE,--config_fileCONFIG_FILEpathtoconfigfiles.-fLOGGER.FACILITY,--logger.facilityLOGGER.FACILITYloggerfacility(syslogorfilepath).-l{error,warning,info,debug},--logger.level{error,warning,info,debug}loggerlevel.-oMETRICS_FILE,--metrics_fileMETRICS_FILEcollectthemetricsfromthespecifiedfileinsteadofconfig.-mMETRIC,--metricMETRICcollectonlythespecifiedmetricnamefromthemetrics_file.-n,--dry_modecollectthemetricsthenexit;displayresultstostdout.-tTARGET,--targetTARGETIndry_modecollectmetricsonspecifiedtarget.iDefaultfirstfromconfigfile.-wWEB.LISTEN_ADDRESS,--web.listen-addressWEB.LISTEN_ADDRESSAddresstolistenonforwebinterfaceandtelemetry.-V,--versiondisplayprogramversionandexit..-v,--verboseverbosemode;displaylogmessagetostdout.To test your configuration you can launch the exporter in dry_mode:./exalead_exporter-v-n-thost.domainThis command will try to connect to the 'host.domain' exaleas server with parameters specified in config.yml, expose the collected metrics, and eventually the warning or errors, then exits.Prometheus configSince several exalead servers can be set in the exporter, Prometheus addresses each server by adding a target parameter in the url. The "target" must be the same (lexically) that in exporter config file.-job_name:"exalead"scrape_interval:120sscrape_timeout:60smetrics_path:/metricsstatic_configs:-targets:[exaleadhost.domain]labels:environment:"PROD"#    file_sd_configs:#      - files: [ "/etc/prometheus/exalead_exp/*.yml" ]relabel_configs:-source_labels:[__address__]target_label:__param_target-source_labels:[__param_target]target_label:instance-target_label:__address__replacement:"exalead-exporter-hostname.domain:9247"# The exalead exporter's real hostname.MetricsThe collected metrics are defined in separeted files positionned the folder conf/metrics.
All Values, computations, labels are defined in the metrics files, meaning that the exporter doesn't nothing internally on values. The configuration fully drive how values are rendered.Collected MetricsAll metrics are defined in the configuration file (conf/metrics/*.yml). You can retrive all metric names here. Most of them have help text too.
All metrics are prefixed with "exaled_".filedomainmetricsnonedefaultexalead_up : 0 or 1.define if exalead server can be reached or not.licence_status.ymlgeneral licences elementsprefix: exalead_license_ .licence status,expiration,token usage,licence components activation.(seelicences dashboard)deploymentsStatus.ymlgeneral indexing processesprefix: exalead_process_.status labeled by process name,start_timestamp"backedup",unexpected restart count,loop crashing.(seeprocesses dashboard)connectorStatus.ymlindexationPrefix: exalead_connectors_.gauge by connector name:active_documents,added,deleted,failed deleted,indexed documents,partial update,replaced,totalscan_status,scan_retries,scan_duration,scan_deleted_objects,scan_pushed_objects(seeprocesses dashboard)Extending metricsExported metrics, are defined the YAML config file. The value can use Jinja2 templating language. The format of the configuration is inspired from Ansible task representation.
So a metric configuration file, consists in a list of action to perform.There are five possible actions:url: to collect metrics from HTTP APIset_fact: to assign vlaue to variablesactions: to perform a list of (sub-)actionsmetrics: to define metrics to expose/return to Prometheusdebug: to display debug text to logger.All actions have default "attributes":name: the name of action or metric counter for metrics action.vars: to set vars to global symbols' table.with_items: to loop on current action with a list of items.loop_var: to set the name of the variable that will receive the current value in the loop. Default is 'item'.when: a list of condition (and) that must be check and be true to perform the action.The "attributes" are analyzed in the order specified in previous table; it means that you can't use "item" var (obtained from 'with_items' directive) in the vars section because it is not yet defined when the 'vars' section is evaluated. If you need that feature, you will have to consider 'with_items' in an 'actions' section (see metrics/connectorStatus.yml).actionparameterdescriptionremarkurla string that's representing the entity to collect without '/api'http://host.domain:port/api**[url]**. e.g.: /reports/summary/overviewvar_namethe name of the variable to store the results. Default is '_root' meaning that the resulting JSON object is directly store in symbols table.set_factlist of variable to definevar_name: valuemetricsdefine the list of metrics to exposemetric_prefixa prefix to add to all metric namefinal name will be [metric_prefix]_[metric_name]'a metric'namethe name of the metrichelpthe help message added to the metric (and displayed in grafana explorer)type 'gauge' or 'counter'the type of the prometheus metricvaluethe numeric value itselflabelsa list of name value pairs to qualify the metric