Tsung how to get the controller id - tsung

I know that it is possible to set a id to the controller in tsung using the flag -i, i.e, tsung start -i ID. My question is It is possible retrieve that id in the tsung.xml?

e.g.
<setdynvars sourcetype="eval"
code='fun({Pid,DynVars})->
case string:tokens(atom_to_list(node()),"#") of
["tsung_controller_"++ID,_] -> list_to_integer(ID);
_ -> 0 end end.'>
<var name="controller_id" />
</setdynvars>

Related

How to retrieve Itinerary remarks with GetReservationsRQ Api?

Running the command I¥ command returns:
2 AA1579X 16SEP 5 DFWORD HF1 0625 0846 /DCBA*SDAZXT /E
I have successfully sent a request using GetReservationRQ. Asking for the remarks sections but I am getting the result above which I would expect. (I assumed this is the right section and have tried Itinerary too, see below)
<GetReservationRQ version="1.1.0" xmlns="http://services.sabre.com/sp/updatereservation/v1_1">
<Profile>
<UniqueID id="......."/>
</Profile>
<SubjectAreas>
<SubjectArea>REMARKS</SubjectArea>
</SubjectAreas>
<ReturnOptions>
<ViewName>Default</ViewName>
<ResponseFormat>STL</ResponseFormat>
</ReturnOptions>
</GetReservationRQ>
Which returns 2 remarks as part of the response:
<Remarks>
<Remark id="44" index="1" type="HS">
<RemarkLines>
<RemarkLine>
<Text>POSSIBLE DUPE BOOKING. SEE PNR JZXWEI JBVFYC HUSTLM</Text>
</RemarkLine>
</RemarkLines>
</Remark>
<Remark id="45" index="2" type="HS">
<RemarkLines>
<RemarkLine>
<Text>POSSIBLE DUPE BOOKING. SEE PNR KDCFKD KQLLXF</Text>
</RemarkLine>
</RemarkLines>
</Remark>
</Remarks>
However as you can see they are not the same remark as when I run the command I¥. What am I doing wrong?
Here are links to the sabre documentation:
https://developer.sabre.com/docs/soap_apis/management/itinerary/Retrieve_Itinerary/help_doc?page=get-reservation-request-and-response-structure
Which says:
REMARKS Allows to display remark information (supported types: REG, HD, HS, CLIADR, DELADR, INVOICE, ITINERARY, INTERFACE, CODED_A, PRTONTKT, CORPORATE, FOP, QQ, FILLER, ITINSEGASSOC)

adding 1 user with htpasswd in 2 different servers using ssh connection

i'm working with apache camel and i want to add one user in two differents servers.And i want to test if ssh.redundancy=true.This is my code :
<simple ${headers.op} == 1</simple>
<doTry id="try-cmd-httpd">
<setBody id="httpd.cmd.htpasswd">
<simple>htpasswd -b /etc/httpd/passwords ${header.login} ${header.passwd} {{httpd.io_redir}}</simple>
</setBody>
**<to id="to_exec_htpaswd" uri="ssh://{{ssh.user}}:{{ssh.passwd}}#{{ssh.host}}:{{ssh.port}}"/>**
<log id="htpasswdResp_log" message="response: ${body}"/>
**<to id="to_exec_htpaswd2" uri="ssh://{{ssh.user}}:{{ssh.passwd}}#{{ssh.host2}}:{{ssh.port}}"/>**
<log id="htpasswdResp_log2" message="response: ${body}"/> ```
I found the solution.Just add a choice for the parametre ssh.redundancy and invoque for the second time.
<when id="redundancytrue">
<simple>{{ssh.redundancy}} == "true"</simple>
<setBody id="httpd.cmd.htpasswd">
<simple>htpasswd -b /etc/httpd/passwords ${header.login} ${header.passwd} {{httpd.io_redir}}</simple>
</setBody>
<to id="to_exec_htpaswd2" uri="ssh://{{ssh.user}}:{{ssh.passwd}}#{{ssh.host2}}:{{ssh.port}}"/>
</when>
</choice>```

Change ossec(wazuh) agent profiles via saltstack

I'm trying to modify the <config-profile> section of a ossc.conf file, including a grains content.
something like:
ossec-profiles:
- profile1
- profile2
and I want to modify the section <config-profile> from
<config-profile>centos, centos7</config-profile>
to
<config-profile>centos, centos7, profile1, profile2</config-profile>
in the ossec.conf file
Any idea?
This can be done by using file.replace module which makes you able to change a text in a file based on a pattern. So in your case you can do the following:
You need to select the pattern as regex group so you can use it later as shown below
configure_ossec:
file.replace:
- name: /path/to/ossec.conf
- pattern: '((<config-profile>.*?)[^<]*)'
- repl: {{ '\\1, ' + pillar['ossec-profiles'] | join(', ') }}
Or you might use this pattern to match only whatever inside config-profile tags then you will be able to call it again in the repl parameter:
(?<=<config-profile>)(.*)(?=<\/config-profile>)
Note: As pillar['ossec-profiles'] should return a list of profiles
then you have to use the join filter in order to separate the values
with comma as a delimiter
And finally the output expected to be something like this:
Changes:
----------
diff:
---
+++
## -1 +1 ##
-<config-profile>centos, centos7</config-profile>
+<config-profile>centos, centos7, profile1, profile2</config-profile>

How to send custom metric from collectd (stackdriver agent) to stackdriver

I can't send data to strackdriver. It's simple example.
I'm using syntax what I found in example for collectd.
Stackdriver documentation don't have info about how to send custom data from exec module.
What am I doing wrong?
This is collectd.conf
LoadPlugin exec
<Plugin "exec">
Exec "apache" "/etc/stackdriver/collectd.d/dir.sh"
</Plugin>
This is dir.sh
#!/bin/bash
FOLDER="/var/www/"
while true; do
DU=$(du -shm ${FOLDER} | awk '{print $1}')
echo "PUTVAL \"projects/project_name/custom.googleapis.com/folder/completesolar\" interval=60 N:${DU}"
sleep 60
done
Script output
$/etc/stackdriver/collectd.d/dir.sh
PUTVAL "projects/project_name/custom.googleapis.com/folder/completesolar" interval:60 N:1155
I enabled debug mode and found this error:
[2018-09-21 00:45:55] utils_cmd_putval: handle_putval (fh = 0x3e71d8f040, buffer = PUTVAL "projects/project_name/custom.googleapis.com/folder/completesolar" interval=60 N:1155);
[2018-09-21 00:45:55] No such dataset registered: custom.googleapis.com/folder/completesolar
I created this metric and found it in stackdriver console:
http://joxi.ru/a2XlPGvi1VzJL2
This is json for creating my metric:
{
"name": "projects/project_name/metricDescriptors/custom.googleapis.com/folder/completesolar",
"metricKind": "GAUGE",
"valueType": "DOUBLE",
"unit": "By",
"description": "Folder bytes used",
"displayName": "Folder usage",
"type": "custom.googleapis.com/folder/completesolar",
"metadata": {
"launchStage": "GA",
"samplePeriod": "60s",
"ingestDelay": "0s"
}
}
This should be work.
/etc/stackdriver/collectd.d/dir.conf
LoadPlugin exec
<Plugin "exec">
Exec "apache" "/path/to/dir.sh"
</Plugin>
LoadPlugin target_set
PreCacheChain "PreCache"
<Chain "PreCache">
<Rule "dir">
<Match regex>
Plugin "^exec$"
PluginInstance "^dir$"
</Match>
<Target "set">
MetaData "stackdriver_metric_type" "custom.googleapis.com/folder/completesolar"
# MetaData "stackdriver_metric_type" "custom.googleapis.com/%{plugin_instance}/%{type_instance}"
# MetaData "label:name" "dir usage"
</Target>
</Rule>
</Chain>
/path/to/dir.sh
#!/bin/bash
INTERVAL="$COLLECTD_INTERVAL"
HOSTNAME="$COLLECTD_HOSTNAME"
FOLDER="/var/www/"
while true; do
DU=$(du -sm ${FOLDER} | awk '{print $1}')
# https://collectd.org/documentation/manpages/collectd-exec.5.shtml
# PUTVAL Identifier [OptionList] Valuelist
# Identifier: <host>/<plugin>-<plugin_instance>/<type>-<type_instance>
# Type: See /opt/stackdriver/collectd/share/collectd/types.db
echo "PUTVAL ${HOSTNAME}/exec-dir/gauge-usage/ interval=${INTERVAL} N:${DU}"
sleep "${INTERVAL}"
done
See below if you want to (pre) create or delete a metric.
https://cloud.google.com/monitoring/custom-metrics/creating-metrics
Looks like you are following this guide to ingest exec metrics. I think the rewrite rules did not work so the metric ends up being ingested though a regular agent metrics path, which rejects unrecognized metrics. You might need to modify the metadata for your metric by using filter chain . I would suggest you to revisit the troubleshooting guide.

adding custom attributes to openldap

This is my first time at LDAP . I have setup an openldap on ubuntu machine and an ldap browser (phpldapadmin) on the remote system .I 'm trying to add two custom attributes to the cn=config and i get a successful message but if i see the attributes or the schema in the ldap browser its no where visible , please let me know where i'm going wrong . Below are the steps i have taken
1)Creating custom.schema file
#file to add custom schemas to the ldap
attributetype ( 1.7.11.1.1
NAME 'studentid'
DESC 'unique id given to each student of the college'
EQUALITY caseIgnoreMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
SINGLE-VALUE )
attributetype ( 1.7.11.1.2
NAME 'pexpiry'
DESC 'indicated the date of password expiry'
EQUALITY caseIgnoreMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
SINGLE-VALUE )
objectClass ( 1.7.11.1.1.100
NAME 'Studentinfo'
DESC 'Studentinfo object classes '
SUP top
AUXILIARY
MUST ( studentid $ pexpiry $
)
)
2)Create an ldif file
#ldif file containing the custom schema
dn: cn=custom,cn=schema,cn=config
objectClass: olcSchemaConfig
cn: custom
olcAttributeTypes: ( 1.7.11.1.1
NAME 'studentid'
DESC 'unique id given to each student of the college'
EQUALITY caseIgnoreMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
SINGLE-VALUE )
olcAttributeTypes: ( 1.7.11.1.2
NAME 'pexpiry'
DESC 'indicated the date of password expiry'
EQUALITY caseIgnoreMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
SINGLE-VALUE )
olcObjectClasses: ( 1.7.11.1.1.100
NAME 'Studentinfo'
DESC 'Studentinfo object class '
SUP top
AUXILIARY
MUST ( studentid $ pexpiry $
)
)
3)Add the ldif file to the cn=config using the below command
ldapadd -x -h 192.168.2.3 -D "cn=admin,cn=config" -W -f ./custom.ldif
It first asks for password , i enter the password and i get the message as
Adding entry "cn=custom,cn=schema,cn=config"
But when i goto browser i don't see the schema nor the attributes there .I tried to add an user it said invalid attributes .
1] Add custom schema in slapd.conf and restart LDAP service.If Everything is ok service will start properly otherwise it will give error.
2] After this if possible use Apache Studio for browsing,i was also not able to see the custom object in other browsers.

Resources