{"action":"created","issue":{"url":"https://api.github.com/repos/ktbyers/netmiko/issues/858","repository_url":"https://api.github.com/repos/ktbyers/netmiko","labels_url":"https://api.github.com/repos/ktbyers/netmiko/issues/858/labels{/name}","comments_url":"https://api.github.com/repos/ktbyers/netmiko/issues/858/comments","events_url":"https://api.github.com/repos/ktbyers/netmiko/issues/858/events","html_url":"https://github.com/ktbyers/netmiko/issues/858","id":337358880,"node_id":"MDU6SXNzdWUzMzczNTg4ODA=","number":858,"title":"Netmiko as a Service","user":{"login":"fixlensmith","id":37141415,"node_id":"MDQ6VXNlcjM3MTQxNDE1","avatar_url":"https://avatars1.githubusercontent.com/u/37141415?v=4","gravatar_id":"","url":"https://api.github.com/users/fixlensmith","html_url":"https://github.com/fixlensmith","followers_url":"https://api.github.com/users/fixlensmith/followers","following_url":"https://api.github.com/users/fixlensmith/following{/other_user}","gists_url":"https://api.github.com/users/fixlensmith/gists{/gist_id}","starred_url":"https://api.github.com/users/fixlensmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fixlensmith/subscriptions","organizations_url":"https://api.github.com/users/fixlensmith/orgs","repos_url":"https://api.github.com/users/fixlensmith/repos","events_url":"https://api.github.com/users/fixlensmith/events{/privacy}","received_events_url":"https://api.github.com/users/fixlensmith/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-07-02T03:33:51Z","updated_at":"2018-07-02T19:13:14Z","closed_at":null,"author_association":"NONE","body":"Hi, \r\ni want to ask, how to make my script as service, for example : \r\ni want to ping every 5 minutes to x.x.x.x, \r\nso i just send_command 'ping x.x.x.x'\r\nand make cron job to running the script every 5 minutes.\r\nso the flow like this\r\n running every 5 minutes (Cron ---> Python Execute ----> Login to devices ----> send the command)\r\n\r\nhow to make the flow become like this\r\nPython Execute -----> Login to devices -----> Running Every 5 minutes (send Command)\r\n\r\nso no need for me to always login every 5 minutes, just 1 time login, and running the command every 5 minutes..\r\n\r\nhow to make this happen?"},"comment":{"url":"https://api.github.com/repos/ktbyers/netmiko/issues/comments/401905432","html_url":"https://github.com/ktbyers/netmiko/issues/858#issuecomment-401905432","issue_url":"https://api.github.com/repos/ktbyers/netmiko/issues/858","id":401905432,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMTkwNTQzMg==","user":{"login":"ktbyers","id":899716,"node_id":"MDQ6VXNlcjg5OTcxNg==","avatar_url":"https://avatars0.githubusercontent.com/u/899716?v=4","gravatar_id":"","url":"https://api.github.com/users/ktbyers","html_url":"https://github.com/ktbyers","followers_url":"https://api.github.com/users/ktbyers/followers","following_url":"https://api.github.com/users/ktbyers/following{/other_user}","gists_url":"https://api.github.com/users/ktbyers/gists{/gist_id}","starred_url":"https://api.github.com/users/ktbyers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ktbyers/subscriptions","organizations_url":"https://api.github.com/users/ktbyers/orgs","repos_url":"https://api.github.com/users/ktbyers/repos","events_url":"https://api.github.com/users/ktbyers/events{/privacy}","received_events_url":"https://api.github.com/users/ktbyers/received_events","type":"User","site_admin":false},"created_at":"2018-07-02T19:13:14Z","updated_at":"2018-07-02T19:13:14Z","author_association":"OWNER","body":"You would just write a continuously running Python program that had a main loop in it that was always running (and probably with a builtin 5 minute sleep inside that main loop).\r\n\r\nYou would probably use something like `supervisord` to ensure that your program was always running and restart it if it failed.\r\n\r\nNote, I probably wouldn't try to keep the connection to the device always alive; I would probably just login to the device every 5 minutes; do what you need to do; and then disconnect.\r\n\r\nIf you want to keep the connection to the device always alive, then you are going to need to add logic into your program and checks if the connection is alive or not. If the connection is not alive, then you will need to re-connect. You might also need to check that other things like firewalls and VTY timers don't tear down the connection automatically.\r\n\r\n"}}
{"actor":{"display_login":"ktbyers"}}