Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

SNMP Polling with PHP

Options
  • 01-04-2010 3:23pm
    #1
    Registered Users Posts: 1,127 ✭✭✭


    You may have seen my previous posts about trying to get php working with snmp, now that i FINALLY figured that out with the help of wiZzard on here I have written a few scripts and have snmp data displaying on a web page.

    I want to know can i poll snmp devices with php, say every five minutes or something?

    Is this possible with php?


Comments

  • Registered Users Posts: 6,762 ✭✭✭WizZard


    Yes you can.

    You will need to write a (php) job script and then schedule it to run however often you need using a job scheduler (*nix: cron, Windows:Task Scheduler)

    Have a look at poller.php from Cacti for some examples


  • Registered Users Posts: 1,127 ✭✭✭mossy464


    Thanks again wizZard. Much appreciated.


  • Registered Users Posts: 1,127 ✭✭✭mossy464


    Also, one other question. I wrote a php script to obtain various snmp data like sysUpTime etc. It returns say timeticks... etc.

    How can i take say just the time itself out of this.

    The same for sysContact. It comes back with STRING : Maurice. How can i get rid of the STRING?

    Sorry now for all the different questions im asking


  • Registered Users Posts: 1,127 ✭✭✭mossy464


    Well I found out I can use str_replace to get rid of the STRING part in the snmp messages.

    Another question, what would be the best way to detect new devices connected to the network?

    I was thinking of writing a php script to ping a range of ip addresses every few minutes and therefore detect any new ip's but this could be pretty messy and would not be the most efficient way of doing it. Any suggestions??


Advertisement