Hi i am trying to make a SSH command and parse the response through my DataMiner driver. I am able to connect and see the requests and responses in the stream viewer. however, my response parameter appears to be blank. what am i missing?
Below is a snippet of how the SSH is configured:
<Param id="195" trending="false">
<Name>SSH_Username</Name>
<Description>SSH Username</Description>
<Type>read</Type>
<Information>
</Information>
<Interprete>
<RawType>other</RawType>
<Type>string</Type>
<LengthType>next param</LengthType>
<DefaultValue>root</DefaultValue>
</Interprete>
<Display>
<RTDisplay>true</RTDisplay>
<Positions>
<Position>
<Page>debug</Page>
<Column>0</Column>
<Row>0</Row>
</Position>
</Positions>
</Display>
<Measurement>
<Type>string</Type>
</Measurement>
</Param>
<Param id="295" setter="true">
<Name>SSH_Username</Name>
<Description>SSH Username</Description>
<Type>write</Type>
<Interprete>
<RawType>other</RawType>
<Type>string</Type>
<LengthType>next param</LengthType>
</Interprete>
<Display>
<RTDisplay>true</RTDisplay>
<Positions>
<Position>
<Page>debug</Page>
<Column>0</Column>
<Row>0</Row>
</Position>
</Positions>
</Display>
<Measurement>
<Type>string</Type>
</Measurement>
</Param>
<Param id="196" trending="false">
<Name>SSH_Password</Name>
<Description>SSH Password</Description>
<Type>read</Type>
<Information>
</Information>
<Interprete>
<RawType>other</RawType>
<Type>string</Type>
<LengthType>next param</LengthType>
<DefaultValue></DefaultValue>
</Interprete>
<Display>
<RTDisplay>true</RTDisplay>
<Positions>
<Position>
<Page>debug</Page>
<Column>0</Column>
<Row>1</Row>
</Position>
</Positions>
</Display>
<Measurement>
<Type options="password">string</Type>
</Measurement>
</Param>
<Param id="296" setter="true">
<Name>SSH_Password</Name>
<Description>SSH Password</Description>
<Type>write</Type>
<Interprete>
<RawType>other</RawType>
<Type>string</Type>
<LengthType>next param</LengthType>
</Interprete>
<Display>
<RTDisplay>true</RTDisplay>
<Positions>
<Position>
<Page>debug</Page>
<Column>0</Column>
<Row>1</Row>
</Position>
</Positions>
</Display>
<Measurement>
<Type options="password">string</Type>
</Measurement>
</Param>
<Param id="197" trending="false">
<Name>SSH_Response</Name>
<Description>SSH Response</Description>
<Type>read</Type>
<Information>
</Information>
<Interprete>
<RawType>other</RawType>
<Type>string</Type>
<LengthType>next param</LengthType>
</Interprete>
<Display>
<RTDisplay>true</RTDisplay>
<Positions>
<Position>
<Page>debug</Page>
<Column>0</Column>
<Row>4</Row>
</Position>
</Positions>
</Display>
<Measurement>
<Type lines="20">string</Type>
</Measurement>
</Param>
<Param id="198">
<Name>RequestSSH_Dummy</Name>
<Description>Request SSH Dummy</Description>
<Type>dummy</Type>
</Param>
<Param id="199" trending="false" save="true">
<Name>SSHCommand</Name>
<Description>SSH Command</Description>
<Type>read</Type>
<Information>
</Information>
<Interprete>
<RawType>other</RawType>
<Type>string</Type>
<LengthType>next param</LengthType>
<DefaultValue>phkstatus | grep -A 4 Temperature</DefaultValue>
</Interprete>
<Display>
<RTDisplay>true</RTDisplay>
<Positions>
<Position>
<Page>debug</Page>
<Column>0</Column>
<Row>2</Row>
</Position>
</Positions>
</Display>
<Measurement>
<Type>string</Type>
</Measurement>
</Param>
<Param id="299" setter="true">
<Name>SSHCommand</Name>
<Description>SSH Command</Description>
<Type>write</Type>
<Interprete>
<RawType>other</RawType>
<Type>string</Type>
<LengthType>next param</LengthType>
</Interprete>
<Display>
<RTDisplay>true</RTDisplay>
<Positions>
<Position>
<Page>debug</Page>
<Column>0</Column>
<Row>2</Row>
</Position>
</Positions>
</Display>
<Measurement>
<Type>string</Type>
</Measurement>
</Param>
<Param id="300">
<Name>enter</Name>
<Description>Enter</Description>
<Type>fixed</Type>
<Interprete>
<RawType>other</RawType>
<LengthType>fixed</LengthType>
<Length>2</Length>
<Type>string</Type>
<Value>0x0D</Value>
</Interprete>
</Param>
<Param id="301" trending="false">
<Name>trailer</Name>
<Description>Trailer</Description>
<Type>trailer</Type>
<Interprete>
<RawType>other</RawType>
<LengthType>fixed</LengthType>
<Type>string</Type>
<Length>1</Length>
<Value>$</Value>
</Interprete>
</Param>
<HTTP>
<Session id="13" name="SSH Connection">
<Connection id="2" name="SSH Connection">
<Type>serial</Type>
<CommunicationOptions>
<KexAlgorithms>
<KexAlgorithm>diffie-hellman-group1-sha1</KexAlgorithm>
<KexAlgorithm>diffie-hellman-group-exchange-sha1</KexAlgorithm>
</KexAlgorithms>
</CommunicationOptions>
<UserSettings>
<IPport>
<DefaultValue>22</DefaultValue>
</IPport>
<BusAddress>
<Disabled>true</Disabled>
</BusAddress>
<PortTypeUDP>
<Disabled>true</Disabled>
</PortTypeUDP>
<PortTypeSerial>
<Disabled>true</Disabled>
</PortTypeSerial>
</UserSettings>
</Connection>
</Session>
</HTTP>
<Commands>
<Command id="1">
<Name>SSH Command</Name>
<Description>Custom Command</Description>
<Content>
<Param>199</Param>
<Param>300</Param>
</Content>
</Command>
</Commands>
<Responses>
<Response id="1" >
<Name>SSHResponse</Name>
<Description>SSH Response</Description>
<Content>
<Param>199</Param>
<Param>300</Param>
<Param>197</Param>
<Param>301</Param>
</Content>
</Response>
</Responses>
<Pairs>
<Pair id="1">
<Name>SSH Request</Name>
<Description>SSH Request</Description>
<Content>
<Command>1</Command>
<Response>1</Response>
</Content>
</Pair>
</Pairs>
<Groups>
<Group id="26" connection="2">
<Name>SSH Request</Name>
<Description>SSH Request</Description>
<Type>poll</Type>
<Content>
<Pair>1</Pair>
</Content>
</Group>
</Groups>
<Actions>
<Action id="27">
<Name>SSH Request Action</Name>
<On id="26">group</On>
<Type>execute next</Type>
</Action>
</Actions>
<Timers>
<Timer id="2">
<Name>Medium Timer (1m)</Name>
<Time initial="true" dataDisplay="30000">60000</Time>
<Interval>75</Interval>
<Content>
<Group>26</Group>
</Content>
</Timer>
</Timers>
<Ports>
<PortSettings name="SSH Connection" visibleInUi="true">
<IPport>
<DefaultValue>22</DefaultValue>
</IPport>
<BusAddress>
<Disabled>true</Disabled>
</BusAddress>
<PortTypeSerial>
<Disabled>true</Disabled>
</PortTypeSerial>
<PortTypeUDP>
<Disabled>true</Disabled>
</PortTypeUDP>
<SSH>
<Credentials>
<Username pid="195"/>
<Password pid="196"/>
</Credentials>
</SSH>
</PortSettings>
</Ports>
Hi Donnell,
I'm not sure that this will resolve your issue, but what caught my eye after a quick glance was the configuration of parameter 300.
The value specified for that parameter is "0x0D", with Length 2, but your length should be 1 as the hex string "0x0D" represents a single character "Carriage Return".
It's possible that this difference causes DataMiner to not match the response you received into the response object you defined.
Let me know if this resolves your issue.
Kind regards,
Hello Donnell,
What I would do to debug this would be to remove the header parameters in the response tag so all that is left is the response data and trailer and see if the parameter gets filled in. If that works then you can remove the header in the QAction when processing the response.
Hey Bram,
I didnt see that, thanks for the correction! but you're right, it didnt help DataMiner match the response.
cheers!