Network Device Detail Fetcher Actor

Network Device Detail Fetcher Actor

by srini047

An Apify Actor that fetches detailed information about network devices via SSH. This Actor is designed to efficiently retrieve device data from multip...

18 runs
2 users
Try This Actor

Opens on Apify.com

About Network Device Detail Fetcher Actor

An Apify Actor that fetches detailed information about network devices via SSH. This Actor is designed to efficiently retrieve device data from multiple hosts while maintaining robust error handling and minimal resource usage.

What does this actor do?

Network Device Detail Fetcher Actor is a web scraping and automation tool available on the Apify platform. It's designed to help you extract data and automate tasks efficiently in the cloud.

Key Features

  • Cloud-based execution - no local setup required
  • Scalable infrastructure for large-scale operations
  • API access for integration with your applications
  • Built-in proxy rotation and anti-blocking measures
  • Scheduled runs and webhooks for automation

How to Use

  1. Click "Try This Actor" to open it on Apify
  2. Create a free Apify account if you don't have one
  3. Configure the input parameters as needed
  4. Run the actor and download your results

Documentation

Network Device Detail Fetcher Actor An Apify Actor that fetches detailed information about network devices via SSH. This Actor is designed to efficiently retrieve device data from multiple hosts while maintaining robust error handling and minimal resource usage. ## Features - SSH-based device connectivity - Connect to multiple network devices securely using SSH - Command execution - Execute arbitrary commands on remote devices with optional sudo support - CSV-based device management - Load device configuration from CSV files - Structured output - Organize command outputs in a structured JSON format for easy analysis - Error handling - Graceful error handling with detailed logging for failed connections and commands - Async support - Leverages async/await for efficient cloud execution on Apify platform ## Input The Actor accepts the following input configuration: json { "csvFilePath": "path/to/devices.csv" } ### CSV Format Create a CSV file with device details in the following format: csv Serial Number,IP,Port,Hostname,Password 2,192.168.215.2,22,root,root 3,192.168.215.3,22,admin,password123 Required fields: - Serial Number - Unique device identifier - IP - Device IP address - Hostname - SSH username for authentication Optional fields: - Port - SSH port (default: 22) - Password - SSH password for authentication ## Output The Actor pushes structured JSON data to the dataset for each device: json { "device_ip": "192.168.215.2", "device_name": "N/A", "commands_executed": [ { "command": "ip -j addr show", "output": "...", "error": "" }, { "command": "uname -a", "output": "...", "error": "" } ] } In case of errors: json { "device_ip": "192.168.215.2", "error": "SSH connection failed: [Errno -2] Name or service not known" } ## Configuration ### Devices CSV - Path: data/input.csv (default) - Format: CSV with headers matching Device model fields ### Commands Edit src/constants.py to customize which commands execute on each device: python COMMANDS = [ "ip -j addr show", "ip -j link show", "uname -a", "lscpu -J", ] ### SSH Settings Configure SSH connection timeout in src/constants.py: python SSH_CONNECTION_TIMEOUT = 10 # seconds ## Local Development ### Prerequisites - Python 3.13+ - Paramiko (SSH client library) - Pydantic (data validation) - Apify SDK ### Installation bash # Install dependencies pip install -r requirements.txt # Run locally apify run ### Testing Run the test script to verify device connectivity: bash python test.py ## Deployment ### Prerequisites - Apify account - Apify CLI installed (npm install -g apify-cli) ### Steps 1. Authenticate with Apify: bash apify login 2. Deploy the Actor: bash apify push 3. Run on Apify platform through the web console or API ## Project Structure . ├── .actor/ │ ├── actor.json # Actor configuration │ └── INPUT_SCHEMA.json # Input validation schema ├── src/ │ ├── __main__.py # Entry point │ ├── main.py # Actor logic │ ├── models.py # Pydantic data models │ ├── constants.py # Configuration constants │ └── actor/ │ ├── connect.py # SSH connection handler │ └── device.py # Device CSV loader ├── data/ │ └── input.csv # Device configuration file ├── storage/ # Local Apify storage (ignored in git) ├── Dockerfile # Container configuration ├── requirements.txt # Python dependencies └── README.md # This file ## Device Model The Device model defines the structure for device configuration: python class Device(BaseModel): serial_number: str = Field(alias="Serial Number") ip: str = Field(alias="IP") port: Optional[int] = Field(alias="Port", default=22) hostname: Optional[str] = Field(alias="Hostname", default=None) password: Optional[str] = Field(alias="Password", default=None) ## Error Handling The Actor implements comprehensive error handling: - CSV parsing errors - Logged and skipped, allowing other devices to process - SSH connection failures - Caught and stored in output dataset - Command execution errors - Captured and included in command output - Timeout handling - Configurable SSH timeout with proper cleanup ## Security Considerations ⚠️ Important: This Actor handles sensitive data (passwords, device IP addresses, command outputs). - Store credentials securely using Apify's Secrets feature - Use SSH keys instead of passwords when possible - Avoid logging sensitive data - Review device access policies before deployment - Ensure CSV files are stored securely ## Troubleshooting ### Connection Refused - Verify device IP address and port are correct - Ensure SSH service is running on the device - Check firewall rules allow SSH access ### Authentication Failed - Verify username (Hostname field) is correct - Confirm password is accurate - Check if device uses key-based authentication (not yet supported) ### Command Execution Timeout - Increase SSH_CONNECTION_TIMEOUT in src/constants.py - Verify device is responsive - Check if commands are hanging waiting for input ## Future Enhancements - [ ] Support SSH key-based authentication - [ ] Batch command execution with parallel processing - [ ] Output schema for better Apify Console integration - [ ] Dataset schema for structured data display - [ ] Support for custom device properties - [ ] Command output parsing and structured extraction ## License MIT ## Author Sriniketh J ## Support For issues or questions, please refer to the Apify documentation.

Common Use Cases

Market Research

Gather competitive intelligence and market data

Lead Generation

Extract contact information for sales outreach

Price Monitoring

Track competitor pricing and product changes

Content Aggregation

Collect and organize content from multiple sources

Ready to Get Started?

Try Network Device Detail Fetcher Actor now on Apify. Free tier available with no credit card required.

Start Free Trial

Actor Information

Developer
srini047
Pricing
Paid
Total Runs
18
Active Users
2
Apify Platform

Apify provides a cloud platform for web scraping, data extraction, and automation. Build and run web scrapers in the cloud.

Learn more about Apify

Need Professional Help?

Couldn't solve your problem? Hire a verified specialist on Fiverr to get it done quickly and professionally.

Find a Specialist

Trusted by millions | Money-back guarantee | 24/7 Support